lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 21 Nov 2023 07:50:52 -0700
From:   Rob Herring <robh@...nel.org>
To:     Simon Horman <horms@...nel.org>
Cc:     Wolfgang Grandegger <wg@...ndegger.com>,
        Marc Kleine-Budde <mkl@...gutronix.de>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Appana Durga Kedareswara rao <appana.durga.rao@...inx.com>,
        Naga Sureshkumar Relli <naga.sureshkumar.relli@...inx.com>,
        Michal Simek <michal.simek@....com>, linux-can@...r.kernel.org,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org
Subject: Re: [RESEND PATCH] net: can: Use device_get_match_data()

On Thu, Nov 16, 2023 at 11:29 AM Simon Horman <horms@...nel.org> wrote:
>
> On Wed, Nov 15, 2023 at 03:01:28PM -0600, Rob Herring wrote:
> > Use preferred device_get_match_data() instead of of_match_device() to
> > get the driver match data. With this, adjust the includes to explicitly
> > include the correct headers.
> >
> > Signed-off-by: Rob Herring <robh@...nel.org>
>
> ...
>
> > diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
> > index abe58f103043..f17fd43d03c0 100644
> > --- a/drivers/net/can/xilinx_can.c
> > +++ b/drivers/net/can/xilinx_can.c
> > @@ -20,8 +20,8 @@
> >  #include <linux/module.h>
> >  #include <linux/netdevice.h>
> >  #include <linux/of.h>
> > -#include <linux/of_device.h>
> >  #include <linux/platform_device.h>
> > +#include <linux/property.h>
> >  #include <linux/skbuff.h>
> >  #include <linux/spinlock.h>
> >  #include <linux/string.h>
> > @@ -1726,7 +1726,6 @@ static int xcan_probe(struct platform_device *pdev)
> >       struct net_device *ndev;
> >       struct xcan_priv *priv;
> >       struct phy *transceiver;
> > -     const struct of_device_id *of_id;
> >       const struct xcan_devtype_data *devtype = &xcan_axi_data;
>
> Hi Rob,
>
> Here devtype is initialised.
>
> >       void __iomem *addr;
> >       int ret;
> > @@ -1741,9 +1740,7 @@ static int xcan_probe(struct platform_device *pdev)
> >               goto err;
> >       }
> >
> > -     of_id = of_match_device(xcan_of_match, &pdev->dev);
> > -     if (of_id && of_id->data)
> > -             devtype = of_id->data;
>
> And in the old code devtype was conditionally re-initialised here,
> if a match with data was found.
>
> But in the new code devtype is re-initialised unconditionally.
>
> Possibly I am missing something obvious, but it seems that either this
> should somehow be made conditional, or the initialisation to &xcan_axi_data
> should be dropped.

of_match_device() would never fail because we only match with DT for
this driver and if we didn't match, we wouldn't be in probe. So I'll
drop the initialization.

Rob

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ