Commit 37f55e9d authored by Henrique de Moraes Holschuh's avatar Henrique de Moraes Holschuh Committed by John W. Linville
Browse files

rfkill: fix led-trigger unregister order in error unwind

rfkill needs to unregister the led trigger AFTER a call to
rfkill_remove_switch(), otherwise it will not update the LED state,
possibly leaving it ON when it should be OFF.

To make led-trigger unregistering safer, guard against unregistering a
trigger twice, and also against issuing trigger events to a led trigger
that was unregistered.  This makes the error unwind paths more resilient.

Refer to "rfkill: Register LED triggers before registering switch".
Signed-off-by: default avatarHenrique de Moraes Holschuh <>
Acked-by: default avatarIvo van Doorn <>
Cc: Michael Buesch <>
Cc: Dmitry Baryshkov <>
Signed-off-by: default avatarJohn W. Linville <>
parent 2fd9b221
......@@ -590,8 +590,10 @@ static void rfkill_led_trigger_register(struct rfkill *rfkill)
static void rfkill_led_trigger_unregister(struct rfkill *rfkill)
if (rfkill->
if (rfkill-> {
rfkill-> = NULL;
......@@ -627,8 +629,8 @@ int rfkill_register(struct rfkill *rfkill)
error = device_add(dev);
if (error) {
return error;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment