lkml.org 
[lkml]   [2022]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] wireless: ipw2x00: Refine the error handling of ipw2100_pci_init_one()
On Sat, 9 Apr 2022 at 02:25, Zheyu Ma <zheyuma97@gmail.com> wrote:
>
> The driver should release resources in reverse order, i.e., the
> resources requested first should be released last, and the driver
> should adjust the order of error handling code by this rule.
>
> Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
> ---
> drivers/net/wireless/intel/ipw2x00/ipw2100.c | 34 +++++++++-----------
> 1 file changed, 16 insertions(+), 18 deletions(-)
>
[Skipped]

> @@ -6306,9 +6303,13 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev,
> out:
> return err;
>
> - fail_unlock:
> +fail_unlock:
> mutex_unlock(&priv->action_mutex);
> - fail:
> +fail:
> + pci_release_regions(pci_dev);
> +fail_disable:
> + pci_disable_device(pci_dev);
We can't move these functions before the following block.

> +fail_dev:
> if (dev) {
> if (registered >= 2)
> unregister_netdev(dev);
This block continues with a function call to ipw2100_hw_stop_adapter
which assumes that device is still accessible via pci bus.

> @@ -6334,11 +6335,8 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev,
>
> free_libipw(dev, 0);
> }
> -
> +fail_iounmap:
> pci_iounmap(pci_dev, ioaddr);
> -
> - pci_release_regions(pci_dev);
> - pci_disable_device(pci_dev);
> goto out;
> }
>
> --
> 2.25.1
>

Stanislav.

\
 
 \ /
  Last update: 2022-04-13 20:41    [W:0.084 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site