power: supply: bq25890_charger: fix incorrect error return when bq25890_field_read fails

Currently a read failure by bq25890_field_read on F_DEV_REV is returning
an error in id instead of rev. Fix this by returning the value in rev.

Addresses-Coverity: ("Copy-paste error")
Fixes: d20267c9a9 ("power: supply: bq25890_charger: Add support of BQ25892 and BQ25896 chips")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This commit is contained in:
Colin Ian King 2020-01-16 17:09:00 +00:00 committed by Sebastian Reichel
parent bcfb7ae3f5
commit cb619e8033
1 changed files with 1 additions and 1 deletions

View File

@ -765,7 +765,7 @@ static int bq25890_get_chip_version(struct bq25890_device *bq)
rev = bq25890_field_read(bq, F_DEV_REV);
if (rev < 0) {
dev_err(bq->dev, "Cannot read chip revision.\n");
return id;
return rev;
}
switch (id) {