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: <13956279-3ab1-4eb8-b361-a0c79135cb56@tuxon.dev>
Date: Fri, 9 Feb 2024 07:48:38 +0200
From: claudiu beznea <claudiu.beznea@...on.dev>
To: Sergey Shtylyov <s.shtylyov@....ru>, 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 08.02.2024 22:43, Sergey Shtylyov wrote:
> 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

I tried to avoid that...

> store the result of platform_get_irq[_byname]().
> 
> [...]
> 
> MBR, Sergey

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ