From: Corentin Chary <corentincj@iksaif.net>
To: linux-acpi@vger.kernel.org
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
Julia Lawall <julia@diku.dk>,
Alan Jenkins <alan-jenkins@tuffmail.co.uk>,
Johannes Berg <johannes@sipsolutions.net>,
Corentin Chary <corentincj@iksaif.net>,
Matthew Garrett <mjg@redhat.com>
Subject: [PATCH 3/3] dell-laptop: fix rfkill memory leak on unload
Date: Mon, 14 Sep 2009 12:43:53 +0200 [thread overview]
Message-ID: <1252925033-29696-4-git-send-email-corentincj@iksaif.net> (raw)
In-Reply-To: <1252925033-29696-3-git-send-email-corentincj@iksaif.net>
rfkill_unregister() should always be followed by rfkill_destroy()
Cc: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
---
drivers/platform/x86/dell-laptop.c | 36 ++++++++++++++++++++++++------------
1 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
index 74909c4..c81002c 100644
--- a/drivers/platform/x86/dell-laptop.c
+++ b/drivers/platform/x86/dell-laptop.c
@@ -206,6 +206,25 @@ static const struct rfkill_ops dell_rfkill_ops = {
.query = dell_rfkill_query,
};
+static void dell_free_rfkill(void)
+{
+ if (wifi_rfkill) {
+ rfkill_unregister(wifi_rfkill);
+ rfkill_destroy(wifi_rfkill);
+ wifi_rfkill = NULL;
+ }
+ if (bluetooth_rfkill) {
+ rfkill_unregister(bluetooth_rfkill);
+ rfkill_destroy(bluetooth_rfkill);
+ bluetooth_rfkill = NULL;
+ }
+ if (wwan_rfkill) {
+ rfkill_unregister(wwan_rfkill);
+ rfkill_destroy(wwan_rfkill);
+ wwan_rfkill = NULL;
+ }
+}
+
static int dell_setup_rfkill(void)
{
struct calling_interface_buffer buffer;
@@ -256,14 +275,17 @@ static int dell_setup_rfkill(void)
return 0;
err_wwan:
rfkill_destroy(wwan_rfkill);
+ wwan_rfkill = NULL;
if (bluetooth_rfkill)
rfkill_unregister(bluetooth_rfkill);
err_bluetooth:
rfkill_destroy(bluetooth_rfkill);
+ bluetooth_rfkill = NULL;
if (wifi_rfkill)
rfkill_unregister(wifi_rfkill);
err_wifi:
rfkill_destroy(wifi_rfkill);
+ wifi_rfkill = NULL;
return ret;
}
@@ -369,12 +391,7 @@ static int __init dell_init(void)
return 0;
out:
- if (wifi_rfkill)
- rfkill_unregister(wifi_rfkill);
- if (bluetooth_rfkill)
- rfkill_unregister(bluetooth_rfkill);
- if (wwan_rfkill)
- rfkill_unregister(wwan_rfkill);
+ dell_free_rfkill();
kfree(da_tokens);
return ret;
}
@@ -382,12 +399,7 @@ out:
static void __exit dell_exit(void)
{
backlight_device_unregister(dell_backlight_device);
- if (wifi_rfkill)
- rfkill_unregister(wifi_rfkill);
- if (bluetooth_rfkill)
- rfkill_unregister(bluetooth_rfkill);
- if (wwan_rfkill)
- rfkill_unregister(wwan_rfkill);
+ dell_free_rfkill();
}
module_init(dell_init);
--
1.6.4.2
next prev parent reply other threads:[~2009-09-14 10:51 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-14 10:43 [PATCH 0/3] rfkill_unregister() should always be followed by rfkill_destroy() Corentin Chary
2009-09-14 10:43 ` [PATCH 1/3] hp-wmi: fix rfkill memory leak on unload Corentin Chary
2009-09-14 10:43 ` [PATCH 2/3] thinkpad_acpi: " Corentin Chary
2009-09-14 10:43 ` Corentin Chary [this message]
2009-09-14 10:46 ` [PATCH 3/3] dell-laptop: " Matthew Garrett
2009-09-14 11:02 ` Alan Jenkins
2009-09-14 12:01 ` Corentin Chary
2009-09-14 13:22 ` [PATCH 2/3] thinkpad_acpi: " Henrique de Moraes Holschuh
2009-09-19 5:10 ` Len Brown
2009-09-14 10:59 ` [PATCH 1/3] hp-wmi: " Matthew Garrett
2009-09-19 5:13 ` Len Brown
2009-09-14 13:24 ` [PATCH 0/3] rfkill_unregister() should always be followed by rfkill_destroy() Henrique de Moraes Holschuh
2009-09-14 14:57 ` Alan Jenkins
2009-09-14 17:07 ` Henrique de Moraes Holschuh
2009-09-14 17:10 ` Henrique de Moraes Holschuh
2009-09-14 17:47 ` Corentin Chary
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1252925033-29696-4-git-send-email-corentincj@iksaif.net \
--to=corentincj@iksaif.net \
--cc=alan-jenkins@tuffmail.co.uk \
--cc=johannes@sipsolutions.net \
--cc=julia@diku.dk \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mjg@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®