All of lore.kernel.org
 help / color / mirror / Atom feed
From: Srinivas Neeli <srinivas.neeli@xilinx.com>
To: <linus.walleij@linaro.org>, <bgolaszewski@baylibre.com>,
	<michal.simek@xilinx.com>, <shubhrajyoti.datta@xilinx.com>,
	<sgoud@xilinx.com>
Cc: <linux-gpio@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <git@xilinx.com>,
	Srinivas Neeli <srinivas.neeli@xilinx.com>
Subject: [PATCH 3/3] gpio: zynq: Check return value of irq_get_irq_data
Date: Fri, 9 Apr 2021 19:38:06 +0530	[thread overview]
Message-ID: <20210409140806.31824-4-srinivas.neeli@xilinx.com> (raw)
In-Reply-To: <20210409140806.31824-1-srinivas.neeli@xilinx.com>

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>
---
 drivers/gpio/gpio-zynq.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

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);
 
-- 
2.9.1


WARNING: multiple messages have this Message-ID (diff)
From: Srinivas Neeli <srinivas.neeli@xilinx.com>
To: <linus.walleij@linaro.org>, <bgolaszewski@baylibre.com>,
	<michal.simek@xilinx.com>, <shubhrajyoti.datta@xilinx.com>,
	<sgoud@xilinx.com>
Cc: <linux-gpio@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <git@xilinx.com>,
	Srinivas Neeli <srinivas.neeli@xilinx.com>
Subject: [PATCH 3/3] gpio: zynq: Check return value of irq_get_irq_data
Date: Fri, 9 Apr 2021 19:38:06 +0530	[thread overview]
Message-ID: <20210409140806.31824-4-srinivas.neeli@xilinx.com> (raw)
In-Reply-To: <20210409140806.31824-1-srinivas.neeli@xilinx.com>

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>
---
 drivers/gpio/gpio-zynq.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

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);
 
-- 
2.9.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-04-09 14:08 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-09 14:08 [PATCH 0/3] gpio: zynq: Update on gpio zynq driver Srinivas Neeli
2021-04-09 14:08 ` Srinivas Neeli
2021-04-09 14:08 ` [PATCH 1/3] gpio: zynq: use module_platform_driver to simplify the code Srinivas Neeli
2021-04-09 14:08   ` Srinivas Neeli
     [not found]   ` <CAHp75Vddd6ygr4mJ9Z+SuGZmfLcgDLWLZaxby2XE2mX8War-qQ@mail.gmail.com>
2021-04-13 10:43     ` Bartosz Golaszewski
2021-04-13 10:43       ` Bartosz Golaszewski
2021-04-14 14:45       ` Srinivas Neeli
2021-04-14 14:45         ` Srinivas Neeli
2021-04-16 18:27         ` Bartosz Golaszewski
2021-04-16 18:27           ` Bartosz Golaszewski
2021-04-17 11:06           ` Andy Shevchenko
2021-04-17 11:06             ` Andy Shevchenko
2021-06-14 10:39           ` Srinivas Neeli
2021-06-14 10:39             ` Srinivas Neeli
2021-06-14 18:22             ` Bartosz Golaszewski
2021-06-14 18:22               ` Bartosz Golaszewski
2021-04-09 14:08 ` [PATCH 2/3] gpio: zynq: Check return value of pm_runtime_get_sync Srinivas Neeli
2021-04-09 14:08   ` Srinivas Neeli
2021-04-09 14:08 ` Srinivas Neeli [this message]
2021-04-09 14:08   ` [PATCH 3/3] gpio: zynq: Check return value of irq_get_irq_data Srinivas Neeli
2021-04-17 18:02   ` Deepak R Varma
2021-04-17 18:02     ` Deepak R Varma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210409140806.31824-4-srinivas.neeli@xilinx.com \
    --to=srinivas.neeli@xilinx.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=git@xilinx.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=sgoud@xilinx.com \
    --cc=shubhrajyoti.datta@xilinx.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.