rptun.c: fix rptun.c format follow rpmsg virtio

optimization rptun.c format

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
This commit is contained in:
Yongrong Wang 2024-03-05 19:17:33 +08:00 committed by Xiang Xiao
parent 91e341dbda
commit 122a832feb

View File

@ -975,7 +975,7 @@ int rptun_initialize(FAR struct rptun_dev_s *dev)
FAR struct rptun_priv_s *priv;
static bool onceinit = false;
FAR char *argv[3];
char arg1[19];
char arg1[32];
char name[32];
int ret;
@ -993,11 +993,12 @@ int rptun_initialize(FAR struct rptun_dev_s *dev)
priv = kmm_zalloc(sizeof(struct rptun_priv_s));
if (priv == NULL)
{
ret = -ENOMEM;
goto err_mem;
return -ENOMEM;
}
priv->dev = dev;
nxsem_init(&priv->semtx, 0, 0);
nxsem_init(&priv->semrx, 0, 0);
remoteproc_init(&priv->rproc, &g_rptun_ops, priv);
@ -1008,10 +1009,8 @@ int rptun_initialize(FAR struct rptun_dev_s *dev)
goto err_driver;
}
nxsem_init(&priv->semtx, 0, 0);
nxsem_init(&priv->semrx, 0, 0);
snprintf(arg1, sizeof(arg1), "0x%" PRIxPTR, (uintptr_t)priv);
argv[0] = (FAR void *)RPTUN_GET_CPUNAME(dev);
snprintf(arg1, sizeof(arg1), "%p", priv);
argv[0] = (FAR char *)RPTUN_GET_CPUNAME(dev);
argv[1] = arg1;
argv[2] = NULL;
@ -1032,10 +1031,10 @@ err_thread:
rpmsg_unregister(name, &priv->rpmsg);
err_driver:
nxsem_destroy(&priv->semtx);
nxsem_destroy(&priv->semrx);
kmm_free(priv);
err_mem:
metal_finish();
return ret;
}