power: supply: bq256xx: fix some problem in bq256xx_hw_init
authorSu Hui <suhui@nfschina.com>
Thu, 16 Nov 2023 04:18:23 +0000 (12:18 +0800)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Thu, 16 Nov 2023 19:23:41 +0000 (20:23 +0100)
commitb55d073e6501dc6077edaa945a6dad8ac5c8bbab
tree7af89c457802b7b9ad2a7c4ac807c04e222fea5b
parent054eb2377523530404fb64c24c8747feb022c5b4
power: supply: bq256xx: fix some problem in bq256xx_hw_init

smatch complains that there is a buffer overflow and clang complains
'ret' is never read.

Smatch error:
drivers/power/supply/bq256xx_charger.c:1578 bq256xx_hw_init() error:
buffer overflow 'bq256xx_watchdog_time' 4 <= 4

Clang static checker:
Value stored to 'ret' is never read.

Add check for buffer overflow and error code from regmap_update_bits().

Fixes: 32e4978bb920 ("power: supply: bq256xx: Introduce the BQ256XX charger driver")
Signed-off-by: Su Hui <suhui@nfschina.com>
Link: https://lore.kernel.org/r/20231116041822.1378758-1-suhui@nfschina.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/bq256xx_charger.c