From: Mariusz Kozlowski <[EMAIL PROTECTED]>

This patch does kmalloc + memset conversion to kzalloc and adds missing check
for kzalloc return value.

 drivers/scsi/megaraid.c | 116109 -> 116094 (-15 bytes)
 drivers/scsi/megaraid.o | 257872 -> 257772 (-100 bytes)

Signed-off-by: Mariusz Kozlowski <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
---

 drivers/scsi/megaraid.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff -puN 
drivers/scsi/megaraid.c~drivers-scsi-megaraidc-kmalloc-memset-conversion-to-kzalloc
 drivers/scsi/megaraid.c
--- 
a/drivers/scsi/megaraid.c~drivers-scsi-megaraidc-kmalloc-memset-conversion-to-kzalloc
+++ a/drivers/scsi/megaraid.c
@@ -4408,8 +4408,10 @@ mega_internal_command(adapter_t *adapter
        scmd = &adapter->int_scmd;
        memset(scmd, 0, sizeof(Scsi_Cmnd));
 
-       sdev = kmalloc(sizeof(struct scsi_device), GFP_KERNEL);
-       memset(sdev, 0, sizeof(struct scsi_device));
+       sdev = kzalloc(sizeof(struct scsi_device), GFP_KERNEL);
+       if (!sdev)
+               return -ENOMEM;
+
        scmd->device = sdev;
 
        scmd->device->host = adapter->host;
_
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to