linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: megaraid_mbox: return -ENOMEM on megaraid_init_mbox() allocation failure
@ 2021-10-19 10:53 Jiapeng Chong
  2021-10-19 11:44 ` James Bottomley
  0 siblings, 1 reply; 5+ messages in thread
From: Jiapeng Chong @ 2021-10-19 10:53 UTC (permalink / raw)
  To: kashyap.desai
  Cc: sumit.saxena, shivasharan.srikanteshwara, jejb, martin.petersen,
	megaraidlinux.pdl, linux-scsi, linux-kernel, chongjiapeng

From: chongjiapeng <jiapeng.chong@linux.alibaba.com>

Fixes the following smatch warning:

drivers/scsi/megaraid/megaraid_mbox.c:715 megaraid_init_mbox() 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/megaraid/megaraid_mbox.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
index 14f930d27ca1..d98b223eab9a 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -712,7 +712,8 @@ megaraid_init_mbox(adapter_t *adapter)
 	 * controllers
 	 */
 	raid_dev = kzalloc(sizeof(mraid_device_t), GFP_KERNEL);
-	if (raid_dev == NULL) return -1;
+	if (raid_dev == NULL)
+		return -ENOMEM;
 
 
 	/*
-- 
2.19.1.6.gb485710b


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-10-20 22:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-19 10:53 [PATCH] scsi: megaraid_mbox: return -ENOMEM on megaraid_init_mbox() allocation failure Jiapeng Chong
2021-10-19 11:44 ` James Bottomley
2021-10-20  2:56   ` Finn Thain
2021-10-20 12:13     ` James Bottomley
2021-10-20 22:50       ` Finn Thain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).