[lm-sensors] [PATCH 2/3] hwmon/f71882fg: Set platform drvdata to NULL later

Hans de Goede hdegoede at redhat.com
Sun Mar 13 13:50:33 CET 2011


This avoids a possible race leading to trying to dereference NULL.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 drivers/hwmon/f71882fg.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c
index 9cb52f5..a4d430e 100644
--- a/drivers/hwmon/f71882fg.c
+++ b/drivers/hwmon/f71882fg.c
@@ -2280,7 +2280,6 @@ static int f71882fg_remove(struct platform_device *pdev)
 	int nr_temps = (data->type == f71808e) ? 2 : 3;
 	u8 start_reg = f71882fg_read8(data, F71882FG_REG_START);
 
-	platform_set_drvdata(pdev, NULL);
 	if (data->hwmon_dev)
 		hwmon_device_unregister(data->hwmon_dev);
 
@@ -2363,6 +2362,7 @@ static int f71882fg_remove(struct platform_device *pdev)
 		}
 	}
 
+	platform_set_drvdata(pdev, NULL);
 	kfree(data);
 
 	return 0;
-- 
1.7.3.2





More information about the lm-sensors mailing list