diff --git a/lib/include/openamp/rpmsg.h b/lib/include/openamp/rpmsg.h index bc05505a8..3e786e6db 100644 --- a/lib/include/openamp/rpmsg.h +++ b/lib/include/openamp/rpmsg.h @@ -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; diff --git a/lib/rpmsg/rpmsg.c b/lib/rpmsg/rpmsg.c index e8bb39751..5b9c735a8 100644 --- a/lib/rpmsg/rpmsg.c +++ b/lib/rpmsg/rpmsg.c @@ -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);