From: walter harms <wharms@bfs.de>
To: Colin King <colin.king@canonical.com>
Cc: Dan Murphy <dmurphy@ti.com>,
Jacek Anaszewski <jacek.anaszewski@gmail.com>,
Pavel Machek <pavel@ucw.cz>,
linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH][next] leds: lm36274: remove redundant initialization of variable ret
Date: Wed, 12 Jun 2019 15:18:40 +0000 [thread overview]
Message-ID: <5D0117D0.501@bfs.de> (raw)
In-Reply-To: <20190612145659.26514-1-colin.king@canonical.com>
Am 12.06.2019 16:56, schrieb Colin King:
> From: Colin Ian King <colin.king@canonical.com>
>
> The variable ret is being initialized with a value that is never
> read, hence it is redundant and can be removed. Also move the
> declaration of ret to the for loop scope.
>
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/leds/leds-lm36274.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/leds/leds-lm36274.c b/drivers/leds/leds-lm36274.c
> index ed9dc857ec8f..b55bd238c074 100644
> --- a/drivers/leds/leds-lm36274.c
> +++ b/drivers/leds/leds-lm36274.c
> @@ -74,7 +74,6 @@ static int lm36274_parse_dt(struct lm36274 *lm36274_data)
> struct device *dev = &lm36274_data->pdev->dev;
> const char *name;
> int child_cnt;
> - int ret = -EINVAL;
>
> /* There should only be 1 node */
> child_cnt = device_get_child_node_count(dev);
> @@ -82,6 +81,8 @@ static int lm36274_parse_dt(struct lm36274 *lm36274_data)
> return -EINVAL;
>
> device_for_each_child_node(dev, child) {
> + int ret;
> +
> ret = fwnode_property_read_string(child, "label", &name);
> if (ret)
> snprintf(label, sizeof(label),
this looks odd,
i would leave ret in place or move char *name also.
just my 2 cents,
re,
wh
WARNING: multiple messages have this Message-ID (diff)
From: walter harms <wharms@bfs.de>
To: Colin King <colin.king@canonical.com>
Cc: Dan Murphy <dmurphy@ti.com>,
Jacek Anaszewski <jacek.anaszewski@gmail.com>,
Pavel Machek <pavel@ucw.cz>,
linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH][next] leds: lm36274: remove redundant initialization of variable ret
Date: Wed, 12 Jun 2019 17:18:40 +0200 [thread overview]
Message-ID: <5D0117D0.501@bfs.de> (raw)
In-Reply-To: <20190612145659.26514-1-colin.king@canonical.com>
Am 12.06.2019 16:56, schrieb Colin King:
> From: Colin Ian King <colin.king@canonical.com>
>
> The variable ret is being initialized with a value that is never
> read, hence it is redundant and can be removed. Also move the
> declaration of ret to the for loop scope.
>
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/leds/leds-lm36274.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/leds/leds-lm36274.c b/drivers/leds/leds-lm36274.c
> index ed9dc857ec8f..b55bd238c074 100644
> --- a/drivers/leds/leds-lm36274.c
> +++ b/drivers/leds/leds-lm36274.c
> @@ -74,7 +74,6 @@ static int lm36274_parse_dt(struct lm36274 *lm36274_data)
> struct device *dev = &lm36274_data->pdev->dev;
> const char *name;
> int child_cnt;
> - int ret = -EINVAL;
>
> /* There should only be 1 node */
> child_cnt = device_get_child_node_count(dev);
> @@ -82,6 +81,8 @@ static int lm36274_parse_dt(struct lm36274 *lm36274_data)
> return -EINVAL;
>
> device_for_each_child_node(dev, child) {
> + int ret;
> +
> ret = fwnode_property_read_string(child, "label", &name);
> if (ret)
> snprintf(label, sizeof(label),
this looks odd,
i would leave ret in place or move char *name also.
just my 2 cents,
re,
wh
next prev parent reply other threads:[~2019-06-12 15:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-12 14:56 [PATCH][next] leds: lm36274: remove redundant initialization of variable ret Colin King
2019-06-12 14:56 ` Colin King
2019-06-12 15:18 ` walter harms [this message]
2019-06-12 15:18 ` walter harms
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=5D0117D0.501@bfs.de \
--to=wharms@bfs.de \
--cc=colin.king@canonical.com \
--cc=dmurphy@ti.com \
--cc=jacek.anaszewski@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@ucw.cz \
/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.