Skip to content

Commit 7dd6f4a

Browse files
guixinliu1995martinkpetersen
authored andcommitted
scsi: megaraid_sas: Remove unnecessary kfree()
When alloc ctrl mem fails, the reply_map will subsequently be freed in megasas_free_ctrl_mem(). No need to free it in megasas_alloc_ctrl_mem(). Link: https://lore.kernel.org/r/[email protected] Acked-by: Sumit Saxena <[email protected]> Signed-off-by: Guixin Liu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 8c499e4 commit 7dd6f4a

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

drivers/scsi/megaraid/megaraid_sas_base.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7150,22 +7150,18 @@ static int megasas_alloc_ctrl_mem(struct megasas_instance *instance)
71507150
switch (instance->adapter_type) {
71517151
case MFI_SERIES:
71527152
if (megasas_alloc_mfi_ctrl_mem(instance))
7153-
goto fail;
7153+
return -ENOMEM;
71547154
break;
71557155
case AERO_SERIES:
71567156
case VENTURA_SERIES:
71577157
case THUNDERBOLT_SERIES:
71587158
case INVADER_SERIES:
71597159
if (megasas_alloc_fusion_context(instance))
7160-
goto fail;
7160+
return -ENOMEM;
71617161
break;
71627162
}
71637163

71647164
return 0;
7165-
fail:
7166-
kfree(instance->reply_map);
7167-
instance->reply_map = NULL;
7168-
return -ENOMEM;
71697165
}
71707166

71717167
/*

0 commit comments

Comments
 (0)