Patchwork [07/10] driver:megaraid: return -ENOMEM on allocation failure.

login
register
mail settings
Submitter Allen
Date Sept. 13, 2017, 7:32 a.m.
Message ID <1505287939-14106-7-git-send-email-allen.lkml@gmail.com>
Download mbox | patch
Permalink /patch/9950553/
State Not Applicable
Delegated to: Herbert Xu
Headers show

Comments

Allen - Sept. 13, 2017, 7:32 a.m.
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
 drivers/scsi/megaraid/megaraid_mbox.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
index ec3c438..b09a0a6 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -724,8 +724,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)
+		return -ENOMEM;
 
 	/*
 	 * Attach the adapter soft state to raid device soft state