Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8a8f1c0437a77cce29c1cb6089f01f22a6d9ca6e
Commit:     8a8f1c0437a77cce29c1cb6089f01f22a6d9ca6e
Parent:     8d8c90e3fd1f8895f6d48bdcb34ba69a1fe73616
Author:     Michael Buesch <[EMAIL PROTECTED]>
AuthorDate: Sun Oct 28 13:07:54 2007 +0100
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Sat Nov 10 21:59:11 2007 -0800

    rfkill: Register LED triggers before registering switch
    
    Registering the switch triggers a LED event, so we must register
    LED triggers before the switch.
    This has a potential to fix a crash, depending on how the device
    driver initializes the rfkill data structure.
    
    Signed-off-by: Michael Buesch <[EMAIL PROTECTED]>
    Signed-off-by: Ivo van Doorn <[EMAIL PROTECTED]>
    Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
---
 net/rfkill/rfkill.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index 51d151c..c6a9412 100644
--- a/net/rfkill/rfkill.c
+++ b/net/rfkill/rfkill.c
@@ -388,19 +388,20 @@ int rfkill_register(struct rfkill *rfkill)
        if (!rfkill->toggle_radio)
                return -EINVAL;
 
+       snprintf(dev->bus_id, sizeof(dev->bus_id),
+                "rfkill%ld", (long)atomic_inc_return(&rfkill_no) - 1);
+
+       rfkill_led_trigger_register(rfkill);
+
        error = rfkill_add_switch(rfkill);
        if (error)
                return error;
 
-       snprintf(dev->bus_id, sizeof(dev->bus_id),
-                "rfkill%ld", (long)atomic_inc_return(&rfkill_no) - 1);
-
        error = device_add(dev);
        if (error) {
                rfkill_remove_switch(rfkill);
                return error;
        }
-       rfkill_led_trigger_register(rfkill);
 
        return 0;
 }
@@ -416,9 +417,9 @@ EXPORT_SYMBOL(rfkill_register);
  */
 void rfkill_unregister(struct rfkill *rfkill)
 {
-       rfkill_led_trigger_unregister(rfkill);
        device_del(&rfkill->dev);
        rfkill_remove_switch(rfkill);
+       rfkill_led_trigger_unregister(rfkill);
        put_device(&rfkill->dev);
 }
 EXPORT_SYMBOL(rfkill_unregister);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to