summaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-zynq.c
diff options
context:
space:
mode:
authorSrinivas Neeli <srinivas.neeli@xilinx.com>2021-04-09 16:08:06 +0200
committerBartosz Golaszewski <bgolaszewski@baylibre.com>2021-06-14 20:21:21 +0200
commit35d7b72a632bc7afb15356f44005554af8697904 (patch)
tree161a08647a20a8b546b2d1985705c434a4bb6e57 /drivers/gpio/gpio-zynq.c
parentgpio: zynq: Check return value of pm_runtime_get_sync (diff)
downloadlinux-35d7b72a632bc7afb15356f44005554af8697904.tar.xz
linux-35d7b72a632bc7afb15356f44005554af8697904.zip
gpio: zynq: Check return value of irq_get_irq_data
In two different instances the return value of "irq_get_irq_data" API was neither captured nor checked. Fixed it by capturing the return value and then checking for any error. Addresses-Coverity: "returned_null" Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Diffstat (limited to 'drivers/gpio/gpio-zynq.c')
-rw-r--r--drivers/gpio/gpio-zynq.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c
index c91302a16c77..f0cb8ccd03ed 100644
--- a/drivers/gpio/gpio-zynq.c
+++ b/drivers/gpio/gpio-zynq.c
@@ -736,6 +736,11 @@ static int __maybe_unused zynq_gpio_suspend(struct device *dev)
struct zynq_gpio *gpio = dev_get_drvdata(dev);
struct irq_data *data = irq_get_irq_data(gpio->irq);
+ if (!data) {
+ dev_err(dev, "irq_get_irq_data() failed\n");
+ return -EINVAL;
+ }
+
if (!device_may_wakeup(dev))
disable_irq(gpio->irq);
@@ -753,6 +758,11 @@ static int __maybe_unused zynq_gpio_resume(struct device *dev)
struct irq_data *data = irq_get_irq_data(gpio->irq);
int ret;
+ if (!data) {
+ dev_err(dev, "irq_get_irq_data() failed\n");
+ return -EINVAL;
+ }
+
if (!device_may_wakeup(dev))
enable_irq(gpio->irq);