rfkill: call rfkill_led_trigger_unregister() on error

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>
This commit is contained in:
Eric Paris 2008-01-13 16:20:56 -05:00 committed by David S. Miller
parent a7da60f415
commit 632041f306
1 changed files with 4 additions and 1 deletions

View 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;
}