mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Johannes Thumshirn <jthumshirn@suse.de>
To: Chaitra P B <chaitra.basappa@broadcom.com>
Cc: JBottomley@Parallels.com, jejb@kernel.org, hch@infradead.org,
	martin.petersen@oracle.com, linux-scsi@vger.kernel.org,
	Sathya.Prakash@avagotech.com, kashyap.desai@avagotech.com,
	krishnaraddi.mankani@avagotech.com, linux-kernel@vger.kernel.org,
	suganath-prabu.subramani@broadcom.com,
	sreekanth.reddy@broadcom.com
Subject: Re: [PATCH 1/2] mpt3sas: Deallocate resources before trying reallocation of the same in _base_allocate_memory_pools()
Date: Wed, 17 Feb 2016 12:36:39 +0100	[thread overview]
Message-ID: <20160217113639.GK18134@c203.arch.suse.de> (raw)
In-Reply-To: <1455708326-7584-2-git-send-email-chaitra.basappa@broadcom.com>

On Wed, Feb 17, 2016 at 04:55:25PM +0530, Chaitra P B wrote:
> Deallocates resources before reallocating of the same in retry_allocation
> path of _base_allocate_memory_pools()
> 
> Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com>
> Suganath prabu Subramani <suganath-prabu.subramani@avagotech.com>
> ---
>  drivers/scsi/mpt3sas/mpt3sas_base.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
> index f59495b..60c2e86 100644
> --- a/drivers/scsi/mpt3sas/mpt3sas_base.c
> +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
> @@ -3124,8 +3124,10 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>  		free_pages((ulong)ioc->scsi_lookup, ioc->scsi_lookup_pages);
>  		ioc->scsi_lookup = NULL;
>  	}
> -	kfree(ioc->hpr_lookup);
> -	kfree(ioc->internal_lookup);
> +	if (ioc->hpr_lookup)
> +		kfree(ioc->hpr_lookup);
> +	if (ioc->internal_lookup)
> +		kfree(ioc->internal_lookup);

kfree() can handle NULL pointers as arguments, so checking isn't needed. In
fact there are coccinelle scripts to check for it (make coccicheck) and it'll
spawn patches from people "fixing" it. So please get rid of the checks.

Otherwise

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>

>  	if (ioc->chain_lookup) {
>  		for (i = 0; i < ioc->chain_depth; i++) {
>  			if (ioc->chain_lookup[i].chain_buffer)
> @@ -3360,6 +3362,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc,  int sleep_flag)
>  			goto out;
>  		retry_sz += 64;
>  		ioc->hba_queue_depth = max_request_credit - retry_sz;
> +		_base_release_memory_pools(ioc);
>  		goto retry_allocation;
>  	}
>  
> -- 
> 1.8.3.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

  reply	other threads:[~2016-02-17 11:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-17 11:25 [PATCH 0/2] mpt3sas driver fix and updated MAINTAINERS list: Chaitra P B
2016-02-17 11:25 ` [PATCH 1/2] mpt3sas: Deallocate resources before trying reallocation of the same in _base_allocate_memory_pools() Chaitra P B
2016-02-17 11:36   ` Johannes Thumshirn [this message]
2016-02-17 16:40     ` Tomas Henzl
2016-02-17 23:53   ` Martin K. Petersen
2016-02-17 11:25 ` [PATCH 2/2] Modified Maintainers list for MPT FUSION DRIVERS Chaitra P B
2016-02-17 11:36   ` Johannes Thumshirn
2016-02-17 11:53   ` Joe Perches
2016-02-17 23:56     ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160217113639.GK18134@c203.arch.suse.de \
    --to=jthumshirn@suse.de \
    --cc=JBottomley@Parallels.com \
    --cc=Sathya.Prakash@avagotech.com \
    --cc=chaitra.basappa@broadcom.com \
    --cc=hch@infradead.org \
    --cc=jejb@kernel.org \
    --cc=kashyap.desai@avagotech.com \
    --cc=krishnaraddi.mankani@avagotech.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=sreekanth.reddy@broadcom.com \
    --cc=suganath-prabu.subramani@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®