From 3de253359947f3b19920c75bfcc82043e658d89e Mon Sep 17 00:00:00 2001 From: Alan Carvalho de Assis Date: Fri, 4 Jan 2019 10:27:49 -0600 Subject: [PATCH] drivers/power/battery_gauge.c: Add missing initialization of semaphore. drivers/power/battery_charger.c: Add missing initialization of semaphore. --- drivers/power/battery_charger.c | 4 ++++ drivers/power/battery_gauge.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/drivers/power/battery_charger.c b/drivers/power/battery_charger.c index 5467f49093..70f707aa7b 100644 --- a/drivers/power/battery_charger.c +++ b/drivers/power/battery_charger.c @@ -285,6 +285,10 @@ int battery_charger_register(FAR const char *devpath, { int ret; + /* Initialize the semaphore */ + + nxsem_init(&dev->batsem, 0, 1); + /* Register the character driver */ ret = register_driver(devpath, &g_batteryops, 0555, dev); diff --git a/drivers/power/battery_gauge.c b/drivers/power/battery_gauge.c index 9936147be1..63b59092a9 100644 --- a/drivers/power/battery_gauge.c +++ b/drivers/power/battery_gauge.c @@ -248,6 +248,10 @@ int battery_gauge_register(FAR const char *devpath, { int ret; + /* Initialize the semaphore */ + + nxsem_init(&dev->batsem, 0, 1); + /* Register the character driver */ ret = register_driver(devpath, &g_batteryops, 0555, dev);