Skip to content

Commit

Permalink
shouldn't send RPMSG_NS_DESTROY if endpoint name is empty
Browse files Browse the repository at this point in the history
and support rpmsg_create_ept with name == NULL

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
  • Loading branch information
xiaoxiang781216 authored and Wendy Liang committed Mar 3, 2019
1 parent 66cf86d commit 83f2b72
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/include/openamp/rpmsg.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ static inline void rpmsg_init_ept(struct rpmsg_endpoint *ept,
rpmsg_ept_cb cb,
rpmsg_ns_unbind_cb ns_unbind_cb)
{
strncpy(ept->name, name, sizeof(ept->name));
strncpy(ept->name, name ? name : "", sizeof(ept->name));
ept->addr = src;
ept->dest_addr = dest;
ept->cb = cb;
Expand Down
2 changes: 1 addition & 1 deletion lib/rpmsg/rpmsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ void rpmsg_destroy_ept(struct rpmsg_endpoint *ept)
return;

rdev = ept->rdev;
if (rdev->support_ns && ept->addr != RPMSG_NS_EPT_ADDR)
if (ept->name[0] && rdev->support_ns && ept->addr != RPMSG_NS_EPT_ADDR)
(void)rpmsg_send_ns_message(ept, RPMSG_NS_DESTROY);
metal_mutex_acquire(&rdev->lock);
rpmsg_unregister_endpoint(ept);
Expand Down

0 comments on commit 83f2b72

Please sign in to comment.