Merge tag 'net-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
[linux-2.6-microblaze.git] / drivers / net / usb / hso.c
index 7dc1ef3..a57251b 100644 (file)
@@ -2535,13 +2535,17 @@ static struct hso_device *hso_create_net_device(struct usb_interface *interface,
        if (!hso_net->mux_bulk_tx_buf)
                goto err_free_tx_urb;
 
-       add_net_device(hso_dev);
+       result = add_net_device(hso_dev);
+       if (result) {
+               dev_err(&interface->dev, "Failed to add net device\n");
+               goto err_free_tx_buf;
+       }
 
        /* registering our net device */
        result = register_netdev(net);
        if (result) {
                dev_err(&interface->dev, "Failed to register device\n");
-               goto err_free_tx_buf;
+               goto err_rmv_ndev;
        }
 
        hso_log_port(hso_dev);
@@ -2550,8 +2554,9 @@ static struct hso_device *hso_create_net_device(struct usb_interface *interface,
 
        return hso_dev;
 
-err_free_tx_buf:
+err_rmv_ndev:
        remove_net_device(hso_dev);
+err_free_tx_buf:
        kfree(hso_net->mux_bulk_tx_buf);
 err_free_tx_urb:
        usb_free_urb(hso_net->mux_bulk_tx_urb);