You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2021/02/11 12:55:15 UTC

[GitHub] [mynewt-mcumgr] utzig commented on a change in pull request #108: mgmt: Add support for un-registering a group along with the same support in img_mgmt

utzig commented on a change in pull request #108:
URL: https://github.com/apache/mynewt-mcumgr/pull/108#discussion_r574476913



##########
File path: mgmt/src/mgmt.c
##########
@@ -71,6 +71,31 @@ mgmt_streamer_free_buf(struct mgmt_streamer *streamer, void *buf)
     streamer->cfg->free_buf(buf, streamer->cb_arg);
 }
 
+void
+mgmt_unregister_group(struct mgmt_group *group)
+{
+    struct mgmt_group *curr = mgmt_group_list, *prev;
+
+    if (curr && curr == group) {

Review comment:
       There is no need to test `curr` here because if it is NULL it won't be equal to `group`

##########
File path: mgmt/src/mgmt.c
##########
@@ -71,6 +71,31 @@ mgmt_streamer_free_buf(struct mgmt_streamer *streamer, void *buf)
     streamer->cfg->free_buf(buf, streamer->cb_arg);
 }
 
+void
+mgmt_unregister_group(struct mgmt_group *group)
+{
+    struct mgmt_group *curr = mgmt_group_list, *prev;

Review comment:
       Please check that `group` is not NULL

##########
File path: mgmt/src/mgmt.c
##########
@@ -71,6 +71,31 @@ mgmt_streamer_free_buf(struct mgmt_streamer *streamer, void *buf)
     streamer->cfg->free_buf(buf, streamer->cb_arg);
 }
 
+void
+mgmt_unregister_group(struct mgmt_group *group)
+{
+    struct mgmt_group *curr = mgmt_group_list, *prev;
+
+    if (curr && curr == group) {
+        mgmt_group_list = curr->mg_next;
+        return;
+    }
+
+    while (curr && curr != group) {
+        prev = curr;

Review comment:
       If `curr` is valid and equal to `group`, `prev` will remain uninitialized.




----------------------------------------------------------------
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.

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