From a662c7aab3d45255cfaf4e86e34464032ee236c1 Mon Sep 17 00:00:00 2001 From: Bowen Wang Date: Tue, 4 Jun 2024 22:14:45 +0800 Subject: [PATCH] rpmsg/rpmsg_port: judge notify_rx_free and notify_tx_ready before calling Some lower layers do not need implement these two operations, so judge them before calling. Signed-off-by: Bowen Wang --- drivers/rpmsg/rpmsg_port.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/rpmsg/rpmsg_port.c b/drivers/rpmsg/rpmsg_port.c index 5668aecd7e..75483c73c1 100644 --- a/drivers/rpmsg/rpmsg_port.c +++ b/drivers/rpmsg/rpmsg_port.c @@ -281,7 +281,10 @@ static int rpmsg_port_send_offchannel_nocopy(FAR struct rpmsg_device *rdev, sizeof(struct rpmsg_hdr) + len; rpmsg_port_queue_add_buffer(&port->txq, hdr); - port->ops->notify_tx_ready(port); + if (port->ops->notify_tx_ready) + { + port->ops->notify_tx_ready(port); + } return len; } @@ -340,7 +343,10 @@ static void rpmsg_port_release_rx_buffer(FAR struct rpmsg_device *rdev, if ((reserved & RPMSG_BUF_HELD_MASK) == (1 << RPMSG_BUF_HELD_SHIFT)) { rpmsg_port_queue_return_buffer(&port->rxq, hdr); - port->ops->notify_rx_free(port); + if (port->ops->notify_rx_free) + { + port->ops->notify_rx_free(port); + } } }