aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/dell-laptop.c
diff options
context:
space:
mode:
authorAlan Jenkins <alan-jenkins@tuffmail.co.uk>2009-08-19 10:06:48 -0400
committerLen Brown <len.brown@intel.com>2009-12-10 00:01:03 -0500
commit4311bb230e0f7e4daa5fd5bc0cc536e2bd1eff20 (patch)
tree39c7f4948ef12ea2068022a8233ca9820bb514e5 /drivers/platform/x86/dell-laptop.c
parent71e9dc73cb6b1351bdd5f732cef5dbef411b3219 (diff)
dell-laptop: fix rfkill memory leak on unload and failure paths
rfkill_unregister() should always be followed by rfkill_destroy(). Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk> Acked-by: Matthew Garrett <mjg@redhat.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/platform/x86/dell-laptop.c')
-rw-r--r--drivers/platform/x86/dell-laptop.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
index d791ef93c1f0..94139d530c75 100644
--- a/drivers/platform/x86/dell-laptop.c
+++ b/drivers/platform/x86/dell-laptop.c
@@ -268,6 +268,22 @@ err_wifi:
268 return ret; 268 return ret;
269} 269}
270 270
271static void dell_cleanup_rfkill(void)
272{
273 if (wifi_rfkill) {
274 rfkill_unregister(wifi_rfkill);
275 rfkill_destroy(wifi_rfkill);
276 }
277 if (bluetooth_rfkill) {
278 rfkill_unregister(bluetooth_rfkill);
279 rfkill_destroy(bluetooth_rfkill);
280 }
281 if (wwan_rfkill) {
282 rfkill_unregister(wwan_rfkill);
283 rfkill_destroy(wwan_rfkill);
284 }
285}
286
271static int dell_send_intensity(struct backlight_device *bd) 287static int dell_send_intensity(struct backlight_device *bd)
272{ 288{
273 struct calling_interface_buffer buffer; 289 struct calling_interface_buffer buffer;
@@ -370,12 +386,7 @@ static int __init dell_init(void)
370 return 0; 386 return 0;
371 387
372fail_backlight: 388fail_backlight:
373 if (wifi_rfkill) 389 dell_cleanup_rfkill();
374 rfkill_unregister(wifi_rfkill);
375 if (bluetooth_rfkill)
376 rfkill_unregister(bluetooth_rfkill);
377 if (wwan_rfkill)
378 rfkill_unregister(wwan_rfkill);
379fail_rfkill: 390fail_rfkill:
380 kfree(da_tokens); 391 kfree(da_tokens);
381 return ret; 392 return ret;
@@ -384,12 +395,7 @@ fail_rfkill:
384static void __exit dell_exit(void) 395static void __exit dell_exit(void)
385{ 396{
386 backlight_device_unregister(dell_backlight_device); 397 backlight_device_unregister(dell_backlight_device);
387 if (wifi_rfkill) 398 dell_cleanup_rfkill();
388 rfkill_unregister(wifi_rfkill);
389 if (bluetooth_rfkill)
390 rfkill_unregister(bluetooth_rfkill);
391 if (wwan_rfkill)
392 rfkill_unregister(wwan_rfkill);
393} 399}
394 400
395module_init(dell_init); 401module_init(dell_init);