If mpt3sas_send_trigger_data_event exits early without inserting a fw_event, be sure to undo any prior allocations. This fixes the following smatch warning: drivers/scsi/mpt3sas/mpt3sas_scsih.c:2522 mpt3sas_send_trigger_data_event() warn: possible memory leak of 'fw_event' Signed-off-by: Joe Lawrence <joe.lawrence@xxxxxxxxxxx> Cc: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Cc: Sreekanth Reddy <Sreekanth.Reddy@xxxxxxx> --- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index e6f0720..25e3a22 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -2520,8 +2520,10 @@ mpt3sas_send_trigger_data_event(struct MPT3SAS_ADAPTER *ioc, if (!fw_event) return; fw_event->event_data = kzalloc(sizeof(*event_data), GFP_ATOMIC); - if (!fw_event->event_data) + if (!fw_event->event_data) { + kfree(fw_event); return; + } fw_event->event = MPT3SAS_PROCESS_TRIGGER_DIAG; fw_event->ioc = ioc; memcpy(fw_event->event_data, event_data, sizeof(*event_data)); -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html