[bug report] leds: pca955x: Add ACPI support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe linux-leds" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux