linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: tnhuynh@apm.com
Cc: linux-leds@vger.kernel.org
Subject: [bug report] leds: pca955x: Add ACPI support
Date: Thu, 1 Dec 2016 23:12:12 +0300	[thread overview]
Message-ID: <20161201201212.GA4015@mwanda> (raw)

Hello Tin Huynh,

This is a semi-automatic email about new static checker warnings.

The patch f00662b45979: "leds: pca955x: Add ACPI support" from Nov 
30, 2016, leads to the following Smatch complaint:

drivers/leds/leds-pca955x.c:284 pca955x_probe()
	 error: we previously assumed 'id' could be null (see line 263)

drivers/leds/leds-pca955x.c
   262	
   263		if (id) {
                   ^^^^
We added a new NULL check.

   264			chip = &pca955x_chipdefs[id->driver_data];
   265		} else {
   266			const struct acpi_device_id *acpi_id;
   267	
   268			acpi_id = acpi_match_device(pca955x_acpi_ids, &client->dev);
   269			if (!acpi_id)
   270				return -ENODEV;
   271			chip = &pca955x_chipdefs[acpi_id->driver_data];
   272		}
   273		adapter = to_i2c_adapter(client->dev.parent);
   274		pdata = dev_get_platdata(&client->dev);
   275	
   276		/* Make sure the slave address / chip type combo given is possible */
   277		if ((client->addr & ~((1 << chip->slv_addr_shift) - 1)) !=
   278		    chip->slv_addr) {
   279			dev_err(&client->dev, "invalid slave address %02x\n",
   280					client->addr);
   281			return -ENODEV;
   282		}
   283	
   284		dev_info(&client->dev, "leds-pca955x: Using %s %d-bit LED driver at "
   285				"slave address 0x%02x\n",
   286				id->name, chip->bits, client->addr);
                                ^^^^^^^^^
But the old code assumed "id" was non-NULL.

regards,
dan carpenter

                 reply	other threads:[~2016-12-01 20:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20161201201212.GA4015@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-leds@vger.kernel.org \
    --cc=tnhuynh@apm.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 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).