Skip to content

Commit 85a375c

Browse files
anchaoxiaoxiang781216
authored andcommitted
drivers/serial: check the remote device before get name
| #0 0x2119bf1 in rpmsg_get_cpuname rptun/rptun.c:1157 | #1 0x24f97bd in uart_rpmsg_device_destroy serial/uart_rpmsg.c:342 | #2 0x2117d56 in rptun_dev_stop rptun/rptun.c:883 | apache#3 0x21181d7 in rptun_do_ioctl rptun/rptun.c:922 | apache#4 0x2119721 in rptun_ioctl_foreach rptun/rptun.c:1086 Signed-off-by: chao an <anchao@xiaomi.com>
1 parent 93ff6f9 commit 85a375c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/serial/uart_rpmsg.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,8 @@ static void uart_rpmsg_device_destroy(FAR struct rpmsg_device *rdev,
339339
FAR struct uart_dev_s *dev = priv_;
340340
FAR struct uart_rpmsg_priv_s *priv = dev->priv;
341341

342-
if (strcmp(priv->cpuname, rpmsg_get_cpuname(rdev)) == 0)
342+
if (priv->ept.priv != NULL &&
343+
strcmp(priv->cpuname, rpmsg_get_cpuname(rdev)) == 0)
343344
{
344345
rpmsg_destroy_ept(&priv->ept);
345346
}

0 commit comments

Comments
 (0)