Skip to contentSkip to conversation

power_supply: Add support for TI BQ25890 charger chip

DISCUSSION Dan Carpenter 2 participants 3 messages May 26, 2015 – May 27, 2015 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hello Laurentiu Palcu,

The patch 4aeae9cb0dad: "power_supply: Add support for TI BQ25890 charger chip" from May 19, 2015, leads to the following static checker warning:

	drivers/power/bq25890_charger.c:843 bq25890_probe()
	warn: impossible condition '(bq->chip_id < 0) => (0-255 < 0)'

drivers/power/bq25890_charger.c
841
842 bq->chip_id = bq25890_field_read(bq, F_PN);

   843          if (bq->chip_id < 0) {
                    ^^^^^^^^^^^^^^^

Never true.

   844                  dev_err(dev, "Cannot read chip ID.\n");
   845                  return ret;
   846          }
   847  

regards,
dan carpenter

A message that is not in the archive (sent off-list or not yet received): CAD03FC+H0JQUR32eGLrVWe_OaiiMTxUmCxdBwuWnPwMRz8XSOQ@mail.gmail.com

#2 lore raw

Hi,

Quoted 14 lines · Laurentiu Palcu
Quoted 7 lines · Dan Carpenter

The patch 4aeae9cb0dad: "power_supply: Add support for TI BQ25890 charger chip" from May 19, 2015, leads to the following static checker warning:

        drivers/power/bq25890_charger.c:843 bq25890_probe()
        warn: impossible condition '(bq->chip_id < 0) => (0-255 < 0)'
Quoted 6 lines

drivers/power/bq25890_charger.c
841

   842          bq->chip_id = bq25890_field_read(bq, F_PN);
   843          if (bq->chip_id < 0) {
                    ^^^^^^^^^^^^^^^

Never true.

Quoted 6 lines

Damn it... :/ I totally missed this. Thanks for catching it. chip_id should be int... Out of curiosity, what static checker did you use?

Sebastian, do you prefer another patch revision or just a separate patch with the fix? Either way, it'll probably be early next week since I'm travelling this one.

Please send a separate patch.

-- Sebastian

#3 lore raw
In reply to a message not in the archive
Quoted 13 lines · Laurentiu Palcu

Hi Dan,

Quoted 10 lines · Dan Carpenter

Hello Laurentiu Palcu,

The patch 4aeae9cb0dad: "power_supply: Add support for TI BQ25890 charger chip" from May 19, 2015, leads to the following static checker warning:

        drivers/power/bq25890_charger.c:843 bq25890_probe()
        warn: impossible condition '(bq->chip_id < 0) => (0-255 < 0)'
Quoted 8 lines
Quoted 6 lines

drivers/power/bq25890_charger.c
841

   842          bq->chip_id = bq25890_field_read(bq, F_PN);
   843          if (bq->chip_id < 0) {
                    ^^^^^^^^^^^^^^^

Never true.

Damn it... :/ I totally missed this. Thanks for catching it. chip_id should be int... Out of curiosity, what static checker did you use?

This was a Smatch warning.

regards,
dan carpenter