All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v3] gpio: sifive: Add missing check for platform_get_irq
@ 2023-06-06  2:20 ` Jiasheng Jiang
  0 siblings, 0 replies; 14+ messages in thread
From: Jiasheng Jiang @ 2023-06-06  2:20 UTC (permalink / raw)
  To: andy.shevchenko
  Cc: oe-kbuild-all, linus.walleij, brgl, palmer, paul.walmsley,
	linux-gpio, linux-riscv, linux-kernel, Jiasheng Jiang

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 996 bytes --]

On Mon, 5 Jun 2023 17:15:53 +0800 Andy Shevchenko wrote:
> On Mon, Jun 5, 2023 at 12:13 ¯PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
>>
>> On Mon, Jun 5, 2023 at 4:49 ¯AM Jiasheng Jiang <jiasheng@iscas.ac.cn> wrote:
>> >
>> > Add the missing check for platform_get_irq() and return error code
>> > if it fails.
>>
>> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> 
> Actually, the change is functional and now the wrong IRQ numbering in
> the DT will fail the ->probe(). This needs an additional explanation
> in the commit message why it's not a problem.
> 
>> > -       for (i = 0; i < ngpio; i++)
>> > -               chip->irq_number[i] = platform_get_irq(pdev, i);
>> > +       for (i = 0; i < ngpio; i++) {
>> > +               ret = platform_get_irq(pdev, i);
>> > +               if (ret < 0)
>> > +                       return ret;
>> > +               chip->irq_number[i] = ret;
>> > +       }

I will submit a new v3 adding the explanation.

Thanks,
Jiasheng


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

* Re: [PATCH v3] gpio: sifive: Add missing check for platform_get_irq
@ 2023-06-06  2:20 ` Jiasheng Jiang
  0 siblings, 0 replies; 14+ messages in thread
From: Jiasheng Jiang @ 2023-06-06  2:20 UTC (permalink / raw)
  To: andy.shevchenko
  Cc: oe-kbuild-all, linus.walleij, brgl, palmer, paul.walmsley,
	linux-gpio, linux-riscv, linux-kernel, Jiasheng Jiang

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 997 bytes --]

On Mon, 5 Jun 2023 17:15:53 +0800 Andy Shevchenko wrote:
> On Mon, Jun 5, 2023 at 12:13 ¯PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
>>
>> On Mon, Jun 5, 2023 at 4:49 ¯AM Jiasheng Jiang <jiasheng@iscas.ac.cn> wrote:
>> >
>> > Add the missing check for platform_get_irq() and return error code
>> > if it fails.
>>
>> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> 
> Actually, the change is functional and now the wrong IRQ numbering in
> the DT will fail the ->probe(). This needs an additional explanation
> in the commit message why it's not a problem.
> 
>> > -       for (i = 0; i < ngpio; i++)
>> > -               chip->irq_number[i] = platform_get_irq(pdev, i);
>> > +       for (i = 0; i < ngpio; i++) {
>> > +               ret = platform_get_irq(pdev, i);
>> > +               if (ret < 0)
>> > +                       return ret;
>> > +               chip->irq_number[i] = ret;
>> > +       }

I will submit a new v3 adding the explanation.

Thanks,
Jiasheng



[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH v3] gpio: sifive: Add missing check for platform_get_irq
  2023-06-06  3:11 ` Jiasheng Jiang
@ 2023-06-13 14:22   ` Bartosz Golaszewski
  -1 siblings, 0 replies; 14+ messages in thread
From: Bartosz Golaszewski @ 2023-06-13 14:22 UTC (permalink / raw)
  To: Jiasheng Jiang
  Cc: andy.shevchenko, oe-kbuild-all, linus.walleij, palmer,
	paul.walmsley, linux-gpio, linux-riscv, linux-kernel

On Tue, Jun 6, 2023 at 5:12 AM Jiasheng Jiang <jiasheng@iscas.ac.cn> wrote:
>
> Add the missing check for platform_get_irq() and return error code
> if it fails.
> The returned error code will be dealed with in
> builtin_platform_driver(sifive_gpio_driver) and the driver will not
> be registered.
>
> Fixes: f52d6d8b43e5 ("gpio: sifive: To get gpio irq offset from device tree data")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
> Changelog:
>
> v2 -> v3:
>
> 1. Check before assigning values.
>
> v1 -> v2:
>
> 1. Return "girq->parents[0]" instead of "-ENODEV".
> ---
>  drivers/gpio/gpio-sifive.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-sifive.c b/drivers/gpio/gpio-sifive.c
> index 98939cd4a71e..745e5f67254e 100644
> --- a/drivers/gpio/gpio-sifive.c
> +++ b/drivers/gpio/gpio-sifive.c
> @@ -221,8 +221,12 @@ static int sifive_gpio_probe(struct platform_device *pdev)
>                 return -ENODEV;
>         }
>
> -       for (i = 0; i < ngpio; i++)
> -               chip->irq_number[i] = platform_get_irq(pdev, i);
> +       for (i = 0; i < ngpio; i++) {
> +               ret = platform_get_irq(pdev, i);
> +               if (ret < 0)
> +                       return ret;
> +               chip->irq_number[i] = ret;
> +       }
>
>         ret = bgpio_init(&chip->gc, dev, 4,
>                          chip->base + SIFIVE_GPIO_INPUT_VAL,
> --
> 2.25.1
>

Applied, thanks!

Bart

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

* Re: [PATCH v3] gpio: sifive: Add missing check for platform_get_irq
@ 2023-06-13 14:22   ` Bartosz Golaszewski
  0 siblings, 0 replies; 14+ messages in thread
From: Bartosz Golaszewski @ 2023-06-13 14:22 UTC (permalink / raw)
  To: Jiasheng Jiang
  Cc: andy.shevchenko, oe-kbuild-all, linus.walleij, palmer,
	paul.walmsley, linux-gpio, linux-riscv, linux-kernel

On Tue, Jun 6, 2023 at 5:12 AM Jiasheng Jiang <jiasheng@iscas.ac.cn> wrote:
>
> Add the missing check for platform_get_irq() and return error code
> if it fails.
> The returned error code will be dealed with in
> builtin_platform_driver(sifive_gpio_driver) and the driver will not
> be registered.
>
> Fixes: f52d6d8b43e5 ("gpio: sifive: To get gpio irq offset from device tree data")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
> Changelog:
>
> v2 -> v3:
>
> 1. Check before assigning values.
>
> v1 -> v2:
>
> 1. Return "girq->parents[0]" instead of "-ENODEV".
> ---
>  drivers/gpio/gpio-sifive.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-sifive.c b/drivers/gpio/gpio-sifive.c
> index 98939cd4a71e..745e5f67254e 100644
> --- a/drivers/gpio/gpio-sifive.c
> +++ b/drivers/gpio/gpio-sifive.c
> @@ -221,8 +221,12 @@ static int sifive_gpio_probe(struct platform_device *pdev)
>                 return -ENODEV;
>         }
>
> -       for (i = 0; i < ngpio; i++)
> -               chip->irq_number[i] = platform_get_irq(pdev, i);
> +       for (i = 0; i < ngpio; i++) {
> +               ret = platform_get_irq(pdev, i);
> +               if (ret < 0)
> +                       return ret;
> +               chip->irq_number[i] = ret;
> +       }
>
>         ret = bgpio_init(&chip->gc, dev, 4,
>                          chip->base + SIFIVE_GPIO_INPUT_VAL,
> --
> 2.25.1
>

Applied, thanks!

Bart

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* [PATCH v3] gpio: sifive: Add missing check for platform_get_irq
@ 2023-06-06  3:11 ` Jiasheng Jiang
  0 siblings, 0 replies; 14+ messages in thread
From: Jiasheng Jiang @ 2023-06-06  3:11 UTC (permalink / raw)
  To: andy.shevchenko
  Cc: oe-kbuild-all, linus.walleij, brgl, palmer, paul.walmsley,
	linux-gpio, linux-riscv, linux-kernel, Jiasheng Jiang

Add the missing check for platform_get_irq() and return error code
if it fails.
The returned error code will be dealed with in
builtin_platform_driver(sifive_gpio_driver) and the driver will not
be registered.

Fixes: f52d6d8b43e5 ("gpio: sifive: To get gpio irq offset from device tree data")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
Changelog:

v2 -> v3:

1. Check before assigning values.

v1 -> v2:

1. Return "girq->parents[0]" instead of "-ENODEV".
---
 drivers/gpio/gpio-sifive.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-sifive.c b/drivers/gpio/gpio-sifive.c
index 98939cd4a71e..745e5f67254e 100644
--- a/drivers/gpio/gpio-sifive.c
+++ b/drivers/gpio/gpio-sifive.c
@@ -221,8 +221,12 @@ static int sifive_gpio_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	for (i = 0; i < ngpio; i++)
-		chip->irq_number[i] = platform_get_irq(pdev, i);
+	for (i = 0; i < ngpio; i++) {
+		ret = platform_get_irq(pdev, i);
+		if (ret < 0)
+			return ret;
+		chip->irq_number[i] = ret;
+	}
 
 	ret = bgpio_init(&chip->gc, dev, 4,
 			 chip->base + SIFIVE_GPIO_INPUT_VAL,
-- 
2.25.1


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

* [PATCH v3] gpio: sifive: Add missing check for platform_get_irq
@ 2023-06-06  3:11 ` Jiasheng Jiang
  0 siblings, 0 replies; 14+ messages in thread
From: Jiasheng Jiang @ 2023-06-06  3:11 UTC (permalink / raw)
  To: andy.shevchenko
  Cc: oe-kbuild-all, linus.walleij, brgl, palmer, paul.walmsley,
	linux-gpio, linux-riscv, linux-kernel, Jiasheng Jiang

Add the missing check for platform_get_irq() and return error code
if it fails.
The returned error code will be dealed with in
builtin_platform_driver(sifive_gpio_driver) and the driver will not
be registered.

Fixes: f52d6d8b43e5 ("gpio: sifive: To get gpio irq offset from device tree data")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
Changelog:

v2 -> v3:

1. Check before assigning values.

v1 -> v2:

1. Return "girq->parents[0]" instead of "-ENODEV".
---
 drivers/gpio/gpio-sifive.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-sifive.c b/drivers/gpio/gpio-sifive.c
index 98939cd4a71e..745e5f67254e 100644
--- a/drivers/gpio/gpio-sifive.c
+++ b/drivers/gpio/gpio-sifive.c
@@ -221,8 +221,12 @@ static int sifive_gpio_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	for (i = 0; i < ngpio; i++)
-		chip->irq_number[i] = platform_get_irq(pdev, i);
+	for (i = 0; i < ngpio; i++) {
+		ret = platform_get_irq(pdev, i);
+		if (ret < 0)
+			return ret;
+		chip->irq_number[i] = ret;
+	}
 
 	ret = bgpio_init(&chip->gc, dev, 4,
 			 chip->base + SIFIVE_GPIO_INPUT_VAL,
-- 
2.25.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH v3] gpio: sifive: Add missing check for platform_get_irq
@ 2023-06-06  2:21 ` Jiasheng Jiang
  0 siblings, 0 replies; 14+ messages in thread
From: Jiasheng Jiang @ 2023-06-06  2:21 UTC (permalink / raw)
  To: andy.shevchenko
  Cc: oe-kbuild-all, linus.walleij, brgl, palmer, paul.walmsley,
	linux-gpio, linux-riscv, linux-kernel, Jiasheng Jiang

On Mon, 5 Jun 2023 17:15:53 +0800 Andy Shevchenko wrote:
> On Mon, Jun 5, 2023 at 12:13 PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
>>
>> On Mon, Jun 5, 2023 at 4:49 AM Jiasheng Jiang <jiasheng@iscas.ac.cn> wrote:
>> >
>> > Add the missing check for platform_get_irq() and return error code
>> > if it fails.
>>
>> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> 
> Actually, the change is functional and now the wrong IRQ numbering in
> the DT will fail the ->probe(). This needs an additional explanation
> in the commit message why it's not a problem.
> 
>> > -       for (i = 0; i < ngpio; i++)
>> > -               chip->irq_number[i] = platform_get_irq(pdev, i);
>> > +       for (i = 0; i < ngpio; i++) {
>> > +               ret = platform_get_irq(pdev, i);
>> > +               if (ret < 0)
>> > +                       return ret;
>> > +               chip->irq_number[i] = ret;
>> > +       }

I will submit a new v3 adding the explanation.

Thanks,
Jiasheng


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

* Re: [PATCH v3] gpio: sifive: Add missing check for platform_get_irq
@ 2023-06-06  2:21 ` Jiasheng Jiang
  0 siblings, 0 replies; 14+ messages in thread
From: Jiasheng Jiang @ 2023-06-06  2:21 UTC (permalink / raw)
  To: andy.shevchenko
  Cc: oe-kbuild-all, linus.walleij, brgl, palmer, paul.walmsley,
	linux-gpio, linux-riscv, linux-kernel, Jiasheng Jiang

On Mon, 5 Jun 2023 17:15:53 +0800 Andy Shevchenko wrote:
> On Mon, Jun 5, 2023 at 12:13 PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
>>
>> On Mon, Jun 5, 2023 at 4:49 AM Jiasheng Jiang <jiasheng@iscas.ac.cn> wrote:
>> >
>> > Add the missing check for platform_get_irq() and return error code
>> > if it fails.
>>
>> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> 
> Actually, the change is functional and now the wrong IRQ numbering in
> the DT will fail the ->probe(). This needs an additional explanation
> in the commit message why it's not a problem.
> 
>> > -       for (i = 0; i < ngpio; i++)
>> > -               chip->irq_number[i] = platform_get_irq(pdev, i);
>> > +       for (i = 0; i < ngpio; i++) {
>> > +               ret = platform_get_irq(pdev, i);
>> > +               if (ret < 0)
>> > +                       return ret;
>> > +               chip->irq_number[i] = ret;
>> > +       }

I will submit a new v3 adding the explanation.

Thanks,
Jiasheng


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH v3] gpio: sifive: Add missing check for platform_get_irq
  2023-06-05  9:13   ` Andy Shevchenko
@ 2023-06-05  9:15     ` Andy Shevchenko
  -1 siblings, 0 replies; 14+ messages in thread
From: Andy Shevchenko @ 2023-06-05  9:15 UTC (permalink / raw)
  To: Jiasheng Jiang
  Cc: oe-kbuild-all, linus.walleij, brgl, palmer, paul.walmsley,
	linux-gpio, linux-riscv, linux-kernel

On Mon, Jun 5, 2023 at 12:13 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> On Mon, Jun 5, 2023 at 4:49 AM Jiasheng Jiang <jiasheng@iscas.ac.cn> wrote:
> >
> > Add the missing check for platform_get_irq() and return error code
> > if it fails.
>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

Actually, the change is functional and now the wrong IRQ numbering in
the DT will fail the ->probe(). This needs an additional explanation
in the commit message why it's not a problem.

> > -       for (i = 0; i < ngpio; i++)
> > -               chip->irq_number[i] = platform_get_irq(pdev, i);
> > +       for (i = 0; i < ngpio; i++) {
> > +               ret = platform_get_irq(pdev, i);
> > +               if (ret < 0)
> > +                       return ret;
> > +               chip->irq_number[i] = ret;
> > +       }

-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v3] gpio: sifive: Add missing check for platform_get_irq
@ 2023-06-05  9:15     ` Andy Shevchenko
  0 siblings, 0 replies; 14+ messages in thread
From: Andy Shevchenko @ 2023-06-05  9:15 UTC (permalink / raw)
  To: Jiasheng Jiang
  Cc: oe-kbuild-all, linus.walleij, brgl, palmer, paul.walmsley,
	linux-gpio, linux-riscv, linux-kernel

On Mon, Jun 5, 2023 at 12:13 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> On Mon, Jun 5, 2023 at 4:49 AM Jiasheng Jiang <jiasheng@iscas.ac.cn> wrote:
> >
> > Add the missing check for platform_get_irq() and return error code
> > if it fails.
>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

Actually, the change is functional and now the wrong IRQ numbering in
the DT will fail the ->probe(). This needs an additional explanation
in the commit message why it's not a problem.

> > -       for (i = 0; i < ngpio; i++)
> > -               chip->irq_number[i] = platform_get_irq(pdev, i);
> > +       for (i = 0; i < ngpio; i++) {
> > +               ret = platform_get_irq(pdev, i);
> > +               if (ret < 0)
> > +                       return ret;
> > +               chip->irq_number[i] = ret;
> > +       }

-- 
With Best Regards,
Andy Shevchenko

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH v3] gpio: sifive: Add missing check for platform_get_irq
  2023-06-05  1:48 ` Jiasheng Jiang
@ 2023-06-05  9:13   ` Andy Shevchenko
  -1 siblings, 0 replies; 14+ messages in thread
From: Andy Shevchenko @ 2023-06-05  9:13 UTC (permalink / raw)
  To: Jiasheng Jiang
  Cc: oe-kbuild-all, linus.walleij, brgl, palmer, paul.walmsley,
	linux-gpio, linux-riscv, linux-kernel

On Mon, Jun 5, 2023 at 4:49 AM Jiasheng Jiang <jiasheng@iscas.ac.cn> wrote:
>
> Add the missing check for platform_get_irq() and return error code
> if it fails.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Fixes: f52d6d8b43e5 ("gpio: sifive: To get gpio irq offset from device tree data")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
> Changelog:
>
> v2 -> v3:
>
> 1. Check before assigning values.
>
> v1 -> v2:
>
> 1. Return "girq->parents[0]" instead of "-ENODEV".
> ---
>  drivers/gpio/gpio-sifive.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-sifive.c b/drivers/gpio/gpio-sifive.c
> index 98939cd4a71e..745e5f67254e 100644
> --- a/drivers/gpio/gpio-sifive.c
> +++ b/drivers/gpio/gpio-sifive.c
> @@ -221,8 +221,12 @@ static int sifive_gpio_probe(struct platform_device *pdev)
>                 return -ENODEV;
>         }
>
> -       for (i = 0; i < ngpio; i++)
> -               chip->irq_number[i] = platform_get_irq(pdev, i);
> +       for (i = 0; i < ngpio; i++) {
> +               ret = platform_get_irq(pdev, i);
> +               if (ret < 0)
> +                       return ret;
> +               chip->irq_number[i] = ret;
> +       }
>
>         ret = bgpio_init(&chip->gc, dev, 4,
>                          chip->base + SIFIVE_GPIO_INPUT_VAL,
> --
> 2.25.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v3] gpio: sifive: Add missing check for platform_get_irq
@ 2023-06-05  9:13   ` Andy Shevchenko
  0 siblings, 0 replies; 14+ messages in thread
From: Andy Shevchenko @ 2023-06-05  9:13 UTC (permalink / raw)
  To: Jiasheng Jiang
  Cc: oe-kbuild-all, linus.walleij, brgl, palmer, paul.walmsley,
	linux-gpio, linux-riscv, linux-kernel

On Mon, Jun 5, 2023 at 4:49 AM Jiasheng Jiang <jiasheng@iscas.ac.cn> wrote:
>
> Add the missing check for platform_get_irq() and return error code
> if it fails.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Fixes: f52d6d8b43e5 ("gpio: sifive: To get gpio irq offset from device tree data")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
> Changelog:
>
> v2 -> v3:
>
> 1. Check before assigning values.
>
> v1 -> v2:
>
> 1. Return "girq->parents[0]" instead of "-ENODEV".
> ---
>  drivers/gpio/gpio-sifive.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-sifive.c b/drivers/gpio/gpio-sifive.c
> index 98939cd4a71e..745e5f67254e 100644
> --- a/drivers/gpio/gpio-sifive.c
> +++ b/drivers/gpio/gpio-sifive.c
> @@ -221,8 +221,12 @@ static int sifive_gpio_probe(struct platform_device *pdev)
>                 return -ENODEV;
>         }
>
> -       for (i = 0; i < ngpio; i++)
> -               chip->irq_number[i] = platform_get_irq(pdev, i);
> +       for (i = 0; i < ngpio; i++) {
> +               ret = platform_get_irq(pdev, i);
> +               if (ret < 0)
> +                       return ret;
> +               chip->irq_number[i] = ret;
> +       }
>
>         ret = bgpio_init(&chip->gc, dev, 4,
>                          chip->base + SIFIVE_GPIO_INPUT_VAL,
> --
> 2.25.1
>


-- 
With Best Regards,
Andy Shevchenko

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* [PATCH v3] gpio: sifive: Add missing check for platform_get_irq
@ 2023-06-05  1:48 ` Jiasheng Jiang
  0 siblings, 0 replies; 14+ messages in thread
From: Jiasheng Jiang @ 2023-06-05  1:48 UTC (permalink / raw)
  To: andy.shevchenko
  Cc: oe-kbuild-all, linus.walleij, brgl, palmer, paul.walmsley,
	linux-gpio, linux-riscv, linux-kernel, Jiasheng Jiang

Add the missing check for platform_get_irq() and return error code
if it fails.

Fixes: f52d6d8b43e5 ("gpio: sifive: To get gpio irq offset from device tree data")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
Changelog:

v2 -> v3:

1. Check before assigning values.

v1 -> v2:

1. Return "girq->parents[0]" instead of "-ENODEV".
---
 drivers/gpio/gpio-sifive.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-sifive.c b/drivers/gpio/gpio-sifive.c
index 98939cd4a71e..745e5f67254e 100644
--- a/drivers/gpio/gpio-sifive.c
+++ b/drivers/gpio/gpio-sifive.c
@@ -221,8 +221,12 @@ static int sifive_gpio_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	for (i = 0; i < ngpio; i++)
-		chip->irq_number[i] = platform_get_irq(pdev, i);
+	for (i = 0; i < ngpio; i++) {
+		ret = platform_get_irq(pdev, i);
+		if (ret < 0)
+			return ret;
+		chip->irq_number[i] = ret;
+	}
 
 	ret = bgpio_init(&chip->gc, dev, 4,
 			 chip->base + SIFIVE_GPIO_INPUT_VAL,
-- 
2.25.1


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

* [PATCH v3] gpio: sifive: Add missing check for platform_get_irq
@ 2023-06-05  1:48 ` Jiasheng Jiang
  0 siblings, 0 replies; 14+ messages in thread
From: Jiasheng Jiang @ 2023-06-05  1:48 UTC (permalink / raw)
  To: andy.shevchenko
  Cc: oe-kbuild-all, linus.walleij, brgl, palmer, paul.walmsley,
	linux-gpio, linux-riscv, linux-kernel, Jiasheng Jiang

Add the missing check for platform_get_irq() and return error code
if it fails.

Fixes: f52d6d8b43e5 ("gpio: sifive: To get gpio irq offset from device tree data")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
Changelog:

v2 -> v3:

1. Check before assigning values.

v1 -> v2:

1. Return "girq->parents[0]" instead of "-ENODEV".
---
 drivers/gpio/gpio-sifive.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-sifive.c b/drivers/gpio/gpio-sifive.c
index 98939cd4a71e..745e5f67254e 100644
--- a/drivers/gpio/gpio-sifive.c
+++ b/drivers/gpio/gpio-sifive.c
@@ -221,8 +221,12 @@ static int sifive_gpio_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	for (i = 0; i < ngpio; i++)
-		chip->irq_number[i] = platform_get_irq(pdev, i);
+	for (i = 0; i < ngpio; i++) {
+		ret = platform_get_irq(pdev, i);
+		if (ret < 0)
+			return ret;
+		chip->irq_number[i] = ret;
+	}
 
 	ret = bgpio_init(&chip->gc, dev, 4,
 			 chip->base + SIFIVE_GPIO_INPUT_VAL,
-- 
2.25.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

end of thread, other threads:[~2023-06-13 14:23 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-06  2:20 [PATCH v3] gpio: sifive: Add missing check for platform_get_irq Jiasheng Jiang
2023-06-06  2:20 ` Jiasheng Jiang
  -- strict thread matches above, loose matches on Subject: below --
2023-06-06  3:11 Jiasheng Jiang
2023-06-06  3:11 ` Jiasheng Jiang
2023-06-13 14:22 ` Bartosz Golaszewski
2023-06-13 14:22   ` Bartosz Golaszewski
2023-06-06  2:21 Jiasheng Jiang
2023-06-06  2:21 ` Jiasheng Jiang
2023-06-05  1:48 Jiasheng Jiang
2023-06-05  1:48 ` Jiasheng Jiang
2023-06-05  9:13 ` Andy Shevchenko
2023-06-05  9:13   ` Andy Shevchenko
2023-06-05  9:15   ` Andy Shevchenko
2023-06-05  9:15     ` Andy Shevchenko

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.