linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zheyu Ma <zheyuma97@gmail.com>
To: Stanislav Yakovlev <stas.yakovlev@gmail.com>
Cc: kvalo@kernel.org, "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	pabeni@redhat.com, wireless <linux-wireless@vger.kernel.org>,
	netdev@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] wireless: ipw2x00: Refine the error handling of ipw2100_pci_init_one()
Date: Mon, 18 Apr 2022 11:04:41 +0800	[thread overview]
Message-ID: <CAMhUBjkWcg4+YYynsd90jX1A+zp95tUUcLgYrTPAqSmbxM7TJA@mail.gmail.com> (raw)
In-Reply-To: <CA++WF2Np7Bk_qT68Uc3mrC38mN5p3fm9eVT7VA8NoX6=es2r2w@mail.gmail.com>

On Thu, Apr 14, 2022 at 2:40 AM Stanislav Yakovlev
<stas.yakovlev@gmail.com> wrote:
>
> 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.

Thanks for your reminder, but the existing error handling does need to
be revised, I got the following warning when the probing fails at
pci_resource_flags():

[   20.712160] WARNING: CPU: 1 PID: 462 at lib/iomap.c:44 pci_iounmap+0x40/0x50
[   20.716583] RIP: 0010:pci_iounmap+0x40/0x50
[   20.726342]  <TASK>
[   20.726550]  ipw2100_pci_init_one+0x101/0x1ee0 [ipw2100]

Since I am not familiar with the ipw2100, could someone give me some
advice to fix this.

Thanks,
Zheyu Ma

  reply	other threads:[~2022-04-18  3:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-09  6:24 [PATCH] wireless: ipw2x00: Refine the error handling of ipw2100_pci_init_one() Zheyu Ma
2022-04-12 13:55 ` Kalle Valo
2022-04-13 18:39 ` Stanislav Yakovlev
2022-04-18  3:04   ` Zheyu Ma [this message]
2022-04-22 19:25     ` Stanislav Yakovlev
2022-05-20  3:46       ` Zheyu Ma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMhUBjkWcg4+YYynsd90jX1A+zp95tUUcLgYrTPAqSmbxM7TJA@mail.gmail.com \
    --to=zheyuma97@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stas.yakovlev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).