[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20170816120105.1963-1-colin.king@canonical.com>
Date: Wed, 16 Aug 2017 13:01:05 +0100
From: Colin King <colin.king@...onical.com>
To: Richard Purdie <rpurdie@...ys.net>,
Jacek Anaszewski <jacek.anaszewski@...il.com>,
Pavel Machek <pavel@....cz>, linux-leds@...r.kernel.org
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH][leds-next] leds: pca955x: remove redundant null check on array name
From: Colin Ian King <colin.king@...onical.com>
The check to see if pdata-leds[i].name is redundant as name is
a 32 byte char array and hence can never be null. Remove the
redundant check.
Detected by CoverityScan, CID#1454218 ("Array compared against 0")
Signed-off-by: Colin Ian King <colin.king@...onical.com>
---
drivers/leds/leds-pca955x.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/leds/leds-pca955x.c b/drivers/leds/leds-pca955x.c
index f062d1e7640f..b12b7ea51867 100644
--- a/drivers/leds/leds-pca955x.c
+++ b/drivers/leds/leds-pca955x.c
@@ -473,10 +473,9 @@ static int pca955x_probe(struct i2c_client *client,
* Platform data can specify LED names and
* default triggers
*/
- if (pdata->leds[i].name)
- snprintf(pca955x_led->name,
- sizeof(pca955x_led->name), "pca955x:%s",
- pdata->leds[i].name);
+ snprintf(pca955x_led->name,
+ sizeof(pca955x_led->name), "pca955x:%s",
+ pdata->leds[i].name);
if (pdata->leds[i].default_trigger)
pca955x_led->led_cdev.default_trigger =
pdata->leds[i].default_trigger;
--
2.11.0
Powered by blists - more mailing lists