* [PATCH] scsi: hisi_sas: fix IRQ checks
@ 2021-04-03 20:43 Sergey Shtylyov
[not found] ` <CAHp75VfZ+B-MNZ57BzMxgTvGXQ7Ek-DU2T4UVQ2tQpPoOmfcTg@mail.gmail.com>
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Sergey Shtylyov @ 2021-04-03 20:43 UTC (permalink / raw)
To: Avri Altman, James E.J. Bottomley, Martin K. Petersen,
linux-scsi, John Garry
Commit df2d8213d9e3 ("hisi_sas: use platform_get_irq()") failed to take
into account that irq_of_parse_and_map() and platform_get_irq() have a
different way of indicating an error: the former returns 0 and the latter
returns a negative error code. Fix up the IRQ checks!
Fixes: df2d8213d9e3 ("hisi_sas: use platform_get_irq()")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru>
---
drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Index: scsi/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
===================================================================
--- scsi.orig/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
+++ scsi/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
@@ -1646,7 +1646,7 @@ static int interrupt_init_v1_hw(struct h
idx = i * HISI_SAS_PHY_INT_NR;
for (j = 0; j < HISI_SAS_PHY_INT_NR; j++, idx++) {
irq = platform_get_irq(pdev, idx);
- if (!irq) {
+ if (irq < 0) {
dev_err(dev, "irq init: fail map phy interrupt %d\n",
idx);
return -ENOENTr;
@@ -1665,7 +1665,7 @@ static int interrupt_init_v1_hw(struct h
idx = hisi_hba->n_phy * HISI_SAS_PHY_INT_NR;
for (i = 0; i < hisi_hba->queue_count; i++, idx++) {
irq = platform_get_irq(pdev, idx);
- if (!irq) {
+ if (irq < 0) {
dev_err(dev, "irq init: could not map cq interrupt %d\n",
idx);
return -ENOENT;
@@ -1683,7 +1683,7 @@ static int interrupt_init_v1_hw(struct h
idx = (hisi_hba->n_phy * HISI_SAS_PHY_INT_NR) + hisi_hba->queue_count;
for (i = 0; i < HISI_SAS_FATAL_INT_NR; i++, idx++) {
irq = platform_get_irq(pdev, idx);
- if (!irq) {
+ if (irq < 0) {
dev_err(dev, "irq init: could not map fatal interrupt %d\n",
idx);
return -ENOENT;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] scsi: hisi_sas: fix IRQ checks
[not found] ` <CAHp75VfZ+B-MNZ57BzMxgTvGXQ7Ek-DU2T4UVQ2tQpPoOmfcTg@mail.gmail.com>
@ 2021-04-04 15:39 ` Sergey Shtylyov
0 siblings, 0 replies; 6+ messages in thread
From: Sergey Shtylyov @ 2021-04-04 15:39 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Avri Altman, James E.J. Bottomley, Martin K. Petersen,
linux-scsi, John Garry
On 4/4/21 2:48 PM, Andy Shevchenko wrote:
[...]
> Commit df2d8213d9e3 ("hisi_sas: use platform_get_irq()") failed to take
> into account that irq_of_parse_and_map() and platform_get_irq() have a
> different way of indicating an error: the former returns 0 and the latter
> returns a negative error code. Fix up the IRQ checks!
>
>
> Shouldn’t you unshadow error codes at the same time?
>
> return -ENOENT; ==> return IRQ;
I'm going to send that as a follow-up (cleanup) patch -- we also have devm_request_irq() with
the result overridden for no good reason...
> Fixes: df2d8213d9e3 ("hisi_sas: use platform_get_irq()")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru <mailto:s.shtylyov@omprussia.ru>>
[...]
MBR, Sergei
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] scsi: hisi_sas: fix IRQ checks
2021-04-03 20:43 [PATCH] scsi: hisi_sas: fix IRQ checks Sergey Shtylyov
[not found] ` <CAHp75VfZ+B-MNZ57BzMxgTvGXQ7Ek-DU2T4UVQ2tQpPoOmfcTg@mail.gmail.com>
@ 2021-04-05 14:27 ` Sergey Shtylyov
2021-04-06 7:43 ` John Garry
2021-04-16 2:51 ` Martin K. Petersen
2 siblings, 1 reply; 6+ messages in thread
From: Sergey Shtylyov @ 2021-04-05 14:27 UTC (permalink / raw)
To: Avri Altman, James E.J. Bottomley, Martin K. Petersen,
linux-scsi, John Garry
On 4/3/21 11:43 PM, Sergey Shtylyov wrote:
> Commit df2d8213d9e3 ("hisi_sas: use platform_get_irq()") failed to take
> into account that irq_of_parse_and_map() and platform_get_irq() have a
> different way of indicating an error: the former returns 0 and the latter
> returns a negative error code. Fix up the IRQ checks!
>
> Fixes: df2d8213d9e3 ("hisi_sas: use platform_get_irq()")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru>
>
> ---
Sorry, forgot to mention that this patch is against the 'fixes' branch of
Martin Petgersen's 'scsi.git' repo.
[...]
MBR, Sergey
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] scsi: hisi_sas: fix IRQ checks
2021-04-05 14:27 ` Sergey Shtylyov
@ 2021-04-06 7:43 ` John Garry
2021-04-10 18:58 ` Sergey Shtylyov
0 siblings, 1 reply; 6+ messages in thread
From: John Garry @ 2021-04-06 7:43 UTC (permalink / raw)
To: Sergey Shtylyov, Avri Altman, James E.J. Bottomley,
Martin K. Petersen, linux-scsi
On 05/04/2021 15:27, Sergey Shtylyov wrote:
> On 4/3/21 11:43 PM, Sergey Shtylyov wrote:
>
>> Commit df2d8213d9e3 ("hisi_sas: use platform_get_irq()") failed to take
>> into account that irq_of_parse_and_map() and platform_get_irq() have a
>> different way of indicating an error: the former returns 0 and the latter
>> returns a negative error code. Fix up the IRQ checks!
>>
>> Fixes: df2d8213d9e3 ("hisi_sas: use platform_get_irq()")
>> Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru>
>>
>> ---
>
> Sorry, forgot to mention that this patch is against the 'fixes' branch of
> Martin Petgersen's 'scsi.git' repo.
JFYI, The HW for this v1 hw driver is all but dead, and I was
considering deleting the driver.
But, for now, if you want to fix up to ensure no one copies this
pattern, then fine.
Thanks,
John
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] scsi: hisi_sas: fix IRQ checks
2021-04-06 7:43 ` John Garry
@ 2021-04-10 18:58 ` Sergey Shtylyov
0 siblings, 0 replies; 6+ messages in thread
From: Sergey Shtylyov @ 2021-04-10 18:58 UTC (permalink / raw)
To: John Garry, Avri Altman, James E.J. Bottomley,
Martin K. Petersen, linux-scsi
Hello!
On 4/6/21 10:43 AM, John Garry wrote:
[...]
>>> Commit df2d8213d9e3 ("hisi_sas: use platform_get_irq()") failed to take
>>> into account that irq_of_parse_and_map() and platform_get_irq() have a
>>> different way of indicating an error: the former returns 0 and the latter
>>> returns a negative error code. Fix up the IRQ checks!
>>>
>>> Fixes: df2d8213d9e3 ("hisi_sas: use platform_get_irq()")
>>> Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru>
>>>
>>> ---
>>
>> Sorry, forgot to mention that this patch is against the 'fixes' branch of
>> Martin Petgersen's 'scsi.git' repo.
>
> JFYI, The HW for this v1 hw driver is all but dead, and I was considering deleting the driver.
>
> But, for now, if you want to fix up to ensure no one copies this pattern, then fine.
Yeah, that too. And the -stable kernels also need to be considered...
> Thanks,
> John
MBR, Sergey
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] scsi: hisi_sas: fix IRQ checks
2021-04-03 20:43 [PATCH] scsi: hisi_sas: fix IRQ checks Sergey Shtylyov
[not found] ` <CAHp75VfZ+B-MNZ57BzMxgTvGXQ7Ek-DU2T4UVQ2tQpPoOmfcTg@mail.gmail.com>
2021-04-05 14:27 ` Sergey Shtylyov
@ 2021-04-16 2:51 ` Martin K. Petersen
2 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2021-04-16 2:51 UTC (permalink / raw)
To: John Garry, Sergey Shtylyov, linux-scsi, Avri Altman,
James E.J. Bottomley
Cc: Martin K . Petersen
On Sat, 3 Apr 2021 23:43:55 +0300, Sergey Shtylyov wrote:
> Commit df2d8213d9e3 ("hisi_sas: use platform_get_irq()") failed to take
> into account that irq_of_parse_and_map() and platform_get_irq() have a
> different way of indicating an error: the former returns 0 and the latter
> returns a negative error code. Fix up the IRQ checks!
Applied to 5.13/scsi-queue, thanks!
[1/1] scsi: hisi_sas: fix IRQ checks
https://git.kernel.org/mkp/scsi/c/6c11dc060427
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-04-16 2:52 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-03 20:43 [PATCH] scsi: hisi_sas: fix IRQ checks Sergey Shtylyov
[not found] ` <CAHp75VfZ+B-MNZ57BzMxgTvGXQ7Ek-DU2T4UVQ2tQpPoOmfcTg@mail.gmail.com>
2021-04-04 15:39 ` Sergey Shtylyov
2021-04-05 14:27 ` Sergey Shtylyov
2021-04-06 7:43 ` John Garry
2021-04-10 18:58 ` Sergey Shtylyov
2021-04-16 2:51 ` Martin K. Petersen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.