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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d348420d-59a0-f869-061d-5a1d736e12d5@omp.ru>
Date: Thu, 8 Feb 2024 23:44:09 +0300
From: Sergey Shtylyov <s.shtylyov@....ru>
To: Claudiu <claudiu.beznea@...on.dev>, <davem@...emloft.net>,
	<edumazet@...gle.com>, <kuba@...nel.org>, <pabeni@...hat.com>
CC: <netdev@...r.kernel.org>, <linux-renesas-soc@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, Claudiu Beznea
	<claudiu.beznea.uj@...renesas.com>
Subject: Re: [PATCH net-next 1/5] net: ravb: Get rid of the temporary variable
 irq

On 2/7/24 3:07 PM, Claudiu wrote:

> From: Claudiu Beznea <claudiu.beznea.uj@...renesas.com>
> 
> The 4th argument of ravb_setup_irq() is used to save the IRQ number that
> will be further used by the driver code. Not all ravb_setup_irqs() calls
> need to save the IRQ number. The previous code used to pass a dummy
> variable as the 4th argument in case the IRQ is not needed for further
> usage. That is not necessary as the code from ravb_setup_irq() can detect
> by itself if the IRQ needs to be saved. Thus, get rid of the code that is
> not needed.
> 
> Reported-by: Sergey Shtylyov <s.shtylyov@....ru>
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@...renesas.com>
[...]

> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index 9521cd054274..e235342e0827 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -2611,17 +2611,20 @@ static int ravb_setup_irq(struct ravb_private *priv, const char *irq_name,
>  		if (!dev_name)
>  			return -ENOMEM;
>  
> -		*irq = platform_get_irq_byname(pdev, irq_name);
> +		error = platform_get_irq_byname(pdev, irq_name);
>  		flags = 0;
>  	} else {
>  		dev_name = ndev->name;
> -		*irq = platform_get_irq(pdev, 0);
> +		error = platform_get_irq(pdev, 0);
>  		flags = IRQF_SHARED;
>  	}
> -	if (*irq < 0)
> -		return *irq;
> +	if (error < 0)
> +		return error;
>  
> -	error = devm_request_irq(dev, *irq, handler, flags, dev_name, ndev);
> +	if (irq)
> +		*irq = error;
> +
> +	error = devm_request_irq(dev, error, handler, flags, dev_name, ndev);
>  	if (error)
>  		netdev_err(ndev, "cannot request IRQ %s\n", dev_name);
>  

   Thanks for addressing my IRC comment! Tho the naming seems awful. :-)
   I'd suggest to add a local variable (named e.g. irq_num) and use it to
store the result of platform_get_irq[_byname]().

[...]

MBR, Sergey

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ