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: <0d2056d8-ed12-88d3-b9c1-d6c1e772dcf3@csgroup.eu>
Date:   Thu, 6 Oct 2022 14:01:57 +0000
From:   Christophe Leroy <christophe.leroy@...roup.eu>
To:     Alan Stern <stern@...land.harvard.edu>
CC:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>
Subject: Re: [PATCH] usb: Replace NO_IRQ by 0



Le 06/10/2022 à 15:50, Alan Stern a écrit :
> On Thu, Oct 06, 2022 at 07:15:44AM +0200, Christophe Leroy wrote:
>> NO_IRQ is used to check the return of irq_of_parse_and_map().
>>
>> On some architecture NO_IRQ is 0, on other architectures it is -1.
>>
>> irq_of_parse_and_map() returns 0 on error, independent of NO_IRQ.
> 
> This isn't clear.  Does absence of an irq count as an error?  In other
> words, will irq_of_parse_and_map() sometimes return 0 and other times
> return NO_IRQ?  What about architectures on which 0 is a valid irq
> number?

NO_IRQ doesn't exist anywhere in core functions. Only some drivers and 
some architectures have relics of it.

irq_of_parse_and_map() will always return 0 on error.

0 can't be a valid logical IRQ number. It may only be a valid hwirq 
number but it will always be translated to a non-zero logical irq number.

I'm trying to get rid of NO_IRQ completely in powerpc code, therefore 
trying to clean-up all drivers used by powerpc architecture.

Long time ago Linus advocated for not using NO_IRQ, see 
https://lkml.org/lkml/2005/11/21/221

Thanks
Christophe

> 
>> So use 0 instead of using NO_IRQ.
>>
>> Signed-off-by: Christophe Leroy <christophe.leroy@...roup.eu>
>> ---
>>   drivers/usb/host/ehci-grlib.c  | 2 +-
>>   drivers/usb/host/ehci-ppc-of.c | 2 +-
>>   drivers/usb/host/fhci-hcd.c    | 2 +-
>>   drivers/usb/host/ohci-ppc-of.c | 2 +-
>>   drivers/usb/host/uhci-grlib.c  | 2 +-
>>   5 files changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/usb/host/ehci-grlib.c b/drivers/usb/host/ehci-grlib.c
>> index a2c3b4ec8a8b..0717f2ccf49d 100644
>> --- a/drivers/usb/host/ehci-grlib.c
>> +++ b/drivers/usb/host/ehci-grlib.c
>> @@ -99,7 +99,7 @@ static int ehci_hcd_grlib_probe(struct platform_device *op)
>>   	hcd->rsrc_len = resource_size(&res);
>>   
>>   	irq = irq_of_parse_and_map(dn, 0);
>> -	if (irq == NO_IRQ) {
>> +	if (!irq) {
>>   		dev_err(&op->dev, "%s: irq_of_parse_and_map failed\n",
>>   			__FILE__);
>>   		rv = -EBUSY;
> 
> Since NO_IRQ is sometimes set to -1, shouldn't this test (and all the
> other ones you changed) really be doing:
> 
> 	if (!irq || irq == NO_IRQ) { ...
> 
> ?
> 
> Alan Stern

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ