mmc; fix the kernel crasht for th he bug in rk29_sdmmc_progress_store()
authorxbw <xbw@rock-chips.com>
Sun, 25 Mar 2012 06:06:15 +0000 (14:06 +0800)
committerxbw <xbw@rock-chips.com>
Sun, 25 Mar 2012 06:06:15 +0000 (14:06 +0800)
drivers/mmc/host/rk29_sdmmc.c

index 722caac23c3d7a1a3c764f77e7af3114161e06c3..785f092e1c4d5320a5f9003cd8a3dd8352eef5a1 100755 (executable)
@@ -299,8 +299,6 @@ ssize_t rk29_sdmmc_progress_store(struct kobject *kobj, struct kobj_attribute *a
         return count;
     }
     
-    spin_lock(&host->lock);
-    
     //envalue the address of host base on input-parameter.
     if( !strncmp(buf,"sd-" , strlen("sd-")) )
     {
@@ -308,7 +306,7 @@ ssize_t rk29_sdmmc_progress_store(struct kobject *kobj, struct kobj_attribute *a
         if(!host)
         {
             printk("%s..%d.. fail to call progress_store because the host is null. ==xbw==\n",__FUNCTION__,__LINE__);
-            goto progress_store_out;
+            return count;
         }
     }    
     else if(  !strncmp(buf,"sdio1-" , strlen("sdio1-")) )
@@ -317,7 +315,7 @@ ssize_t rk29_sdmmc_progress_store(struct kobject *kobj, struct kobj_attribute *a
         if(!host)
         {
             printk("%s..%d.. fail to call progress_store because the host-sdio1 is null. ==xbw==\n",__FUNCTION__,__LINE__);
-            goto progress_store_out;
+            return count;
         }
     }
     else if(  !strncmp(buf,"sdio2-" , strlen("sdio2-")) )
@@ -326,15 +324,17 @@ ssize_t rk29_sdmmc_progress_store(struct kobject *kobj, struct kobj_attribute *a
         if(!host)
         {
             printk("%s..%d.. fail to call progress_store because the host-sdio2 is null. ==xbw==\n",__FUNCTION__,__LINE__);
-            goto progress_store_out;
+            return count;
         }
     }
     else
     {
         printk("%s..%d.. You want to use sysfs for SDMMC but input-parameter is wrong.====xbw====\n",__FUNCTION__,__LINE__);
-        goto progress_store_out;//return count;
+        return count;
     }
 
+    spin_lock(&host->lock);
+
     if(strncmp(buf,oldbuf , strlen(buf)))
     {
            printk(".%d.. MMC0 receive the message %s from VOLD.====xbw[%s]====\n", __LINE__, buf, host->dma_name);
@@ -458,7 +458,6 @@ ssize_t rk29_sdmmc_progress_store(struct kobject *kobj, struct kobj_attribute *a
         }
     }
     
-progress_store_out:
     spin_unlock(&host->lock);
     
     return count;