diff mbox

rtl818x_pci: Disable pci device in error handling code

Message ID 1452949379-16052-1-git-send-email-baijiaju1990@163.com (mailing list archive)
State Superseded
Delegated to: Kalle Valo
Headers show

Commit Message

Jia-Ju Bai Jan. 16, 2016, 1:02 p.m. UTC
When pci_request_regions in rtl8180_probe fails, pci_disable_device is not
called to disable the device which is enabled by pci_enbale_device.

This patch fixes the problem by adding a new lable in error handling code.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
---
 drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Andrea Merello Jan. 30, 2016, 4:19 p.m. UTC | #1
Acked-by: Andrea Merello <andrea.merello@gmail.com>

On Sat, Jan 16, 2016 at 2:02 PM, Jia-Ju Bai <baijiaju1990@163.com> wrote:
> When pci_request_regions in rtl8180_probe fails, pci_disable_device is not
> called to disable the device which is enabled by pci_enbale_device.
>
> This patch fixes the problem by adding a new lable in error handling code.
>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
> ---
>  drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c b/drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c
> index a43a16f..c76af5d 100644
> --- a/drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c
> +++ b/drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c
> @@ -1736,7 +1736,7 @@ static int rtl8180_probe(struct pci_dev *pdev,
>         if (err) {
>                 printk(KERN_ERR "%s (rtl8180): Cannot obtain PCI resources\n",
>                        pci_name(pdev));
> -               return err;
> +               goto err_disable_dev;
>         }
>
>         io_addr = pci_resource_start(pdev, 0);
> @@ -1938,6 +1938,8 @@ static int rtl8180_probe(struct pci_dev *pdev,
>
>   err_free_reg:
>         pci_release_regions(pdev);
> +
> + err_disable_dev:
>         pci_disable_device(pdev);
>         return err;
>  }
> --
> 1.7.9.5
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c b/drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c
index a43a16f..c76af5d 100644
--- a/drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c
+++ b/drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c
@@ -1736,7 +1736,7 @@  static int rtl8180_probe(struct pci_dev *pdev,
 	if (err) {
 		printk(KERN_ERR "%s (rtl8180): Cannot obtain PCI resources\n",
 		       pci_name(pdev));
-		return err;
+		goto err_disable_dev;
 	}
 
 	io_addr = pci_resource_start(pdev, 0);
@@ -1938,6 +1938,8 @@  static int rtl8180_probe(struct pci_dev *pdev,
 
  err_free_reg:
 	pci_release_regions(pdev);
+
+ err_disable_dev:
 	pci_disable_device(pdev);
 	return err;
 }