* [PATCH] cciss: fix code style in drivers/block/cciss_scsi.c
@ 2010-05-18 5:57 Steven Liu
2010-05-18 6:08 ` Li Zefan
0 siblings, 1 reply; 2+ messages in thread
From: Steven Liu @ 2010-05-18 5:57 UTC (permalink / raw)
To: mike.miller, linux-kernel, iss_storagedev, liuqi
Hi, Mike Miller,
if kmalloc memory for ld_buff failed,it will free currentsd and
ld_buff once more
so i think this patch may be better
fix code style in drivers/block/cciss_scsi.c
Signed-off-by: Liu Qi <lingjiujianke@gmail.com>
---
drivers/block/cciss_scsi.c | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c
index e1d0e2c..ad2417f 100644
--- a/drivers/block/cciss_scsi.c
+++ b/drivers/block/cciss_scsi.c
@@ -1198,13 +1198,24 @@ cciss_update_non_disk_devices(int cntl_num, int hostno)
c = (ctlr_info_t *) hba[cntl_num];
ld_buff = kzalloc(reportlunsize, GFP_KERNEL);
+ if(ld_buff == NULL){
+ printk(KERN_ERR "cciss: out of memory\n");
+ goto out1;
+ }
+
inq_buff = kmalloc(OBDR_TAPE_INQ_SIZE, GFP_KERNEL);
+ if(inq_buff == NULL){
+ printk(KERN_ERR "cciss: out of memory\n");
+ goto out2;
+ }
+
currentsd = kzalloc(sizeof(*currentsd) *
(CCISS_MAX_SCSI_DEVS_PER_HBA+1), GFP_KERNEL);
- if (ld_buff == NULL || inq_buff == NULL || currentsd == NULL) {
+ if(currentsd == NULL){
printk(KERN_ERR "cciss: out of memory\n");
- goto out;
+ goto out3;
}
+
this_device = ¤tsd[CCISS_MAX_SCSI_DEVS_PER_HBA];
if (cciss_scsi_do_report_phys_luns(c, ld_buff, reportlunsize) == 0) {
ch = &ld_buff->LUNListLength[0];
@@ -1289,9 +1300,12 @@ cciss_update_non_disk_devices(int cntl_num, int hostno)
adjust_cciss_scsi_table(cntl_num, hostno, currentsd, ncurrent);
out:
+ kfree(currentsd);
+out3:
kfree(inq_buff);
+out2:
kfree(ld_buff);
- kfree(currentsd);
+out1:
return;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] cciss: fix code style in drivers/block/cciss_scsi.c
2010-05-18 5:57 [PATCH] cciss: fix code style in drivers/block/cciss_scsi.c Steven Liu
@ 2010-05-18 6:08 ` Li Zefan
0 siblings, 0 replies; 2+ messages in thread
From: Li Zefan @ 2010-05-18 6:08 UTC (permalink / raw)
To: Steven Liu; +Cc: mike.miller, linux-kernel, iss_storagedev, liuqi
Steven Liu wrote:
> Hi, Mike Miller,
>
> if kmalloc memory for ld_buff failed,it will free currentsd and
> ld_buff once more
No, it won't.
> so i think this patch may be better
>
> fix code style in drivers/block/cciss_scsi.c
>
There is no bug or coding style issue, so just leave the code as it is.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-05-18 6:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-18 5:57 [PATCH] cciss: fix code style in drivers/block/cciss_scsi.c Steven Liu
2010-05-18 6:08 ` Li Zefan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.