Skip to contentSkip to conversation

OMAP3+/4+ PRM: fix of_irq_get() result checks

PATCH Superseded Sergei Shtylyov 2 participants 5 messages Aug 6, 2017 – Aug 7, 2017

lore
Share & tools
lore
#0 lore raw

v2 cover OMAP3+/4+ PRM: fix of_irq_get() result checks

Hello!

Here's the set of 2 patches against the 'omap-for-v4.13/fixes' branch of Tony Lingren's 'linux-omap.git' repo. I'm fixing of_irq_get() DT API result checks.

[1/2] ARM: OMAP3+: PRM: fix of_irq_get() result check [2/2] ARM: OMAP4+: PRM: fix of_irq_get() result checks

MBR, Sergei

#1 lore raw

v2 cover OMAP3+/4+ PRM: fix of_irq_get() result checks

Quoted 8 lines · Sergei Shtylyov

Hello!

Here's the set of 2 patches against the 'omap-for-v4.13/fixes' branch of Tony Lingren's 'linux-omap.git' repo. I'm fixing of_irq_get() DT API result checks.

[1/2] ARM: OMAP3+: PRM: fix of_irq_get() result check [2/2] ARM: OMAP4+: PRM: fix of_irq_get() result checks

What IRQ domain did you consider? In case of STRICT the mapping will be 1:1 and 0 is _valid_ IRQ number for hwirq.
0 in Linux kernel IRQ numbering often means NO_IRQ. But there might be exceptions.

So, it would be nice to see if there is a problem on certain platform if the patch is not applied, or is it problem on OF IRQ code, or wrong interpratation of 0?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw

v2 cover OMAP3+/4+ PRM: fix of_irq_get() result checks

Quoted 11 lines · Andy Shevchenko
Quoted 8 lines · Sergei Shtylyov

Hello!

Here's the set of 2 patches against the 'omap-for-v4.13/fixes' branch of Tony Lingren's 'linux-omap.git' repo. I'm fixing of_irq_get() DT API result checks.

[1/2] ARM: OMAP3+: PRM: fix of_irq_get() result check [2/2] ARM: OMAP4+: PRM: fix of_irq_get() result checks

Quoted 8 lines

What IRQ domain did you consider? In case of STRICT the mapping will be 1:1 and 0 is _valid_ IRQ number for hwirq.
0 in Linux kernel IRQ numbering often means NO_IRQ. But there might be exceptions.

So, it would be nice to see if there is a problem on certain platform if the patch is not applied, or is it problem on OF IRQ code, or wrong interpratation of 0?

Okay, I have looked into OF code and it seems always allocating descriptors where numbering starts from 1 (see hint variable deep in the code).

This series is a good fix.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw

v2 cover OMAP3+/4+ PRM: fix of_irq_get() result checks

Quoted 14 lines · Andy Shevchenko
Quoted 14 lines
Quoted 8 lines

Hello!

Here's the set of 2 patches against the 'omap-for-v4.13/fixes' branch of Tony Lingren's 'linux-omap.git' repo. I'm fixing of_irq_get() DT API result checks.

[1/2] ARM: OMAP3+: PRM: fix of_irq_get() result check [2/2] ARM: OMAP4+: PRM: fix of_irq_get() result checks

What IRQ domain did you consider? In case of STRICT the mapping will be 1:1 and 0 is _valid_ IRQ number for hwirq.
0 in Linux kernel IRQ numbering often means NO_IRQ. But there might be exceptions.

Quoted 5 lines
Quoted 3 lines

So, it would be nice to see if there is a problem on certain platform if the patch is not applied, or is it problem on OF IRQ code, or wrong interpratation of 0?

Okay, I have looked into OF code and it seems always allocating

Heh, I was going to send you down the of_irq_get()'s call chains -- it
became obvious to me that 0 is a "bad IRQ" indication from looking at irq_create_fwspec_mapping()...

Quoted 2 lines

descriptors where numbering starts from 1 (see hint variable deep in the code).

In kernel/irq/irqdomain.c::irq_domain_alloc_descs(), you mean?
I haven't plunged so deep. :-) But it's hardly an OF code, IIRC...

Quoted 1 line

This series is a good fix.

Thank you (especially for spending your Sunday time)! :-)

MBR, Sergei

#4 lore raw

v2 cover OMAP3+/4+ PRM: fix of_irq_get() result checks

In reply to Andy Shevchenko
Quoted 9 lines · Andy Shevchenko
Quoted 6 lines

Here's the set of 2 patches against the 'omap-for-v4.13/fixes' branch of Tony Lingren's 'linux-omap.git' repo. I'm fixing of_irq_get() DT API result checks.

[1/2] ARM: OMAP3+: PRM: fix of_irq_get() result check [2/2] ARM: OMAP4+: PRM: fix of_irq_get() result checks

What IRQ domain did you consider? In case of STRICT the mapping will be 1:1 and 0 is _valid_ IRQ number for hwirq.

of_irq_get() returns virtual IRQ #'s, no? And for those 0 is considered
non-valid by Linus (I personally don't agree with that).

Quoted 1 line

0 in Linux kernel IRQ numbering often means NO_IRQ.

NO_IRQ was "considered harmful" AFAIK. :-)

Quoted 5 lines

But there might be exceptions.

So, it would be nice to see if there is a problem on certain platform if the patch is not applied, or is it problem on OF IRQ code, or wrong interpratation of 0?

of_irq_get() is certainly problematic with its returning both 0 and
negative error # on failure. I tried to fix that back in 2016 but that patch got shot down:

http://marc.info/?t=146447243300002&r=1

I've now audited all the call sites of of_irq_get() and that resulted in a
number of fixes.

MBR, Sergei