Skip to content

Commit

Permalink
drivers/net/rpmsgdrv.c: Improve init error handling
Browse files Browse the repository at this point in the history
Signed-off-by: Jani Paalijarvi <[email protected]>
  • Loading branch information
jpaali committed Sep 20, 2023
1 parent 28a2b2f commit 4579a77
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion drivers/net/rpmsgdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1145,14 +1145,30 @@ int net_rpmsg_drv_init(FAR const char *cpuname,

/* Register the device with the openamp */

rpmsg_register_callback(dev,
ret = rpmsg_register_callback(dev,
net_rpmsg_drv_device_created,
net_rpmsg_drv_device_destroy,
NULL,
NULL);

if (ret < 0)
{
kmm_free(priv);
return ret;
}

/* Register the device with the OS so that socket IOCTLs can be performed */

ret = netdev_register(dev, lltype);
if (ret < 0)
{
rpmsg_unregister_callback(dev,
net_rpmsg_drv_device_created,
net_rpmsg_drv_device_destroy,
NULL,
NULL);
kmm_free(priv);
}

return ret;
}

0 comments on commit 4579a77

Please sign in to comment.