From ca26820ac18b8dc04ab5bc36e37d490d0b0e8b4c Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Thu, 26 Sep 2024 12:09:53 +0200 Subject: [PATCH] ipc: icmsg: Check return error of pbuf_rx_init() When pbuf_rx_init() was added, this caller did not check for a possibly returned error to not have more overhead than before using this function. Although unlikely let's check for a possible error (not configured Rx pbuf cfg). Signed-off-by: Alberto Escolar Piedras --- subsys/ipc/ipc_service/lib/icmsg.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/subsys/ipc/ipc_service/lib/icmsg.c b/subsys/ipc/ipc_service/lib/icmsg.c index 9de8a99ad58..f574e71ec14 100644 --- a/subsys/ipc/ipc_service/lib/icmsg.c +++ b/subsys/ipc/ipc_service/lib/icmsg.c @@ -273,11 +273,16 @@ int icmsg_open(const struct icmsg_config_t *conf, int ret = pbuf_tx_init(dev_data->tx_pb); if (ret < 0) { - __ASSERT(false, "Incorrect configuration"); + __ASSERT(false, "Incorrect Tx configuration"); return ret; } - (void)pbuf_rx_init(dev_data->rx_pb); + ret = pbuf_rx_init(dev_data->rx_pb); + + if (ret < 0) { + __ASSERT(false, "Incorrect Rx configuration"); + return ret; + } ret = pbuf_write(dev_data->tx_pb, magic, sizeof(magic));