Skip to content

Commit

Permalink
drivers/serial: check the remote device before get name
Browse files Browse the repository at this point in the history
| #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
| #3 0x21181d7 in rptun_do_ioctl rptun/rptun.c:922
| #4 0x2119721 in rptun_ioctl_foreach rptun/rptun.c:1086

Signed-off-by: chao an <[email protected]>
  • Loading branch information
anchao committed Nov 6, 2023
1 parent cc6b95f commit 9ceca15
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 @@ -339,7 +339,8 @@ static void uart_rpmsg_device_destroy(FAR struct rpmsg_device *rdev,
FAR struct uart_dev_s *dev = priv_;
FAR struct uart_rpmsg_priv_s *priv = dev->priv;

if (strcmp(priv->cpuname, rpmsg_get_cpuname(rdev)) == 0)
if (priv->ept.priv != NULL &&
strcmp(priv->cpuname, rpmsg_get_cpuname(rdev)) == 0)
{
rpmsg_destroy_ept(&priv->ept);
}
Expand Down

0 comments on commit 9ceca15

Please sign in to comment.