mirror of
https://github.com/apache/nuttx.git
synced 2026-05-22 13:52:22 +08:00
charger: fix crash when notify without pollwaiter
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
@@ -99,12 +99,17 @@ static const struct file_operations g_batteryops =
|
||||
****************************************************************************/
|
||||
|
||||
static int battery_charger_notify(FAR struct battery_charger_priv_s *priv,
|
||||
uint32_t mask)
|
||||
uint32_t mask)
|
||||
{
|
||||
FAR struct pollfd *fd = priv->fds;
|
||||
int semcnt;
|
||||
int ret;
|
||||
|
||||
if (!fd)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
ret = nxsem_wait_uninterruptible(&priv->lock);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
||||
@@ -101,12 +101,17 @@ static const struct file_operations g_batteryops =
|
||||
****************************************************************************/
|
||||
|
||||
static int battery_gauge_notify(FAR struct battery_gauge_priv_s *priv,
|
||||
uint32_t mask)
|
||||
uint32_t mask)
|
||||
{
|
||||
FAR struct pollfd *fd = priv->fds;
|
||||
int semcnt;
|
||||
int ret;
|
||||
|
||||
if (!fd)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
ret = nxsem_wait_uninterruptible(&priv->lock);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
||||
@@ -100,12 +100,17 @@ static const struct file_operations g_batteryops =
|
||||
****************************************************************************/
|
||||
|
||||
static int battery_monitor_notify(FAR struct battery_monitor_priv_s *priv,
|
||||
uint32_t mask)
|
||||
uint32_t mask)
|
||||
{
|
||||
FAR struct pollfd *fd = priv->fds;
|
||||
int semcnt;
|
||||
int ret;
|
||||
|
||||
if (!fd)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
ret = nxsem_wait_uninterruptible(&priv->lock);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user