summaryrefslogtreecommitdiffstats
path: root/drivers/power/power_supply_sysfs.c
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <k.kozlowski@samsung.com>2015-05-19 16:16:29 +0900
committerSebastian Reichel <sre@kernel.org>2015-05-23 20:06:19 +0200
commita9f6a19b57c4f37dfd6aa322071948245fecbd91 (patch)
tree8a9534550a92c9a0de9da18026d447bcc8e6eb06 /drivers/power/power_supply_sysfs.c
parent9f6cd98fc3c64ebcebf63c04f16246f79bcc4c70 (diff)
downloadblackbird-op-linux-a9f6a19b57c4f37dfd6aa322071948245fecbd91.tar.gz
blackbird-op-linux-a9f6a19b57c4f37dfd6aa322071948245fecbd91.zip
power_supply: Use wrappers to avoid races when registering power supply
Use wrappers over get_property() and set_property() internally in power supply and for sysfs interface. The wrappers provide safe access if power supply is not yet registered or t is being destroyed. In case of syfs the theoretical race could happen between ending of driver's probe and parallel sysfs access: some_driver_probe() userspace ==================================== =========================== drv->psy = power_supply_register() device_add() sysfs entries are created atomic_inc(&psy->use_cnt); store on sysfs attributes drv->set_property() dereference of drv->psy drv->psy = returned psy; For leds the race could happen between power supply being destroyed and ongoing power_supply_changed_work(). Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
Diffstat (limited to 'drivers/power/power_supply_sysfs.c')
-rw-r--r--drivers/power/power_supply_sysfs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c
index 9134e3d2d95e..af026806cba5 100644
--- a/drivers/power/power_supply_sysfs.c
+++ b/drivers/power/power_supply_sysfs.c
@@ -125,7 +125,7 @@ static ssize_t power_supply_store_property(struct device *dev,
value.intval = long_val;
- ret = psy->desc->set_property(psy, off, &value);
+ ret = power_supply_set_property(psy, off, &value);
if (ret < 0)
return ret;
OpenPOWER on IntegriCloud