[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAGETcx-o7=+OR87ag3M5ONGfwG_2w9N=YZb7q7Y8CT9S8uitFg@mail.gmail.com>
Date: Tue, 30 Aug 2022 16:48:28 -0700
From: Saravana Kannan <saravanak@...gle.com>
To: "Russell King (Oracle)" <linux@...linux.org.uk>
Cc: "Leizhen (ThunderTown)" <thunder.leizhen@...wei.com>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
patches@...linux.org.uk, Kefeng Wang <wangkefeng.wang@...wei.com>,
Linus Walleij <linus.walleij@...aro.org>
Subject: Re: [PATCH v2] ARM: Add sanity check for dev->periphid in amba_probe()
On Tue, Aug 30, 2022 at 10:34 AM Saravana Kannan <saravanak@...gle.com> wrote:
>
> On Tue, Aug 30, 2022 at 3:36 AM Russell King (Oracle)
> <linux@...linux.org.uk> wrote:
> >
> > On Tue, Aug 30, 2022 at 06:31:14PM +0800, Leizhen (ThunderTown) wrote:
> > > On 2022/8/30 18:07, Russell King (Oracle) wrote:
> > > > For an amba driver, drv->bus will always be pointing at amba_bustype.
> > > > That always has a "match" operation. Therefore, the default of '1'
> > > > above will *never* be used for an AMBA driver.
> > > >
> > > > If drv->bus does not point at amba_bustype, then amba_probe() will
> > > > not be called for "drv".
> > > >
> > > > Therefore, amba_match() must always be called before amba_probe().
> > >
> > > Oh, I was careless. I think it's drv->match. But the processing flow
> > > will continue to go to "dev->bus->probe".
> > >
> > > __driver_attach():
> > > ret = driver_match_device(drv, dev);
> > > if (ret == 0) {
> > > /* no match */
> > > return 0;
> > > } else if (ret == -EPROBE_DEFER) { <------no return in this branch
> > > dev_dbg(dev, "Device match requests probe deferral\n");
> > > dev->can_match = true;
> > > driver_deferred_probe_add(dev);
> > > } else if (ret < 0) {
> > > dev_dbg(dev, "Bus failed to match device: %d\n", ret);
> > > return ret;
> > > } /* ret > 0 means positive match */
> > >
> > > ... ...
> > > driver_probe_device(drv, dev);
> > > ......
> > > dev->bus->probe
> >
> > And that makes no sense, is an already known issue, and there is a patch
> > to fix it:
> >
> > https://lore.kernel.org/all/20220817184026.3468620-1-isaacmanjarres@google.com/
>
> Russell,
>
> Thanks for discussing this further and pointing out the other fix. I
> assumed Leizhen was talking about an instance of
> device_driver_attach() which allows probe to be called without match.
> Thankfully that function is used only by some specific
> frameworks/buses types. I did a cursory check and I don't see any
> intersection with we amba.
>
> -Saravana
> P.S: I hate that function exists, as it just throws a wrench in the
> whole driver core design and adds corner cases to a lot of generic
> driver core design.
Oops, meant to say device_bind_driver().
So through out my email:
s/device_driver_attach/device_bind_driver/
-Saravana
Powered by blists - more mailing lists