* [PATCH] scsi: core: return -ENOMEM on ips_init_phase1() allocation failure
@ 2021-10-19 10:50 Jiapeng Chong
2021-10-19 11:49 ` James Bottomley
0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2021-10-19 10:50 UTC (permalink / raw)
To: aacraid; +Cc: jejb, martin.petersen, linux-scsi, linux-kernel, chongjiapeng
From: chongjiapeng <jiapeng.chong@linux.alibaba.com>
Fixes the following smatch warning:
drivers/scsi/ips.c:6901 ips_init_phase1() warn: returning -1 instead of
-ENOMEM is sloppy.
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Fixes: dd00cc486ab1 ("some kmalloc/memset ->kzalloc (tree wide)")
Signed-off-by: chongjiapeng <jiapeng.chong@linux.alibaba.com>
---
drivers/scsi/ips.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index 498bf04499ce..2ce97f407d18 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -6898,7 +6898,7 @@ ips_init_phase1(struct pci_dev *pci_dev, int *indexPtr)
if (ha == NULL) {
IPS_PRINTK(KERN_WARNING, pci_dev,
"Unable to allocate temporary ha struct\n");
- return -1;
+ return -ENOMEM;
}
ips_sh[index] = NULL;
--
2.19.1.6.gb485710b
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] scsi: core: return -ENOMEM on ips_init_phase1() allocation failure
2021-10-19 10:50 [PATCH] scsi: core: return -ENOMEM on ips_init_phase1() allocation failure Jiapeng Chong
@ 2021-10-19 11:49 ` James Bottomley
0 siblings, 0 replies; 2+ messages in thread
From: James Bottomley @ 2021-10-19 11:49 UTC (permalink / raw)
To: Jiapeng Chong, aacraid; +Cc: martin.petersen, linux-scsi, linux-kernel
On Tue, 2021-10-19 at 18:50 +0800, Jiapeng Chong wrote:
> From: chongjiapeng <jiapeng.chong@linux.alibaba.com>
>
> Fixes the following smatch warning:
>
> drivers/scsi/ips.c:6901 ips_init_phase1() warn: returning -1 instead
> of -ENOMEM is sloppy.
Really, like megaraid, it's not. ips_init_phase1() returns either
Success or -1. If it returns -1, that gets translated to -ENODEV so,
again, we'd lose this nuanced return completely.
James
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-19 11:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-19 10:50 [PATCH] scsi: core: return -ENOMEM on ips_init_phase1() allocation failure Jiapeng Chong
2021-10-19 11:49 ` James Bottomley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®