Commit b8f79dcc authored by Yuan Can's avatar Yuan Can Committed by David S. Miller

net: net_netdev: Fix error handling in ntb_netdev_init_module()

The ntb_netdev_init_module() returns the ntb_transport_register_client()
directly without checking its return value, if
ntb_transport_register_client() failed, the NTB client device is not
unregistered.

Fix by unregister NTB client device when ntb_transport_register_client()
failed.

Fixes: 548c237c ("net: Add support for NTB virtual ethernet device")
Signed-off-by: default avatarYuan Can <yuancan@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 46fb6512
......@@ -484,7 +484,14 @@ static int __init ntb_netdev_init_module(void)
rc = ntb_transport_register_client_dev(KBUILD_MODNAME);
if (rc)
return rc;
return ntb_transport_register_client(&ntb_netdev_client);
rc = ntb_transport_register_client(&ntb_netdev_client);
if (rc) {
ntb_transport_unregister_client_dev(KBUILD_MODNAME);
return rc;
}
return 0;
}
module_init(ntb_netdev_init_module);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment