rpmsg_ping:only sleep when ping->sleep is larger than 0

To avoid call sleep when sleep <= 0

Signed-off-by: liaoao <liaoao@xiaomi.com>
This commit is contained in:
liaoao 2024-05-10 15:11:16 +08:00 committed by archer
parent c84409a2cd
commit 58c9c23765
1 changed files with 6 additions and 2 deletions

View File

@ -84,7 +84,8 @@ static int rpmsg_ping_ept_cb(FAR struct rpmsg_endpoint *ept,
{ {
if (msg->data[i] != RPMSG_PING_CHECK_DATA) if (msg->data[i] != RPMSG_PING_CHECK_DATA)
{ {
syslog(LOG_ERR, "rptun ping remote receive data error!\n"); syslog(LOG_ERR, "receive data error at %zu of %zu\n",
i, data_len);
break; break;
} }
@ -233,7 +234,10 @@ int rpmsg_ping(FAR struct rpmsg_endpoint *ept,
max = MAX(max, tm); max = MAX(max, tm);
total += tm; total += tm;
nxsig_usleep(ping->sleep * USEC_PER_MSEC); if (ping->sleep > 0)
{
nxsig_usleep(ping->sleep * USEC_PER_MSEC);
}
} }
syslog(LOG_INFO, "ping times: %d\n", ping->times); syslog(LOG_INFO, "ping times: %d\n", ping->times);