[PATCH 1/5] power: supply: bd71815: Fix temperature reading
Matti Vaittinen <[email protected]>
| Newsgroups | org.kernel.vger.linux-pm,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <4ae3dfa7fc80372977fd29c837321f96d551bf6f.1786356145.git.mazziesaccount@gmail.com> |
From: Matti Vaittinen <[email protected]> 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 <[email protected]> Fixes: 5bff79dad20a ("power: supply: Add bd718(15/28/78) charger driver") --- drivers/power/supply/bd71828-power.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/power/supply/bd71828-power.c b/drivers/power/supply/bd71828-power.c index b671563ead79..e1ae5fe52e1d 100644 --- a/drivers/power/supply/bd71828-power.c +++ b/drivers/power/supply/bd71828-power.c @@ -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; } -- 2.55.0
signature.asc
(application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmp5ozIACgkQeFA3/03a ocV9YQf8CLDbHJPBz8vpbr529zmDRfanqifT+ZAwCSeDcpcTh2zFiuzNOZJjkjN+ 0F6RO6RMiQar2DepGjbtgzg9Xd9cUT31CLZxVJgwKj2yR3BzDCnYX5N/FwaFkWu3 OiLdBD2PYzrfJfG+zH/rhOT6+bag0FE/Jxs5feqnmFkov+nIZhCjKSCWD530JmnF DCE+/Gpaq2XbKrmWK+ZV9HcMGJ6swJkudjHudtAnSxm1pjqY/QRoHqYUbLZjm1ru I2F/0AeAp6IOHwoyHuYYf6l+kBJx5afo/o2BCMKC0C8BNbJlWM1uB/3vMY/y1pJ1 onjVwD5krcCXc1t7AhTwCxY8gLwLLw== =XESO -----END PGP SIGNATURE-----