Skip to content

Commit

Permalink
rpmsg: zero out rdev field in rpmsg_unregister_endpoint
Browse files Browse the repository at this point in the history
so is_rpmsg_ept_ready can check the validity more easier

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
  • Loading branch information
xiaoxiang781216 authored and arnopo committed May 29, 2020
1 parent be5b3b3 commit 94ca6c2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 1 addition & 2 deletions lib/include/openamp/rpmsg.h
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,7 @@ void rpmsg_destroy_ept(struct rpmsg_endpoint *ept);
*/
static inline unsigned int is_rpmsg_ept_ready(struct rpmsg_endpoint *ept)
{
return (ept->dest_addr != RPMSG_ADDR_ANY) &&
(ept->addr != RPMSG_ADDR_ANY);
return ept && ept->rdev && ept->dest_addr != RPMSG_ADDR_ANY;
}

#if defined __cplusplus
Expand Down
1 change: 1 addition & 0 deletions lib/rpmsg/rpmsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ static void rpmsg_unregister_endpoint(struct rpmsg_endpoint *ept)
rpmsg_release_address(rdev->bitmap, RPMSG_ADDR_BMP_SIZE,
ept->addr);
metal_list_del(&ept->node);
ept->rdev = NULL;
metal_mutex_release(&rdev->lock);
}

Expand Down

0 comments on commit 94ca6c2

Please sign in to comment.