Skip to content

Commit

Permalink
rfkill: call rfkill_led_trigger_unregister() on error
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
  • Loading branch information
eparis authored and davem330 committed Jan 21, 2008
1 parent a7da60f commit 632041f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/rfkill/rfkill.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 632041f

Please sign in to comment.