Skip to content

Commit

Permalink
gpio: tqmx86: fix uninitialized variable girq
Browse files Browse the repository at this point in the history
The commit 9246106 ("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: 9246106 ("gpio: tpmx86: Move PM device over to irq domain")
Suggested-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
Acked-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
  • Loading branch information
Dongliang Mu authored and Bartosz Golaszewski committed Sep 21, 2022
1 parent ab637d4 commit 21a9acc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/gpio/gpio-tqmx86.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);

Expand Down

0 comments on commit 21a9acc

Please sign in to comment.