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]
Message-Id: <D58E47DF-ADED-4FD0-9710-62FBA284093E@linux.dev>
Date: Wed, 15 Jan 2025 17:11:05 +0100
From: Thorsten Blum <thorsten.blum@...ux.dev>
To: John Paul Adrian Glaubitz <glaubitz@...sik.fu-berlin.de>
Cc: "David S. Miller" <davem@...emloft.net>,
 Andreas Larsson <andreas@...sler.com>,
 Randy Dunlap <rdunlap@...radead.org>,
 Bjorn Helgaas <bhelgaas@...gle.com>,
 Sam Ravnborg <sam@...nborg.org>,
 Dawei Li <dawei.li@...ngroup.cn>,
 sparclinux@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] sparc/irq: Remove unneeded if check in
 sun4v_cookie_only_virqs()

Hi Adrian,

On 14. Jan 2025, at 21:29, John Paul Adrian Glaubitz wrote:
> On Tue, 2025-01-14 at 21:25 +0100, Thorsten Blum wrote:
>> Remove the unnecessary if check and return the result directly.
>> 
>> Signed-off-by: Thorsten Blum <thorsten.blum@...ux.dev>
>> ---
>> arch/sparc/kernel/irq_64.c | 4 +---
>> 1 file changed, 1 insertion(+), 3 deletions(-)
>> 
>> diff --git a/arch/sparc/kernel/irq_64.c b/arch/sparc/kernel/irq_64.c
>> index aff0d24f8c6f..81fb49b089a8 100644
>> --- a/arch/sparc/kernel/irq_64.c
>> +++ b/arch/sparc/kernel/irq_64.c
>> @@ -146,9 +146,7 @@ static int hv_irq_version;
>>  */
>> static bool sun4v_cookie_only_virqs(void)
>> {
>> - if (hv_irq_version >= 3)
>> - return true;
>> - return false;
>> + return hv_irq_version >= 3;
>> }
>> 
>> static void __init irq_init_hv(void)
> 
> I'm not sure whether this change is really necessary nor will it improve
> the readability of the code. I think the compiler will optimize the code
> the same way, for both variants.

It's not strictly necessary, but it's shorter, less verbose, and imo
improves the code's readability. Personally, I'd even consider the
current version a code smell, but feel free to ignore the patch.

Thanks,
Thorsten

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ