mirror of
https://github.com/apache/nuttx.git
synced 2026-10-07 14:25:25 +00:00
charger: fix crash when notify without pollwaiter
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
68bbcf74c4
commit
8b0d45abef
3 changed files with 18 additions and 3 deletions
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue