Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1277407

Re: [PATCH v3 2/5] arcmsr: fixes not release allocated resource

From Tomas Henzl <thenzl@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH v3 2/5] arcmsr: fixes not release allocated resource
Date 2015-11-25 15:00 +0100
Message-ID <qyIM2-71G-17@gated-at.bofh.it> (permalink)
References <qyGKd-5Jh-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 2/5] arcmsr: fixes not release allocated resource Ching Huang <ching2048@areca.com.tw> - 2015-11-25 12:50 +0100
  Re: [PATCH v3 2/5] arcmsr: fixes not release allocated resource Hannes Reinecke <hare@suse.de> - 2015-11-25 13:10 +0100
  Re: [PATCH v3 2/5] arcmsr: fixes not release allocated resource Johannes Thumshirn <jthumshirn@suse.de> - 2015-11-25 13:10 +0100
  Re: [PATCH v3 2/5] arcmsr: fixes not release allocated resource Tomas Henzl <thenzl@redhat.com> - 2015-11-25 15:00 +0100
    Re: [PATCH v3 2/5] arcmsr: fixes not release allocated resource Ching Huang <ching2048@areca.com.tw> - 2015-11-26 08:40 +0100
      Re: [PATCH v3 2/5] arcmsr: fixes not release allocated resource Tomas Henzl <thenzl@redhat.com> - 2015-11-26 14:10 +0100

csiph-web