RE: RE: [PATCH can 4/4] can: rcar_canfd: rcar_canfd_probe(): reject devices without match data
From: Biju Das
Date: Mon Nov 16 2026 - 04:12:28 EST
Hi Marc,
> -----Original Message-----
> From: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
> Sent: 16 November 2026 08:55
> Subject: Re: RE: [PATCH can 4/4] can: rcar_canfd: rcar_canfd_probe(): reject devices without match
> data
>
> 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.1
> > 790612298.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?
I think so, currently only few drivers are using driver_override feature and
majority don't. There is a work in progress to disable this feature by
default. The driver needs driver_override will adjust the probe() to make it
functional, so it won't fail at all in probe().
But here we are making probe to fail, in case someone wants to
test the driver using bus_override.
Cheers,
Biju