RE: [PATCH] mptfusion: release resources in error return path

Desai, Kashyap
2010-07-27T10:06:21Z

Please consider this patch as an ACKed.
It has valid error handling in mpt_mapreousrces().

Thanks, Kashyap

> -----Original Message-----
> From: Tomas Henzl [mailto:thenzl@redhat.com]
> Sent: Monday, July 26, 2010 8:11 PM
> To: 'linux-scsi@vger.kernel.org'
> Cc: James Bottomley; Desai, Kashyap; Moore, Eric; Prakash, Sathya
> Subject: [PATCH] mptfusion: release resources in error return path
>
> We should release the resources in error return code path.
> The requested pci bars should be released under an error condition,
> when mpt_mapresources fails.
>
> Signed-off-by: Tomas Henzl <thenzl@redhat.com>
> ---
> diff --git a/drivers/message/fusion/mptbase.c
> b/drivers/message/fusion/mptbase.c
> index e319abc..ea12663 100644
> --- a/drivers/message/fusion/mptbase.c
> +++ b/drivers/message/fusion/mptbase.c
> @@ -1632,6 +1632,7 @@ mpt_mapresources(MPT_ADAPTER *ioc)
> } else {
> printk(MYIOC_s_WARN_FMT "no suitable DMA mask for
> %s\n",
> ioc->name, pci_name(pdev));
> + pci_release_selected_regions(pdev, ioc->bars);
> return r;
> }
> } else {
> @@ -1645,6 +1646,7 @@ mpt_mapresources(MPT_ADAPTER *ioc)
> } else {
> printk(MYIOC_s_WARN_FMT "no suitable DMA mask for
> %s\n",
> ioc->name, pci_name(pdev));
> + pci_release_selected_regions(pdev, ioc->bars);
> return r;
> }
> }
> @@ -1675,6 +1677,7 @@ mpt_mapresources(MPT_ADAPTER *ioc)
> if (mem == NULL) {
> printk(MYIOC_s_ERR_FMT ": ERROR - Unable to map adapter"
> " memory!\n", ioc->name);
> + pci_release_selected_regions(pdev, ioc->bars);
> return -EINVAL;
> }
> ioc->memmap = mem;
>