mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -next] irqchip/exiu: Fix return value check in exiu_init()
@ 2017-11-14  6:57 Wei Yongjun
  2017-11-14  9:55 ` Ard Biesheuvel
  2017-11-14 10:30 ` [tip:irq/urgent] " tip-bot for Wei Yongjun
  0 siblings, 2 replies; 4+ messages in thread
From: Wei Yongjun @ 2017-11-14  6:57 UTC (permalink / raw)
  To: Thomas Gleixner, Jason Cooper, Marc Zyngier, Ard Biesheuvel
  Cc: Wei Yongjun, linux-kernel

In case of error, the function of_iomap() returns NULL pointer not
ERR_PTR(). The IS_ERR() test in the return value check should be
replaced with NULL test.

Fixes: 706cffc1b912 ("irqchip/exiu: Add support for Socionext Synquacer EXIU controller")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/irqchip/irq-sni-exiu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-sni-exiu.c b/drivers/irqchip/irq-sni-exiu.c
index 1b6e2f7..1927b2f 100644
--- a/drivers/irqchip/irq-sni-exiu.c
+++ b/drivers/irqchip/irq-sni-exiu.c
@@ -196,8 +196,8 @@ static int __init exiu_init(struct device_node *node,
 	}
 
 	data->base = of_iomap(node, 0);
-	if (IS_ERR(data->base)) {
-		err = PTR_ERR(data->base);
+	if (!data->base) {
+		err = -ENODEV;
 		goto out_free;
 	}

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] irqchip/exiu: Fix return value check in exiu_init()
  2017-11-14  6:57 [PATCH -next] irqchip/exiu: Fix return value check in exiu_init() Wei Yongjun
@ 2017-11-14  9:55 ` Ard Biesheuvel
  2017-11-14 10:19   ` Marc Zyngier
  2017-11-14 10:30 ` [tip:irq/urgent] " tip-bot for Wei Yongjun
  1 sibling, 1 reply; 4+ messages in thread
From: Ard Biesheuvel @ 2017-11-14  9:55 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: Thomas Gleixner, Jason Cooper, Marc Zyngier, linux-kernel

On 14 November 2017 at 06:57, Wei Yongjun <weiyongjun1@huawei.com> wrote:
> In case of error, the function of_iomap() returns NULL pointer not
> ERR_PTR(). The IS_ERR() test in the return value check should be
> replaced with NULL test.
>
> Fixes: 706cffc1b912 ("irqchip/exiu: Add support for Socionext Synquacer EXIU controller")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/irqchip/irq-sni-exiu.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/irqchip/irq-sni-exiu.c b/drivers/irqchip/irq-sni-exiu.c
> index 1b6e2f7..1927b2f 100644
> --- a/drivers/irqchip/irq-sni-exiu.c
> +++ b/drivers/irqchip/irq-sni-exiu.c
> @@ -196,8 +196,8 @@ static int __init exiu_init(struct device_node *node,
>         }
>
>         data->base = of_iomap(node, 0);
> -       if (IS_ERR(data->base)) {
> -               err = PTR_ERR(data->base);
> +       if (!data->base) {
> +               err = -ENODEV;
>                 goto out_free;
>         }
>

I was going to blame Marc's Tegra code for this, because that is where
I copied most of the code from, but the bug doesn't exist there, and
so it appears to be an original work. Oops.

Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] irqchip/exiu: Fix return value check in exiu_init()
  2017-11-14  9:55 ` Ard Biesheuvel
@ 2017-11-14 10:19   ` Marc Zyngier
  0 siblings, 0 replies; 4+ messages in thread
From: Marc Zyngier @ 2017-11-14 10:19 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: Wei Yongjun, Thomas Gleixner, Jason Cooper, linux-kernel

On Tue, Nov 14 2017 at  9:55:46 am GMT, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> On 14 November 2017 at 06:57, Wei Yongjun <weiyongjun1@huawei.com> wrote:
>> In case of error, the function of_iomap() returns NULL pointer not
>> ERR_PTR(). The IS_ERR() test in the return value check should be
>> replaced with NULL test.
>>
>> Fixes: 706cffc1b912 ("irqchip/exiu: Add support for Socionext Synquacer EXIU controller")
>> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
>> ---
>>  drivers/irqchip/irq-sni-exiu.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/irqchip/irq-sni-exiu.c b/drivers/irqchip/irq-sni-exiu.c
>> index 1b6e2f7..1927b2f 100644
>> --- a/drivers/irqchip/irq-sni-exiu.c
>> +++ b/drivers/irqchip/irq-sni-exiu.c
>> @@ -196,8 +196,8 @@ static int __init exiu_init(struct device_node *node,
>>         }
>>
>>         data->base = of_iomap(node, 0);
>> -       if (IS_ERR(data->base)) {
>> -               err = PTR_ERR(data->base);
>> +       if (!data->base) {
>> +               err = -ENODEV;
>>                 goto out_free;
>>         }
>>
>
> I was going to blame Marc's Tegra code for this, because that is where
> I copied most of the code from, but the bug doesn't exist there, and
> so it appears to be an original work. Oops.

Ah, nice try! ;-)

> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Applied to irqchip-4.15, thanks both.

	M.
-- 
Jazz is not dead, it just smell funny.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip:irq/urgent] irqchip/exiu: Fix return value check in exiu_init()
  2017-11-14  6:57 [PATCH -next] irqchip/exiu: Fix return value check in exiu_init() Wei Yongjun
  2017-11-14  9:55 ` Ard Biesheuvel
@ 2017-11-14 10:30 ` tip-bot for Wei Yongjun
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Wei Yongjun @ 2017-11-14 10:30 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, weiyongjun1, tglx, hpa, marc.zyngier, linux-kernel, jason,
	ard.biesheuvel

Commit-ID:  0e54705b0e01dcaf3eb2a496bb66d5f05012056b
Gitweb:     https://git.kernel.org/tip/0e54705b0e01dcaf3eb2a496bb66d5f05012056b
Author:     Wei Yongjun <weiyongjun1@huawei.com>
AuthorDate: Tue, 14 Nov 2017 06:57:28 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 14 Nov 2017 11:27:22 +0100

irqchip/exiu: Fix return value check in exiu_init()

In case of error, the function of_iomap() returns NULL pointer not
ERR_PTR().

Replace the IS_ERR() test of the return value with NULL test and return
a proper error code.

Fixes: 706cffc1b912 ("irqchip/exiu: Add support for Socionext Synquacer EXIU controller")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Link: https://lkml.kernel.org/r/1510642648-123574-1-git-send-email-weiyongjun1@huawei.com

---
 drivers/irqchip/irq-sni-exiu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-sni-exiu.c b/drivers/irqchip/irq-sni-exiu.c
index 1b6e2f7..1927b2f 100644
--- a/drivers/irqchip/irq-sni-exiu.c
+++ b/drivers/irqchip/irq-sni-exiu.c
@@ -196,8 +196,8 @@ static int __init exiu_init(struct device_node *node,
 	}
 
 	data->base = of_iomap(node, 0);
-	if (IS_ERR(data->base)) {
-		err = PTR_ERR(data->base);
+	if (!data->base) {
+		err = -ENODEV;
 		goto out_free;
 	}
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-11-14 10:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-14  6:57 [PATCH -next] irqchip/exiu: Fix return value check in exiu_init() Wei Yongjun
2017-11-14  9:55 ` Ard Biesheuvel
2017-11-14 10:19   ` Marc Zyngier
2017-11-14 10:30 ` [tip:irq/urgent] " tip-bot for Wei Yongjun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome