All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: ncase@xes-inc.com, linux-leds@vger.kernel.org
Subject: Re: [bug report] leds: Add support for Philips PCA955x I2C LED drivers
Date: Thu, 17 Aug 2017 13:28:29 +0200	[thread overview]
Message-ID: <20170817112829.GB19377@amd> (raw)
In-Reply-To: <20170817102847.n4h5ez6zlfclkcjs@mwanda>

[-- Attachment #1: Type: text/plain, Size: 2404 bytes --]

On Thu 2017-08-17 13:28:47, Dan Carpenter wrote:
> Hello Nate Case,
> 
> The patch f46e9203d9a1: "leds: Add support for Philips PCA955x I2C
> LED drivers" from Jul 16, 2008, leads to the following static checker
> warning:
> 
> 	drivers/leds/leds-pca955x.c:476 pca955x_probe()
> 	warn: this array is probably non-NULL. 'pdata->leds + i->name'
> 
> drivers/leds/leds-pca955x.c
>    465                  switch (pca955x_led->type) {
>    466                  case PCA955X_TYPE_NONE:
>    467                          break;
>    468                  case PCA955X_TYPE_GPIO:
>    469                          ngpios++;
>    470                          break;
>    471                  case PCA955X_TYPE_LED:
>    472                          /*
>    473                           * Platform data can specify LED names and
>    474                           * default triggers
>    475                           */
>    476                          if (pdata->leds[i].name)
>                                     ^^^^^^^^^^^^^^^^^^^
> The comment implies that we should be testing pdata->leds[i].name[0] to
> see if any string has been set?
> 

From: Colin King <colin.king@canonical.com>
To: Richard Purdie <rpurdie@rpsys.net>, Jacek Anaszewski
<jacek.anaszewski@gmail.com>, Pavel
        Machek <pavel@ucw.cz>, linux-leds@vger.kernel.org
	Cc: kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
	Subject: [PATCH][leds-next] leds: pca955x: remove redundant
	null check on array name
	X-Mailer: git-send-email 2.11.0

From: Colin Ian King <colin.king@canonical.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@canonical.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,

									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

      parent reply	other threads:[~2017-08-17 11:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-17 10:28 [bug report] leds: Add support for Philips PCA955x I2C LED drivers Dan Carpenter
2017-08-17 11:27 ` Pavel Machek
2017-08-17 11:51   ` Dan Carpenter
2017-08-17 13:27     ` Pavel Machek
2017-08-17 13:37       ` Dan Carpenter
2017-08-17 13:43         ` Dan Carpenter
2017-08-17 13:49           ` Dan Carpenter
2017-08-17 13:58             ` Pavel Machek
2017-08-17 13:58     ` Nate Case
2017-08-17 14:01       ` Dan Carpenter
2017-08-17 11:28 ` Pavel Machek [this message]

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=20170817112829.GB19377@amd \
    --to=pavel@ucw.cz \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-leds@vger.kernel.org \
    --cc=ncase@xes-inc.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 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.