public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: megaraid_sas: remove unnecessary kfree
@ 2022-08-02  7:19 Guixin Liu
  2022-08-08  2:37 ` Guixin Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Guixin Liu @ 2022-08-02  7:19 UTC (permalink / raw)
  To: kashyap.desai, sumit.saxena, shivasharan.srikanteshwara, jejb,
	martin.petersen
  Cc: megaraidlinux.pdl, linux-scsi

When alloc ctrl mem fail, the reply_map will be free in
megasas_free_ctrl_mem(), no need to free in megasas_alloc_ctrl_mem().

Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index a3e117a..f6c37a9 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -7153,22 +7153,18 @@ static int megasas_alloc_ctrl_mem(struct megasas_instance *instance)
 	switch (instance->adapter_type) {
 	case MFI_SERIES:
 		if (megasas_alloc_mfi_ctrl_mem(instance))
-			goto fail;
+			return -ENOMEM;
 		break;
 	case AERO_SERIES:
 	case VENTURA_SERIES:
 	case THUNDERBOLT_SERIES:
 	case INVADER_SERIES:
 		if (megasas_alloc_fusion_context(instance))
-			goto fail;
+			return -ENOMEM;
 		break;
 	}
 
 	return 0;
- fail:
-	kfree(instance->reply_map);
-	instance->reply_map = NULL;
-	return -ENOMEM;
 }
 
 /*
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: megaraid_sas: remove unnecessary kfree
  2022-08-02  7:19 [PATCH] scsi: megaraid_sas: remove unnecessary kfree Guixin Liu
@ 2022-08-08  2:37 ` Guixin Liu
  2022-08-08 10:40 ` Sumit Saxena
  2022-08-12  2:13 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Guixin Liu @ 2022-08-08  2:37 UTC (permalink / raw)
  To: kashyap.desai, sumit.saxena, shivasharan.srikanteshwara, jejb,
	martin.petersen
  Cc: megaraidlinux.pdl, linux-scsi

Hi,

Gentle ping.

在 2022/8/2 15:19, Guixin Liu 写道:
> When alloc ctrl mem fail, the reply_map will be free in
> megasas_free_ctrl_mem(), no need to free in megasas_alloc_ctrl_mem().
>
> Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
> ---
>   drivers/scsi/megaraid/megaraid_sas_base.c | 8 ++------
>   1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
> index a3e117a..f6c37a9 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -7153,22 +7153,18 @@ static int megasas_alloc_ctrl_mem(struct megasas_instance *instance)
>   	switch (instance->adapter_type) {
>   	case MFI_SERIES:
>   		if (megasas_alloc_mfi_ctrl_mem(instance))
> -			goto fail;
> +			return -ENOMEM;
>   		break;
>   	case AERO_SERIES:
>   	case VENTURA_SERIES:
>   	case THUNDERBOLT_SERIES:
>   	case INVADER_SERIES:
>   		if (megasas_alloc_fusion_context(instance))
> -			goto fail;
> +			return -ENOMEM;
>   		break;
>   	}
>   
>   	return 0;
> - fail:
> -	kfree(instance->reply_map);
> -	instance->reply_map = NULL;
> -	return -ENOMEM;
>   }
>   
>   /*

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: megaraid_sas: remove unnecessary kfree
  2022-08-02  7:19 [PATCH] scsi: megaraid_sas: remove unnecessary kfree Guixin Liu
  2022-08-08  2:37 ` Guixin Liu
@ 2022-08-08 10:40 ` Sumit Saxena
  2022-08-12  2:13 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Sumit Saxena @ 2022-08-08 10:40 UTC (permalink / raw)
  To: Guixin Liu
  Cc: Kashyap Desai, Shivasharan Srikanteshwara, James E.J. Bottomley,
	Martin K. Petersen, PDL,MEGARAIDLINUX, Linux SCSI List

[-- Attachment #1: Type: text/plain, Size: 327 bytes --]

On Tue, Aug 2, 2022 at 12:49 PM Guixin Liu <kanie@linux.alibaba.com> wrote:
>
> When alloc ctrl mem fail, the reply_map will be free in
> megasas_free_ctrl_mem(), no need to free in megasas_alloc_ctrl_mem().
>
> Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
Looks good.
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: megaraid_sas: remove unnecessary kfree
  2022-08-02  7:19 [PATCH] scsi: megaraid_sas: remove unnecessary kfree Guixin Liu
  2022-08-08  2:37 ` Guixin Liu
  2022-08-08 10:40 ` Sumit Saxena
@ 2022-08-12  2:13 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2022-08-12  2:13 UTC (permalink / raw)
  To: Guixin Liu
  Cc: kashyap.desai, sumit.saxena, shivasharan.srikanteshwara, jejb,
	martin.petersen, megaraidlinux.pdl, linux-scsi


Guixin,

> When alloc ctrl mem fail, the reply_map will be free in
> megasas_free_ctrl_mem(), no need to free in megasas_alloc_ctrl_mem().

Applied to 5.20/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-08-12  2:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-02  7:19 [PATCH] scsi: megaraid_sas: remove unnecessary kfree Guixin Liu
2022-08-08  2:37 ` Guixin Liu
2022-08-08 10:40 ` Sumit Saxena
2022-08-12  2:13 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox