[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1634640800-22502-1-git-send-email-jiapeng.chong@linux.alibaba.com>
Date: Tue, 19 Oct 2021 18:53:20 +0800
From: Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>
To: kashyap.desai@...adcom.com
Cc: sumit.saxena@...adcom.com, shivasharan.srikanteshwara@...adcom.com,
jejb@...ux.ibm.com, martin.petersen@...cle.com,
megaraidlinux.pdl@...adcom.com, linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org,
chongjiapeng <jiapeng.chong@...ux.alibaba.com>
Subject: [PATCH] scsi: megaraid_mbox: return -ENOMEM on megaraid_init_mbox() allocation failure
From: chongjiapeng <jiapeng.chong@...ux.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@...ux.alibaba.com>
Fixes: dd00cc486ab1 ("some kmalloc/memset ->kzalloc (tree wide)")
Signed-off-by: chongjiapeng <jiapeng.chong@...ux.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
Powered by blists - more mailing lists