linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] leds: lm36274: remove redundant initialization of variable ret
@ 2019-06-12 14:56 Colin King
  2019-06-12 15:18 ` walter harms
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2019-06-12 14:56 UTC (permalink / raw)
  To: Dan Murphy, Jacek Anaszewski, Pavel Machek, linux-leds,
	linux-kernel
  Cc: kernel-janitors

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),
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH][next] leds: lm36274: remove redundant initialization of variable ret
  2019-06-12 14:56 [PATCH][next] leds: lm36274: remove redundant initialization of variable ret Colin King
@ 2019-06-12 15:18 ` walter harms
  0 siblings, 0 replies; 2+ messages in thread
From: walter harms @ 2019-06-12 15:18 UTC (permalink / raw)
  To: Colin King
  Cc: Dan Murphy, Jacek Anaszewski, Pavel Machek, linux-leds,
	linux-kernel, kernel-janitors



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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-12 15:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-12 14:56 [PATCH][next] leds: lm36274: remove redundant initialization of variable ret Colin King
2019-06-12 15:18 ` walter harms

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).