aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin McKinney <klmckinney1@gmail.com>2011-12-01 22:02:16 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2011-12-08 15:42:16 -0500
commit6561f91d68e6f93cba91e64a3b9e0feba8b84fb8 (patch)
treea1f9daa01b757194dad75c6dd8aaee574213d34d
parent09468b0392b1d2b079b334d60a23d7da8105dc53 (diff)
Staging: bcm: Alter code to move error handling closer to the calls; and remove white space, IOCTL_BCM_NVM_WRITE.
This is a clean up patch for IOCTL_BCM_NVM_WRITE that replaces the assignment of the Status variable with direct returns of the error code, replaces the break statements with direct returns, and removes a white space. Signed-off-by: Kevin McKinney <klmckinney1@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/bcm/Bcmchar.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c
index ad1cc5598dca..5655ce3418c0 100644
--- a/drivers/staging/bcm/Bcmchar.c
+++ b/drivers/staging/bcm/Bcmchar.c
@@ -1269,8 +1269,7 @@ cntrlEnd:
1269 memset(&tv1, 0, sizeof(struct timeval)); 1269 memset(&tv1, 0, sizeof(struct timeval));
1270 if ((Adapter->eNVMType == NVM_FLASH) && (Adapter->uiFlashLayoutMajorVersion == 0)) { 1270 if ((Adapter->eNVMType == NVM_FLASH) && (Adapter->uiFlashLayoutMajorVersion == 0)) {
1271 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "The Flash Control Section is Corrupted. Hence Rejection on NVM Read/Write\n"); 1271 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "The Flash Control Section is Corrupted. Hence Rejection on NVM Read/Write\n");
1272 Status = -EFAULT; 1272 return -EFAULT;
1273 break;
1274 } 1273 }
1275 1274
1276 if (IsFlash2x(Adapter)) { 1275 if (IsFlash2x(Adapter)) {
@@ -1279,7 +1278,7 @@ cntrlEnd:
1279 (Adapter->eActiveDSD != DSD2)) { 1278 (Adapter->eActiveDSD != DSD2)) {
1280 1279
1281 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "No DSD is active..hence NVM Command is blocked"); 1280 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "No DSD is active..hence NVM Command is blocked");
1282 return STATUS_FAILURE ; 1281 return STATUS_FAILURE;
1283 } 1282 }
1284 } 1283 }
1285 1284
@@ -1298,8 +1297,7 @@ cntrlEnd:
1298 1297
1299 if ((stNVMReadWrite.uiOffset + stNVMReadWrite.uiNumBytes) > Adapter->uiNVMDSDSize) { 1298 if ((stNVMReadWrite.uiOffset + stNVMReadWrite.uiNumBytes) > Adapter->uiNVMDSDSize) {
1300 /* BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Can't allow access beyond NVM Size: 0x%x 0x%x\n", stNVMReadWrite.uiOffset, stNVMReadWrite.uiNumBytes); */ 1299 /* BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Can't allow access beyond NVM Size: 0x%x 0x%x\n", stNVMReadWrite.uiOffset, stNVMReadWrite.uiNumBytes); */
1301 Status = STATUS_FAILURE; 1300 return STATUS_FAILURE;
1302 break;
1303 } 1301 }
1304 1302
1305 pReadData = kzalloc(stNVMReadWrite.uiNumBytes, GFP_KERNEL); 1303 pReadData = kzalloc(stNVMReadWrite.uiNumBytes, GFP_KERNEL);
@@ -1307,9 +1305,8 @@ cntrlEnd:
1307 return -ENOMEM; 1305 return -ENOMEM;
1308 1306
1309 if (copy_from_user(pReadData, stNVMReadWrite.pBuffer, stNVMReadWrite.uiNumBytes)) { 1307 if (copy_from_user(pReadData, stNVMReadWrite.pBuffer, stNVMReadWrite.uiNumBytes)) {
1310 Status = -EFAULT;
1311 kfree(pReadData); 1308 kfree(pReadData);
1312 break; 1309 return -EFAULT;
1313 } 1310 }
1314 1311
1315 do_gettimeofday(&tv0); 1312 do_gettimeofday(&tv0);
@@ -1404,9 +1401,8 @@ cntrlEnd:
1404 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, " timetaken by Write/read :%ld msec\n", (tv1.tv_sec - tv0.tv_sec)*1000 + (tv1.tv_usec - tv0.tv_usec)/1000); 1401 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, " timetaken by Write/read :%ld msec\n", (tv1.tv_sec - tv0.tv_sec)*1000 + (tv1.tv_usec - tv0.tv_usec)/1000);
1405 1402
1406 kfree(pReadData); 1403 kfree(pReadData);
1407 Status = STATUS_SUCCESS; 1404 return STATUS_SUCCESS;
1408 } 1405 }
1409 break;
1410 1406
1411 case IOCTL_BCM_FLASH2X_SECTION_READ: { 1407 case IOCTL_BCM_FLASH2X_SECTION_READ: {
1412 FLASH2X_READWRITE sFlash2xRead = {0}; 1408 FLASH2X_READWRITE sFlash2xRead = {0};