From: Michal Simek <michal.simek@amd.com>
To: Srinivas Neeli <srinivas.neeli@xilinx.com>,
<linus.walleij@linaro.org>, <brgl@bgdev.pl>,
<bgolaszewski@baylibre.com>, <michal.simek@xilinx.com>,
<neelisrinivas18@gmail.com>, <shubhrajyoti.datta@xilinx.com>,
<srinivas.neeli@amd.com>, <sgoud@xilinx.com>
Cc: <linux-gpio@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <git@xilinx.com>
Subject: Re: [PATCH] gpio: gpio-xilinx: Check return value of of_property_read_u32
Date: Fri, 17 Jun 2022 08:02:26 +0200 [thread overview]
Message-ID: <bd4ff961-37b8-607b-e801-bff37d0eb452@amd.com> (raw)
In-Reply-To: <20220617051921.3801832-1-srinivas.neeli@xilinx.com>
On 6/17/22 07:19, Srinivas Neeli wrote:
> In five different instances the return value of "of_property_read_u32"
> API was neither captured nor checked.
>
> Fixed it by capturing the return value and then checking for any error.
>
> Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com>
> Addresses-Coverity: "check_return"
> ---
> drivers/gpio/gpio-xilinx.c | 15 ++++++++++-----
> 1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpio/gpio-xilinx.c b/drivers/gpio/gpio-xilinx.c
> index b6d3a57e27ed..268c7b0e481d 100644
> --- a/drivers/gpio/gpio-xilinx.c
> +++ b/drivers/gpio/gpio-xilinx.c
> @@ -570,7 +570,8 @@ static int xgpio_probe(struct platform_device *pdev)
> platform_set_drvdata(pdev, chip);
>
> /* First, check if the device is dual-channel */
> - of_property_read_u32(np, "xlnx,is-dual", &is_dual);
> + if (of_property_read_u32(np, "xlnx,is-dual", &is_dual))
> + is_dual = 0;
All these values are initialized already.
Isn't it enough to just ignore return value like this to make coverity happy?
(void)of_property_read_u32(np, "xlnx,is-dual", &is_dual)
Thanks,
Michal
next prev parent reply other threads:[~2022-06-17 6:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-17 5:19 Srinivas Neeli
2022-06-17 6:02 ` Michal Simek [this message]
2022-06-17 16:02 ` Andy Shevchenko
2022-06-20 6:26 ` Michal Simek
2022-06-28 12:27 ` Linus Walleij
2022-06-29 7:31 ` Michal Simek
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=bd4ff961-37b8-607b-e801-bff37d0eb452@amd.com \
--to=michal.simek@amd.com \
--cc=bgolaszewski@baylibre.com \
--cc=brgl@bgdev.pl \
--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=neelisrinivas18@gmail.com \
--cc=sgoud@xilinx.com \
--cc=shubhrajyoti.datta@xilinx.com \
--cc=srinivas.neeli@amd.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
all inboxes | Powered by JetHome®