* [PATCH v2] gpio: tqmx86: fix uninitialized variable girq
@ 2022-09-19 3:12 Dongliang Mu
2022-09-19 9:07 ` Marc Zyngier
2022-09-21 7:31 ` Bartosz Golaszewski
0 siblings, 2 replies; 3+ messages in thread
From: Dongliang Mu @ 2022-09-19 3:12 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Marc Zyngier
Cc: Dongliang Mu, linux-gpio, linux-kernel
From: Dongliang Mu <mudongliangabcd@gmail.com>
The commit 924610607f19 ("gpio: tpmx86: Move PM device over to
irq domain") adds a dereference of girq that may be uninitialized.
Fix this by moving irq_domain_set_pm_device into if true branch
as suggested by Marc Zyngier.
Fixes: 924610607f19 ("gpio: tpmx86: Move PM device over to irq domain")
Suggested-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
---
v1->v2: modify fix method to moving irq_domain_set_pm_device into
if true branch as suggested by Marc Zyngier
drivers/gpio/gpio-tqmx86.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-tqmx86.c b/drivers/gpio/gpio-tqmx86.c
index fa4bc7481f9a..e739dcea61b2 100644
--- a/drivers/gpio/gpio-tqmx86.c
+++ b/drivers/gpio/gpio-tqmx86.c
@@ -307,6 +307,8 @@ static int tqmx86_gpio_probe(struct platform_device *pdev)
girq->default_type = IRQ_TYPE_NONE;
girq->handler = handle_simple_irq;
girq->init_valid_mask = tqmx86_init_irq_valid_mask;
+
+ irq_domain_set_pm_device(girq->domain, dev);
}
ret = devm_gpiochip_add_data(dev, chip, gpio);
@@ -315,8 +317,6 @@ static int tqmx86_gpio_probe(struct platform_device *pdev)
goto out_pm_dis;
}
- irq_domain_set_pm_device(girq->domain, dev);
-
dev_info(dev, "GPIO functionality initialized with %d pins\n",
chip->ngpio);
--
2.35.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] gpio: tqmx86: fix uninitialized variable girq
2022-09-19 3:12 [PATCH v2] gpio: tqmx86: fix uninitialized variable girq Dongliang Mu
@ 2022-09-19 9:07 ` Marc Zyngier
2022-09-21 7:31 ` Bartosz Golaszewski
1 sibling, 0 replies; 3+ messages in thread
From: Marc Zyngier @ 2022-09-19 9:07 UTC (permalink / raw)
To: Dongliang Mu
Cc: Linus Walleij, Bartosz Golaszewski, Dongliang Mu, linux-gpio,
linux-kernel
On Mon, 19 Sep 2022 04:12:49 +0100,
Dongliang Mu <dzm91@hust.edu.cn> wrote:
>
> From: Dongliang Mu <mudongliangabcd@gmail.com>
>
> The commit 924610607f19 ("gpio: tpmx86: Move PM device over to
> irq domain") adds a dereference of girq that may be uninitialized.
>
> Fix this by moving irq_domain_set_pm_device into if true branch
> as suggested by Marc Zyngier.
>
> Fixes: 924610607f19 ("gpio: tpmx86: Move PM device over to irq domain")
> Suggested-by: Marc Zyngier <maz@kernel.org>
> Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
> ---
> v1->v2: modify fix method to moving irq_domain_set_pm_device into
> if true branch as suggested by Marc Zyngier
> drivers/gpio/gpio-tqmx86.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Acked-by: Marc Zyngier <maz@kernel.org>
M.
--
Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] gpio: tqmx86: fix uninitialized variable girq
2022-09-19 3:12 [PATCH v2] gpio: tqmx86: fix uninitialized variable girq Dongliang Mu
2022-09-19 9:07 ` Marc Zyngier
@ 2022-09-21 7:31 ` Bartosz Golaszewski
1 sibling, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2022-09-21 7:31 UTC (permalink / raw)
To: Dongliang Mu
Cc: Linus Walleij, Marc Zyngier, Dongliang Mu, linux-gpio, linux-kernel
On Mon, Sep 19, 2022 at 5:14 AM Dongliang Mu <dzm91@hust.edu.cn> wrote:
>
> From: Dongliang Mu <mudongliangabcd@gmail.com>
>
> The commit 924610607f19 ("gpio: tpmx86: Move PM device over to
> irq domain") adds a dereference of girq that may be uninitialized.
>
> Fix this by moving irq_domain_set_pm_device into if true branch
> as suggested by Marc Zyngier.
>
> Fixes: 924610607f19 ("gpio: tpmx86: Move PM device over to irq domain")
> Suggested-by: Marc Zyngier <maz@kernel.org>
> Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
> ---
> v1->v2: modify fix method to moving irq_domain_set_pm_device into
> if true branch as suggested by Marc Zyngier
> drivers/gpio/gpio-tqmx86.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-tqmx86.c b/drivers/gpio/gpio-tqmx86.c
> index fa4bc7481f9a..e739dcea61b2 100644
> --- a/drivers/gpio/gpio-tqmx86.c
> +++ b/drivers/gpio/gpio-tqmx86.c
> @@ -307,6 +307,8 @@ static int tqmx86_gpio_probe(struct platform_device *pdev)
> girq->default_type = IRQ_TYPE_NONE;
> girq->handler = handle_simple_irq;
> girq->init_valid_mask = tqmx86_init_irq_valid_mask;
> +
> + irq_domain_set_pm_device(girq->domain, dev);
> }
>
> ret = devm_gpiochip_add_data(dev, chip, gpio);
> @@ -315,8 +317,6 @@ static int tqmx86_gpio_probe(struct platform_device *pdev)
> goto out_pm_dis;
> }
>
> - irq_domain_set_pm_device(girq->domain, dev);
> -
> dev_info(dev, "GPIO functionality initialized with %d pins\n",
> chip->ngpio);
>
> --
> 2.35.1
>
Applied, thanks!
Bart
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-21 7:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-19 3:12 [PATCH v2] gpio: tqmx86: fix uninitialized variable girq Dongliang Mu
2022-09-19 9:07 ` Marc Zyngier
2022-09-21 7:31 ` Bartosz Golaszewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).