Re: [PATCH v5 1/6] PCI: spacemit-k1: Add device data support

From: Yao Zi

Date: Thu Sep 10 2026 - 08:31:48 EST


On Thu, Sep 10, 2026 at 09:42:55AM +0300, Andy Shevchenko wrote:
> On Thu, Sep 10, 2026 at 05:44:50AM +0000, Yao Zi wrote:
> > On Wed, Sep 09, 2026 at 04:00:33PM +0800, Inochi Amaoto wrote:
> > > On Tue, Sep 08, 2026 at 01:26:44PM +0300, Andy Shevchenko wrote:
> > > > On Mon, Sep 07, 2026 at 07:26:00PM +0800, Inochi Amaoto wrote:
>
> ...
>
> > > > > + data = device_get_match_data(dev);
> > > > > + if (!data)
> > > > > + return -ENODEV;
> > > >
> > > > It's better to use -ENODATA which will help to distinguish from other ENODEV
> > > > cases (which are more often to happen).
> > >
> > > OK, thanks
> >
> > Honestly, I don't think this should even happen, since every compatible
> > supported by the driver carries its own of_match_data, and failing to
> > do so is obviously a driver bug, so I think this branch could be
> > dropped.
>
> Does this driver do not support driver_override? How comes?

Oops, it's my fault not to come up with this case. Sorry for the noise.

> (Note, Sashiko is full of the issues of not checking for NULL the matching data
> and hence it describes a scenario in which this leads to NULL pointer
> dereference.)
>
> --
> With Best Regards,
> Andy Shevchenko
>
>

Thanks,
Yao Zi