drivers/net/rpmsgdrv.c: Improve init error handling
Signed-off-by: Jani Paalijarvi <jani.paalijarvi@unikie.com>
This commit is contained in:
parent
999970b820
commit
c8540a1f9b
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue