mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
HID: input: Fix NULL pointer dereference when power_supply_register fails
Do not call power_supply_powers() if power_supply_register() failed earlier. This fixes possible NULL pointer dereference by power_supply_powers() in such case. Signed-off-by: Krzysztof Kozlowski <[email protected]> Reported-by: Dan Carpenter <[email protected]> Acked-by: Jiri Kosina <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
This commit is contained in:
parent
8fb0885504
commit
fbea947c7d
1 changed files with 2 additions and 2 deletions
|
|
@ -452,10 +452,10 @@ static bool hidinput_setup_battery(struct hid_device *dev, unsigned report_type,
|
|||
kfree(psy_desc->name);
|
||||
kfree(psy_desc);
|
||||
dev->battery = NULL;
|
||||
} else {
|
||||
power_supply_powers(dev->battery, &dev->dev);
|
||||
}
|
||||
|
||||
power_supply_powers(dev->battery, &dev->dev);
|
||||
|
||||
out:
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue