mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 05:55:44 +02:00
power: supply: cpcap-charger: Fix power_supply_put on null battery pointer
[ Upstream commit39196cfe10] Currently if the pointer battery is null there is a null pointer dereference on the call to power_supply_put. Fix this by only performing the put if battery is not null. Addresses-Coverity: ("Dereference after null check") Fixes:4bff91bb32("power: supply: cpcap-charger: Fix missing power_supply_put()") Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
1f61337492
commit
3f93f17ae9
|
|
@ -301,8 +301,9 @@ cpcap_charger_get_bat_const_charge_voltage(struct cpcap_charger_ddata *ddata)
|
|||
&prop);
|
||||
if (!error)
|
||||
voltage = prop.intval;
|
||||
|
||||
power_supply_put(battery);
|
||||
}
|
||||
power_supply_put(battery);
|
||||
|
||||
return voltage;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user