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

From: Johannes Thumshirn
Date: Wed Nov 25 2015 - 07:00:14 EST


On Wed, 2015-11-25 at 19:41 +0800, Ching Huang wrote:
> From: Ching Huang <ching2048@xxxxxxxxxxxx>
>
> Releasing allocated resource if get configuration data failed.
>
> Signed-of-by: Ching Huang <ching2048@xxxxxxxxxxxx>
>
> ---
>
> 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;
> Â}
> Â
> Âstatic bool arcmsr_hbaC_get_config(struct AdapterControlBlock *pACB)
>
>

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