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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231116182923.GH109951@vergenet.net>
Date: Thu, 16 Nov 2023 18:29:23 +0000
From: Simon Horman <horms@...nel.org>
To: Rob Herring <robh@...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 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.

> +	devtype = device_get_match_data(&pdev->dev);
>  
>  	hw_tx_max_property = devtype->flags & XCAN_FLAG_TX_MAILBOXES ?
>  			     "tx-mailbox-count" : "tx-fifo-depth";
> -- 
> 2.42.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ