You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/07/30 09:19:51 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6743: drivers/battery: Handle the early changed event correctly

xiaoxiang781216 commented on code in PR #6743:
URL: https://github.com/apache/incubator-nuttx/pull/6743#discussion_r933777415


##########
drivers/power/battery_charger.c:
##########
@@ -467,6 +467,16 @@ int battery_charger_changed(FAR struct battery_charger_dev_s *dev,
   FAR struct battery_charger_priv_s *priv;
   int ret;
 
+  /* Event happen too early? */
+
+  if (list_is_clear(&dev->flist))
+    {
+      /* Yes, record it and return directly */
+
+      dev->mask |= mask;
+      return 0;
+    }

Review Comment:
   The event may happen before sem init here:
   https://github.com/apache/incubator-nuttx/pull/6743/files#diff-9c5e91482c4b38cddc223ab7acef3639e13889d6660b8409caec591e74df2aa9R521
   This is the root cause to make this change to avoid the thread blocking forever.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org