Skip to contentSkip to conversation

mpt2sas: add missing allocation.

PATCH In review Dan Carpenter 2 participants 2 messages Nov 4, 2011 – Nov 8, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mpt2sas: add missing allocation.

There was supposed to be a kzalloc() here and the compiler complained
about it.
mpt2sas_scsih.c: In function ‘mpt2sas_scsih_reset_handler’:
mpt2sas_scsih.c:2807:21: warning: ‘fw_event’ may be used uninitialized in this function [-Wuninitialized]

drivers/scsi/mpt2sas/mpt2sas_scsih.c +5 -0
index 8889b1b..4e041f6 100644
@@ -2802,6 +2802,11 @@ _scsih_error_recovery_delete_devices(struct MPT2SAS_ADAPTER *ioc)
 
 	if (ioc->is_driver_loading)
 		return;
+
+	fw_event = kzalloc(sizeof(struct fw_event_work), GFP_ATOMIC);
+	if (!fw_event)
+		return;
+
 	fw_event->event = MPT2SAS_REMOVE_UNRESPONDING_DEVICES;
 	fw_event->ioc = ioc;
 	_scsih_fw_event_add(ioc, fw_event);
#1 lore raw

The patch seem to be fine. Please consider this patch as an Acked by me

Regards,
Nagalakshmi

-----Original Message-----
From: Dan Carpenter [mailto:[email protected]]
Sent: Friday, November 04, 2011 11:55 PM
To: James E.J. Bottomley
Cc: Desai, Kashyap; James Bottomley; Nandigama, Nagalakshmi; Moore, Eric; [email protected]; [email protected]
Subject: [patch] [SCSI] mpt2sas: add missing allocation.

There was supposed to be a kzalloc() here and the compiler complained
about it.
mpt2sas_scsih.c: In function ‘mpt2sas_scsih_reset_handler’:
mpt2sas_scsih.c:2807:21: warning: ‘fw_event’ may be used uninitialized in this function [-Wuninitialized]

drivers/scsi/mpt2sas/mpt2sas_scsih.c +5 -0
index 8889b1b..4e041f6 100644
@@ -2802,6 +2802,11 @@ _scsih_error_recovery_delete_devices(struct MPT2SAS_ADAPTER *ioc)
 
 	if (ioc->is_driver_loading)
 		return;
+
+	fw_event = kzalloc(sizeof(struct fw_event_work), GFP_ATOMIC);
+	if (!fw_event)
+		return;
+
 	fw_event->event = MPT2SAS_REMOVE_UNRESPONDING_DEVICES;
 	fw_event->ioc = ioc;
 	_scsih_fw_event_add(ioc, fw_event);