mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
power: supply: bd71815: Fix temperature reading
The temperature read from the hardware is never returned to caller.
Furthermore, the check for temperature validity is wrong. This yields
garbage value to be returned to caller, and also detection of
bad values read from hardware to fail.
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Fixes: 5bff79dad2 ("power: supply: Add bd718(15/28/78) charger driver")
Tested-by: Kalle Niemi <kaleposti@gmail.com>
Link: https://patch.msgid.link/4ae3dfa7fc80372977fd29c837321f96d551bf6f.1786356145.git.mazziesaccount@gmail.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This commit is contained in:
parent
99b38cda3f
commit
c15f0eabec
|
|
@ -225,13 +225,13 @@ static int bd71815_get_temp(struct bd71828_power *pwr, int *temp)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
t = 200 - t;
|
||||
|
||||
if (t > 200) {
|
||||
dev_err(pwr->dev, "Failed to read battery temperature\n");
|
||||
return -ENODATA;
|
||||
}
|
||||
|
||||
*temp = 200 - t;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user