Re: [PATCH can 4/4] can: rcar_canfd: rcar_canfd_probe(): reject devices without match data

From: Uwe Kleine-König

Date: Mon Nov 16 2026 - 06:35:17 EST


On Mon, Nov 16, 2026 at 09:54:58AM +0100, Marc Kleine-Budde wrote:
> On 16.11.2026 08:39:36, Biju Das wrote:
> > Hi Marc,
> >
> > > -----Original Message-----
> > > From: linux-arm-kernel <linux-arm-kernel-bounces@xxxxxxxxxxxxxxxxxxx> On Behalf Of Marc Kleine-Budde
> > > Sent: 14 November 2026 12:56
> > > Subject: [PATCH can 4/4] can: rcar_canfd: rcar_canfd_probe(): reject devices without match data
> > >
> > > A device bound through driver_override need not match an entry in of_match_table. In that case
> > > device_get_match_data() returns NULL, but
> > > rcar_canfd_probe() dereferences the result.
> > >
> > > Reject devices without match data before continuing probe.
> > >
> > > Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
> > > ---
> > > drivers/net/can/rcar/rcar_canfd.c | 2 ++
> > > 1 file changed, 2 insertions(+)
> > >
> > > diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
> > > index 000a6433f46d..9d463a9c1766 100644
> > > --- a/drivers/net/can/rcar/rcar_canfd.c
> > > +++ b/drivers/net/can/rcar/rcar_canfd.c
> > > @@ -2113,6 +2113,8 @@ static int rcar_canfd_probe(struct platform_device *pdev)
> > > int i;
> > >
> > > info = of_device_get_match_data(dev);
> > > + if (!info)
> > > + return -ENODEV;
> >
> >
> > There is a patch on the fly to disable driver_override by default [1].
> > In that case if we plan to use driver_override, probe will return failure.
> > I may be wrong. Please correct me if Iam wrong
> >
> > [1] https://lore.kernel.org/all/0f7446324f6a0c8f0153d6532d92a6eeecd6a308.1790612298.git.u.kleine-koenig@xxxxxxxxxxxx/
>
> Thanks, I wasn't aware of this series. I tested the driver_override on
> the flexcan driver with latest net/main, fixed it, and applied the fix
> to all affected CAN drivers.
>
> Should I drop the driver_override related null pointer checks from this
> series?

IMHO yes.

I just sent out a new revision of the change, find it at
https://lore.kernel.org/all/20261116110853.3418077-2-u.kleine-koenig@xxxxxxxxxxxx/
as I failed to add you Cc.

Best regards
Uwe

Attachment: signature.asc
Description: PGP signature