lkml.org 
[lkml]   [2022]   [Aug]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] ARM: Add sanity check for dev->periphid in amba_probe()
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/

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

\
 
 \ /
  Last update: 2022-08-30 12:37    [W:0.108 / U:0.784 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site