power_supply: Add support for TI BQ25890 charger chip
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
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
841842 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_idshould 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
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
841842 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_idshould be int... Out of curiosity, what static checker did you use?
This was a Smatch warning.
regards,
dan carpenter