From a117dddf6bb27478e6903c9cb242601b6f45b11c Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 14 Feb 2007 21:15:05 +0100 Subject: [PATCH] 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 --- drivers/hwmon/f71805f.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/hwmon/f71805f.c b/drivers/hwmon/f71805f.c index 2fc5378193..7c29734871 100644 --- a/drivers/hwmon/f71805f.c +++ b/drivers/hwmon/f71805f.c @@ -1290,14 +1290,11 @@ static int __init f71805f_device_add(unsigned short address, if (err) { printk(KERN_ERR DRVNAME ": Device addition failed (%d)\n", err); - goto exit_kfree_data; + goto exit_device_put; } return 0; -exit_kfree_data: - kfree(pdev->dev.platform_data); - pdev->dev.platform_data = NULL; exit_device_put: platform_device_put(pdev); exit: @@ -1390,10 +1387,7 @@ exit: static void __exit f71805f_exit(void) { - kfree(pdev->dev.platform_data); - pdev->dev.platform_data = NULL; platform_device_unregister(pdev); - platform_driver_unregister(&f71805f_driver); } -- 2.39.5