diff options
author | Kris Borer <kborer@gmail.com> | 2015-08-28 09:31:43 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-10-04 05:51:58 -0400 |
commit | 8091e0cafb1ae8869dcb74c39f7659013bfd3936 (patch) | |
tree | d134c1628caa6e7149393ebf0a2cfea0124174e8 | |
parent | d0452fe09a90d4aff5029d3c053014ae2caeec94 (diff) |
USB: rewrite isd200_init_info for readability
Previously, Coccinelle would issue the following false positive:
isd200.c:1478:14-18: ERROR: reference preceded by free on line 1472
This change rewrites the isd200_init_info function to have more explicit
execution pathways to make it easier for scripts and humans to parse.
Signed-off-by: Kris Borer <kborer@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/storage/isd200.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c index 1bac215202d2..39afd7045c43 100644 --- a/drivers/usb/storage/isd200.c +++ b/drivers/usb/storage/isd200.c | |||
@@ -1456,30 +1456,26 @@ static void isd200_free_info_ptrs(void *info_) | |||
1456 | */ | 1456 | */ |
1457 | static int isd200_init_info(struct us_data *us) | 1457 | static int isd200_init_info(struct us_data *us) |
1458 | { | 1458 | { |
1459 | int retStatus = ISD200_GOOD; | ||
1460 | struct isd200_info *info; | 1459 | struct isd200_info *info; |
1461 | 1460 | ||
1462 | info = kzalloc(sizeof(struct isd200_info), GFP_KERNEL); | 1461 | info = kzalloc(sizeof(struct isd200_info), GFP_KERNEL); |
1463 | if (!info) | 1462 | if (!info) |
1464 | retStatus = ISD200_ERROR; | 1463 | return ISD200_ERROR; |
1465 | else { | ||
1466 | info->id = kzalloc(ATA_ID_WORDS * 2, GFP_KERNEL); | ||
1467 | info->RegsBuf = kmalloc(sizeof(info->ATARegs), GFP_KERNEL); | ||
1468 | info->srb.sense_buffer = | ||
1469 | kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL); | ||
1470 | if (!info->id || !info->RegsBuf || !info->srb.sense_buffer) { | ||
1471 | isd200_free_info_ptrs(info); | ||
1472 | kfree(info); | ||
1473 | retStatus = ISD200_ERROR; | ||
1474 | } | ||
1475 | } | ||
1476 | 1464 | ||
1477 | if (retStatus == ISD200_GOOD) { | 1465 | info->id = kzalloc(ATA_ID_WORDS * 2, GFP_KERNEL); |
1478 | us->extra = info; | 1466 | info->RegsBuf = kmalloc(sizeof(info->ATARegs), GFP_KERNEL); |
1479 | us->extra_destructor = isd200_free_info_ptrs; | 1467 | info->srb.sense_buffer = kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL); |
1468 | |||
1469 | if (!info->id || !info->RegsBuf || !info->srb.sense_buffer) { | ||
1470 | isd200_free_info_ptrs(info); | ||
1471 | kfree(info); | ||
1472 | return ISD200_ERROR; | ||
1480 | } | 1473 | } |
1481 | 1474 | ||
1482 | return retStatus; | 1475 | us->extra = info; |
1476 | us->extra_destructor = isd200_free_info_ptrs; | ||
1477 | |||
1478 | return ISD200_GOOD; | ||
1483 | } | 1479 | } |
1484 | 1480 | ||
1485 | /************************************************************************** | 1481 | /************************************************************************** |