2022-01-21 13:10:40

by Yang Li

[permalink] [raw]
Subject: [PATCH -next 1/2] gpio: idt3243x: Fix an ignored error return from platform_get_irq()

The return from the call to platform_get_irq() is int, it can be
a negative error code, however this is being assigned to an unsigned
int variable 'parent_irq', so making 'parent_irq' an int.

Eliminate the following coccicheck warning:
./drivers/gpio/gpio-idt3243x.c:167:6-16: WARNING: Unsigned expression
compared with zero: parent_irq < 0

Reported-by: Abaci Robot <[email protected]>
Fixes: 30fee1d7462a ("gpio: idt3243x: Fix IRQ check in idt_gpio_probe")
Signed-off-by: Yang Li <[email protected]>
---
drivers/gpio/gpio-idt3243x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-idt3243x.c b/drivers/gpio/gpio-idt3243x.c
index 08493b05be2d..52b8b72ded77 100644
--- a/drivers/gpio/gpio-idt3243x.c
+++ b/drivers/gpio/gpio-idt3243x.c
@@ -132,7 +132,7 @@ static int idt_gpio_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct gpio_irq_chip *girq;
struct idt_gpio_ctrl *ctrl;
- unsigned int parent_irq;
+ int parent_irq;
int ngpios;
int ret;

--
2.20.1.7.g153144c


2022-01-21 13:11:01

by Yang Li

[permalink] [raw]
Subject: [PATCH -next 2/2] gpio: mpc8xxx: Fix an ignored error return from platform_get_irq()

The return from the call to platform_get_irq() is int, it can be
a negative error code, however this is being assigned to an unsigned
int variable 'irqn', so making 'irqn' an int.

Eliminate the following coccicheck warning:
./drivers/gpio/gpio-mpc8xxx.c:391:5-21: WARNING: Unsigned expression
compared with zero: mpc8xxx_gc -> irqn < 0

Reported-by: Abaci Robot <[email protected]>
Fixes: 0b39536cc699 ("gpio: mpc8xxx: Fix IRQ check in mpc8xxx_probe")
Signed-off-by: Yang Li <[email protected]>
---
drivers/gpio/gpio-mpc8xxx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
index 01634c8d27b3..a964e25ea620 100644
--- a/drivers/gpio/gpio-mpc8xxx.c
+++ b/drivers/gpio/gpio-mpc8xxx.c
@@ -47,7 +47,7 @@ struct mpc8xxx_gpio_chip {
unsigned offset, int value);

struct irq_domain *irq;
- unsigned int irqn;
+ int irqn;
};

/*
--
2.20.1.7.g153144c

2022-01-21 21:10:37

by Bartosz Golaszewski

[permalink] [raw]
Subject: Re: [PATCH -next 1/2] gpio: idt3243x: Fix an ignored error return from platform_get_irq()

On Wed, Jan 19, 2022 at 2:04 AM Yang Li <[email protected]> wrote:
>
> The return from the call to platform_get_irq() is int, it can be
> a negative error code, however this is being assigned to an unsigned
> int variable 'parent_irq', so making 'parent_irq' an int.
>
> Eliminate the following coccicheck warning:
> ./drivers/gpio/gpio-idt3243x.c:167:6-16: WARNING: Unsigned expression
> compared with zero: parent_irq < 0
>
> Reported-by: Abaci Robot <[email protected]>
> Fixes: 30fee1d7462a ("gpio: idt3243x: Fix IRQ check in idt_gpio_probe")
> Signed-off-by: Yang Li <[email protected]>
> ---
> drivers/gpio/gpio-idt3243x.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-idt3243x.c b/drivers/gpio/gpio-idt3243x.c
> index 08493b05be2d..52b8b72ded77 100644
> --- a/drivers/gpio/gpio-idt3243x.c
> +++ b/drivers/gpio/gpio-idt3243x.c
> @@ -132,7 +132,7 @@ static int idt_gpio_probe(struct platform_device *pdev)
> struct device *dev = &pdev->dev;
> struct gpio_irq_chip *girq;
> struct idt_gpio_ctrl *ctrl;
> - unsigned int parent_irq;
> + int parent_irq;
> int ngpios;
> int ret;
>
> --
> 2.20.1.7.g153144c
>

Queued for fixes, thanks!

Bart

2022-01-21 21:10:40

by Bartosz Golaszewski

[permalink] [raw]
Subject: Re: [PATCH -next 2/2] gpio: mpc8xxx: Fix an ignored error return from platform_get_irq()

On Wed, Jan 19, 2022 at 2:04 AM Yang Li <[email protected]> wrote:
>
> The return from the call to platform_get_irq() is int, it can be
> a negative error code, however this is being assigned to an unsigned
> int variable 'irqn', so making 'irqn' an int.
>
> Eliminate the following coccicheck warning:
> ./drivers/gpio/gpio-mpc8xxx.c:391:5-21: WARNING: Unsigned expression
> compared with zero: mpc8xxx_gc -> irqn < 0
>
> Reported-by: Abaci Robot <[email protected]>
> Fixes: 0b39536cc699 ("gpio: mpc8xxx: Fix IRQ check in mpc8xxx_probe")
> Signed-off-by: Yang Li <[email protected]>
> ---
> drivers/gpio/gpio-mpc8xxx.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
> index 01634c8d27b3..a964e25ea620 100644
> --- a/drivers/gpio/gpio-mpc8xxx.c
> +++ b/drivers/gpio/gpio-mpc8xxx.c
> @@ -47,7 +47,7 @@ struct mpc8xxx_gpio_chip {
> unsigned offset, int value);
>
> struct irq_domain *irq;
> - unsigned int irqn;
> + int irqn;
> };
>
> /*
> --
> 2.20.1.7.g153144c
>

Queued for fixes, thanks!

Bart