greybus: interface: disable interface on registration failures
authorJohan Hovold <johan@hovoldconsulting.com>
Wed, 13 Apr 2016 17:19:00 +0000 (19:19 +0200)
committerGreg Kroah-Hartman <gregkh@google.com>
Thu, 21 Apr 2016 01:06:00 +0000 (10:06 +0900)
Disable and deactivate an interface immediately on registration
failures.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/svc.c

index b79d8171736054d15353928bfe75a76429a16f3c..5a16ad33b74b2dc91512d6dc6751a660b1e6dee2 100644 (file)
@@ -518,7 +518,12 @@ static void gb_svc_process_intf_hotplug(struct gb_operation *operation)
                goto err_interface_deactivate;
        }
 
-       gb_interface_add(intf);
+       ret = gb_interface_add(intf);
+       if (ret) {
+               gb_interface_disable(intf);
+               gb_interface_deactivate(intf);
+               return;
+       }
 
        return;