]> git.baikalelectronics.ru Git - kernel.git/commit
power: supply: max17040: handle device_property_read_u8_array() failure
authorKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Mon, 19 Apr 2021 16:33:33 +0000 (18:33 +0200)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Tue, 20 Apr 2021 14:18:08 +0000 (16:18 +0200)
commit27b49381d881510ce75a58ca12a7e68df836c9c4
tree42973736890a4cd2dfcd7e3f605575de61723bed
parente68a3f6385798563f0760a4c71151d6bacc7595d
power: supply: max17040: handle device_property_read_u8_array() failure

The device_property_read_u8_array() call should not fail because it is
preceded with device_property_count_u8() and check for number of
readable u8 values.  However the code is more obvious and easier to read
if the return value of device_property_read_u8_array() is checked.
Otherwise reader needs to investigate whether really there is no risk of
using random stack values of 'rcomp' variable.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/max17040_battery.c