From: Deepak R Varma <drv@mailo.com>
To: Srinivas Neeli <srinivas.neeli@xilinx.com>
Cc: linus.walleij@linaro.org, bgolaszewski@baylibre.com,
michal.simek@xilinx.com, shubhrajyoti.datta@xilinx.com,
sgoud@xilinx.com, linux-gpio@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, git@xilinx.com
Subject: Re: [PATCH 3/3] gpio: zynq: Check return value of irq_get_irq_data
Date: Sat, 17 Apr 2021 23:32:22 +0530 [thread overview]
Message-ID: <20210417180222.GA112239@localhost> (raw)
In-Reply-To: <20210409140806.31824-4-srinivas.neeli@xilinx.com>
On Fri, Apr 09, 2021 at 07:38:06PM +0530, Srinivas Neeli wrote:
> 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");
It will be useful to include a tag such as "suspend: " in the error
message to uniquely identify where it failed from.
> + 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");
Ditto. Suggest using "resume: " tag here.
> + return -EINVAL;
> + }
> +
> if (!device_may_wakeup(dev))
> enable_irq(gpio->irq);
>
> --
> 2.9.1
>
prev parent reply other threads:[~2021-04-17 18:23 UTC|newest]
Thread overview: 11+ 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 ` [PATCH 1/3] gpio: zynq: use module_platform_driver to simplify the code Srinivas Neeli
[not found] ` <CAHp75Vddd6ygr4mJ9Z+SuGZmfLcgDLWLZaxby2XE2mX8War-qQ@mail.gmail.com>
2021-04-13 10:43 ` Bartosz Golaszewski
2021-04-14 14:45 ` Srinivas Neeli
2021-04-16 18:27 ` Bartosz Golaszewski
2021-04-17 11:06 ` Andy Shevchenko
2021-06-14 10:39 ` Srinivas Neeli
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 ` [PATCH 3/3] gpio: zynq: Check return value of irq_get_irq_data Srinivas Neeli
2021-04-17 18:02 ` Deepak R Varma [this message]
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=20210417180222.GA112239@localhost \
--to=drv@mailo.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 \
--cc=srinivas.neeli@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 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).