aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/f71805f.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2007-02-14 15:15:05 -0500
committerJean Delvare <khali@arrakis.delvare>2007-02-14 15:15:05 -0500
commita117dddf6bb27478e6903c9cb242601b6f45b11c (patch)
treef05e5be6348e59a3b0416bd3609024b5884f298c /drivers/hwmon/f71805f.c
parentbc8f0a26855d8fac68040d462ec3cc13884e98e5 (diff)
hwmon/f71805f: Fix a race condition
I think I introduced a potential race condition bug with commit 51c997d80e1f625aea3426a8a9087f5830ac6db3. I didn't realize it back then, but platform_device_put and platform_device_release both appear to free the platform data associated with the device. This makes an explicit kfree redundant at best, and maybe even racy, as it might occur while someone still holds a reference to the platform device. Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/f71805f.c')
-rw-r--r--drivers/hwmon/f71805f.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/drivers/hwmon/f71805f.c b/drivers/hwmon/f71805f.c
index 2fc537819388..7c2973487122 100644
--- a/drivers/hwmon/f71805f.c
+++ b/drivers/hwmon/f71805f.c
@@ -1290,14 +1290,11 @@ static int __init f71805f_device_add(unsigned short address,
1290 if (err) { 1290 if (err) {
1291 printk(KERN_ERR DRVNAME ": Device addition failed (%d)\n", 1291 printk(KERN_ERR DRVNAME ": Device addition failed (%d)\n",
1292 err); 1292 err);
1293 goto exit_kfree_data; 1293 goto exit_device_put;
1294 } 1294 }
1295 1295
1296 return 0; 1296 return 0;
1297 1297
1298exit_kfree_data:
1299 kfree(pdev->dev.platform_data);
1300 pdev->dev.platform_data = NULL;
1301exit_device_put: 1298exit_device_put:
1302 platform_device_put(pdev); 1299 platform_device_put(pdev);
1303exit: 1300exit:
@@ -1390,10 +1387,7 @@ exit:
1390 1387
1391static void __exit f71805f_exit(void) 1388static void __exit f71805f_exit(void)
1392{ 1389{
1393 kfree(pdev->dev.platform_data);
1394 pdev->dev.platform_data = NULL;
1395 platform_device_unregister(pdev); 1390 platform_device_unregister(pdev);
1396
1397 platform_driver_unregister(&f71805f_driver); 1391 platform_driver_unregister(&f71805f_driver);
1398} 1392}
1399 1393