From: Johan Hedberg <johan.hedberg@xxxxxxxxx> In case part of the bt_6lowpan_init() fails we should undo any operations that succeeded before the failure. This patch add the necessary cleanup path to the function. Signed-off-by: Johan Hedberg <johan.hedberg@xxxxxxxxx> --- net/bluetooth/6lowpan.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c index 524218aeea6f..6e3c208820b8 100644 --- a/net/bluetooth/6lowpan.c +++ b/net/bluetooth/6lowpan.c @@ -1457,9 +1457,20 @@ static int __init bt_6lowpan_init(void) err = register_netdevice_notifier(&bt_6lowpan_dev_notifier); if (err) - return err; + goto failed; - return hci_mgmt_chan_register(&bt_6lowpan_chan); + err = hci_mgmt_chan_register(&bt_6lowpan_chan); + if (err) { + unregister_netdevice_notifier(&bt_6lowpan_dev_notifier); + goto failed; + } + + return 0; + +failed: + debugfs_remove(lowpan_enable_debugfs); + debugfs_remove(lowpan_control_debugfs); + return err; } static void __exit bt_6lowpan_exit(void) -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html