linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] leds: Add support for Philips PCA955x I2C LED drivers
@ 2017-08-17 10:28 Dan Carpenter
  2017-08-17 11:27 ` Pavel Machek
  2017-08-17 11:28 ` Pavel Machek
  0 siblings, 2 replies; 11+ messages in thread
From: Dan Carpenter @ 2017-08-17 10:28 UTC (permalink / raw)
  To: ncase; +Cc: linux-leds

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?

   477                                  snprintf(pca955x_led->name,
   478                                          sizeof(pca955x_led->name), "pca955x:%s",
   479                                          pdata->leds[i].name);
   480                          if (pdata->leds[i].default_trigger)
   481                                  pca955x_led->led_cdev.default_trigger =
   482                                          pdata->leds[i].default_trigger;
   483  
   484                          pca955x_led->led_cdev.name = pca955x_led->name;
   485                          pca955x_led->led_cdev.brightness_set_blocking =
   486                                  pca955x_led_set;
   487  
   488                          err = devm_led_classdev_register(&client->dev,
   489                                                          &pca955x_led->led_cdev);
   490                          if (err)
   491                                  return err;
   492  
   493                          /* Turn off LED */
   494                          pca955x_led_set(&pca955x_led->led_cdev, LED_OFF);

regards,
dan carpenter

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

end of thread, other threads:[~2017-08-17 14:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).