[PATCH][leds-next] leds: pca955x: remove redundant null check on array name

From: Colin King
Date: Wed Aug 16 2017 - 08:01:16 EST


From: Colin Ian King <colin.king@xxxxxxxxxxxxx>

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@xxxxxxxxxxxxx>
---
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