rfkill: call rfkill_led_trigger_unregister() on error
authorEric Paris <eparis@redhat.com>
Sun, 13 Jan 2008 21:20:56 +0000 (16:20 -0500)
committerDavid S. Miller <davem@davemloft.net>
Mon, 21 Jan 2008 04:31:36 +0000 (20:31 -0800)
Code inspection turned up that error cases in rfkill_register() do not
call rfkill_led_trigger_unregister() even though we have already
registered.

Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/rfkill/rfkill.c

index 4469a7be006c270c4be87700cdf7364aa0a5d765..d06d338812e975081ff20f771ea2c9069abede4c 100644 (file)
@@ -392,11 +392,14 @@ int rfkill_register(struct rfkill *rfkill)
        rfkill_led_trigger_register(rfkill);
 
        error = rfkill_add_switch(rfkill);
-       if (error)
+       if (error) {
+               rfkill_led_trigger_unregister(rfkill);
                return error;
+       }
 
        error = device_add(dev);
        if (error) {
+               rfkill_led_trigger_unregister(rfkill);
                rfkill_remove_switch(rfkill);
                return error;
        }