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: <20240620-imaginary-sepia-gibbon-048a32-mkl@pengutronix.de>
Date: Thu, 20 Jun 2024 14:20:53 +0200
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: Vincent MAILHOL <mailhol.vincent@...adoo.fr>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>, 
	"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, 
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, 
	Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>, Thomas Kopp <thomas.kopp@...rochip.com>, 
	linux-can@...r.kernel.org, netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next 1/3] can: hi311x: simplify with
 spi_get_device_match_data()

On 07.06.2024 12:26:13, Vincent MAILHOL wrote:
> Hi Krzysztof,
> 
> On Thu. 6 Jun. 2024 à 23:24, Krzysztof Kozlowski
> <krzysztof.kozlowski@...aro.org> wrote:
> > Use spi_get_device_match_data() helper to simplify a bit the driver.
> 
> Thanks for this clean up.
> 
> > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
> > ---
> >  drivers/net/can/spi/hi311x.c | 7 +------
> >  1 file changed, 1 insertion(+), 6 deletions(-)
> >
> > diff --git a/drivers/net/can/spi/hi311x.c b/drivers/net/can/spi/hi311x.c
> > index e1b8533a602e..5d2c80f05611 100644
> > --- a/drivers/net/can/spi/hi311x.c
> > +++ b/drivers/net/can/spi/hi311x.c
> > @@ -830,7 +830,6 @@ static int hi3110_can_probe(struct spi_device *spi)
> >         struct device *dev = &spi->dev;
> >         struct net_device *net;
> >         struct hi3110_priv *priv;
> > -       const void *match;
> >         struct clk *clk;
> >         u32 freq;
> >         int ret;
> > @@ -874,11 +873,7 @@ static int hi3110_can_probe(struct spi_device *spi)
> >                 CAN_CTRLMODE_LISTENONLY |
> >                 CAN_CTRLMODE_BERR_REPORTING;
> >
> > -       match = device_get_match_data(dev);
> > -       if (match)
> > -               priv->model = (enum hi3110_model)(uintptr_t)match;
> > -       else
> > -               priv->model = spi_get_device_id(spi)->driver_data;
> > +       priv->model = (enum hi3110_model)spi_get_device_match_data(spi);
> 
> Here, you are dropping the (uintptr_t) cast. Casting a pointer to an
> enum type can trigger a zealous -Wvoid-pointer-to-enum-cast clang
> warning, and the (uintptr_t) cast is the defacto standard to silence
> such warnings, thus the double (enum hi3110_model)(uintptr_t) cast in
> the initial version.

I've re-added the intermediate cast to uintptr_t while applying.

Thanks,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde          |
Embedded Linux                   | https://www.pengutronix.de |
Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ