All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomas Henzl <thenzl@redhat.com>
To: Ching Huang <ching2048@areca.com.tw>,
	hch@infradead.org, jbottomley@parallels.com,
	dan.carpenter@oracle.com, agordeev@redhat.com,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	hare@suse.de, jthumshirn@suse.de
Cc: hch@lst.de
Subject: Re: [PATCH v3 2/5] arcmsr: fixes not release allocated resource
Date: Wed, 25 Nov 2015 14:55:09 +0100	[thread overview]
Message-ID: <5655BDBD.404@redhat.com> (raw)
In-Reply-To: <1448451683.4670.35.camel@Centos6.3-64>

On 25.11.2015 12:41, Ching Huang wrote:
> From: Ching Huang <ching2048@areca.com.tw>
>
> Releasing allocated resource if get configuration data failed.
>
> Signed-of-by: Ching Huang <ching2048@areca.com.tw>
>
> ---
>
> diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
> --- a/drivers/scsi/arcmsr/arcmsr_hba.c	2015-11-24 11:35:26.000000000 +0800
> +++ b/drivers/scsi/arcmsr/arcmsr_hba.c	2015-11-25 19:04:44.590970000 +0800
> @@ -2664,7 +2664,7 @@ static bool arcmsr_hbaB_get_config(struc
>  	if (!arcmsr_hbaB_wait_msgint_ready(acb)) {
>  		printk(KERN_NOTICE "arcmsr%d: wait 'get adapter firmware \
>  			miscellaneous data' timeout \n", acb->host->host_no);
> -		return false;
> +		goto err_free_dma;
>  	}
>  	count = 8;
>  	while (count){
> @@ -2707,6 +2707,10 @@ static bool arcmsr_hbaB_get_config(struc
>  	acb->firm_cfg_version = readl(&reg->message_rwbuffer[25]);  /*firm_cfg_version,25,100-103*/
>  	/*firm_ide_channels,4,16-19*/
>  	return true;
> +err_free_dma:
> +	dma_free_coherent(&acb->pdev->dev, acb->roundup_ccbsize,
> +			acb->dma_coherent2, acb->dma_coherent_handle2);
> +	return false;
>  }
>  

The resource should be released here, that is okay. 

How works the resource management when the eh_bus_reset_handler
is called ? It looks to me that you allocate a new 
acb->dma_coherent2 without releasing it before.
Btw. is it needed in that handler to re-read the firmware-spec?

Tomas

>  static bool arcmsr_hbaC_get_config(struct AdapterControlBlock *pACB)
>
>
> --
> 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

  parent reply	other threads:[~2015-11-25 13:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-25 11:41 [PATCH v3 2/5] arcmsr: fixes not release allocated resource Ching Huang
2015-11-25 12:00 ` Johannes Thumshirn
2015-11-25 12:05 ` Hannes Reinecke
2015-11-25 13:55 ` Tomas Henzl [this message]
2015-11-26  7:32   ` Ching Huang
2015-11-26 13:08     ` Tomas Henzl

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=5655BDBD.404@redhat.com \
    --to=thenzl@redhat.com \
    --cc=agordeev@redhat.com \
    --cc=ching2048@areca.com.tw \
    --cc=dan.carpenter@oracle.com \
    --cc=hare@suse.de \
    --cc=hch@infradead.org \
    --cc=hch@lst.de \
    --cc=jbottomley@parallels.com \
    --cc=jthumshirn@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.