Skip to content

Commit

Permalink
serial/uart_rpmsg: should init the lock before call rpmsg_register_ca…
Browse files Browse the repository at this point in the history
…llback

To avoid init the lock after this lock has been used.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
  • Loading branch information
CV-Bowen authored and GUIDINGLI committed Oct 7, 2024
1 parent 262ccbb commit 79be76a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/serial/uart_rpmsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ int uart_rpmsg_init(FAR const char *cpuname, FAR const char *devname,
goto fail;
}

nxmutex_init(&priv->lock);
priv->cpuname = cpuname;
priv->devname = devname;

Expand All @@ -456,10 +457,10 @@ int uart_rpmsg_init(FAR const char *cpuname, FAR const char *devname,
NULL);
if (ret < 0)
{
nxmutex_destroy(&priv->lock);
goto fail;
}

nxmutex_init(&priv->lock);
snprintf(dev_name, sizeof(dev_name), "%s%s",
UART_RPMSG_DEV_PREFIX, devname);
uart_register(dev_name, dev);
Expand Down

0 comments on commit 79be76a

Please sign in to comment.