提交 23fa43a2 编写于 作者: L Laurentiu Palcu 提交者: Sebastian Reichel

power_supply: bq25890: make chip_id int

Smatch static checker correctly detected an impossible condition because
chip_id was declared as u8, instead of int:

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

Also, while at it, fix the return value too.
Signed-off-by: NLaurentiu Palcu <laurentiu.palcu@intel.com>
Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: NKrzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: NSebastian Reichel <sre@kernel.org>
上级 e86d69dd
...@@ -99,7 +99,7 @@ struct bq25890_device { ...@@ -99,7 +99,7 @@ struct bq25890_device {
struct regmap *rmap; struct regmap *rmap;
struct regmap_field *rmap_fields[F_MAX_FIELDS]; struct regmap_field *rmap_fields[F_MAX_FIELDS];
u8 chip_id; int chip_id;
struct bq25890_init_data init_data; struct bq25890_init_data init_data;
struct bq25890_state state; struct bq25890_state state;
...@@ -842,7 +842,7 @@ static int bq25890_probe(struct i2c_client *client, ...@@ -842,7 +842,7 @@ static int bq25890_probe(struct i2c_client *client,
bq->chip_id = bq25890_field_read(bq, F_PN); bq->chip_id = bq25890_field_read(bq, F_PN);
if (bq->chip_id < 0) { if (bq->chip_id < 0) {
dev_err(dev, "Cannot read chip ID.\n"); dev_err(dev, "Cannot read chip ID.\n");
return ret; return bq->chip_id;
} }
if (bq->chip_id != BQ25890_ID) { if (bq->chip_id != BQ25890_ID) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册