[PATCH] gpio: tpmx86: fix uninitialized variable girq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Dongliang Mu <mudongliangabcd@xxxxxxxxx>

The commit 924610607f19 ("gpio: tpmx86: Move PM device over to
irq domain") adds a dereference of girq that may be uninitialized.

Fix this by initializing girq and checking irq before invoking
irq_domain_set_pm_device.

Fixes: 924610607f19 ("gpio: tpmx86: Move PM device over to irq domain")
Signed-off-by: Dongliang Mu <mudongliangabcd@xxxxxxxxx>
---
 drivers/gpio/gpio-tqmx86.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-tqmx86.c b/drivers/gpio/gpio-tqmx86.c
index fa4bc7481f9a..bdef182c11c2 100644
--- a/drivers/gpio/gpio-tqmx86.c
+++ b/drivers/gpio/gpio-tqmx86.c
@@ -231,7 +231,7 @@ static int tqmx86_gpio_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct tqmx86_gpio_data *gpio;
 	struct gpio_chip *chip;
-	struct gpio_irq_chip *girq;
+	struct gpio_irq_chip *girq = NULL;
 	void __iomem *io_base;
 	struct resource *res;
 	int ret, irq;
@@ -315,7 +315,9 @@ static int tqmx86_gpio_probe(struct platform_device *pdev)
 		goto out_pm_dis;
 	}
 
-	irq_domain_set_pm_device(girq->domain, dev);
+	if (girq) {
+		irq_domain_set_pm_device(girq->domain, dev);
+	}
 
 	dev_info(dev, "GPIO functionality initialized with %d pins\n",
 		 chip->ngpio);
-- 
2.35.1




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux