Skip to contentSkip to conversation

hwmon/f71882fg: Set platform drvdata to

PATCH Applied Hans de Goede 3 participants 3 messages Mar 13, 2011 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 hwmon/f71882fg: Set platform drvdata to

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

---
 drivers/hwmon/f71882fg.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hwmon/f71882fg.c +1 -1
index 9cb52f5..a4d430e 100644
@@ -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;
Signature · 7 lines
1.7.3.2


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Acked-by on v1 2/3
#1 lore raw

Re: [lm-sensors] [PATCH 2/3] hwmon/f71882fg: Set platform drvdata

Quoted 20 lines · Hans de Goede

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

---
 drivers/hwmon/f71882fg.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hwmon/f71882fg.c +0 -1
index 9cb52f5..a4d430e 100644
@@ -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);
 

drivers/hwmon/f71882fg.c static int f71882fg_remove(struct platform_device *pdev) · line 2368

Quoted 7 lines
drivers/hwmon/f71882fg.c +1 -0
@@ -2363,6 +2362,7 @@ static int f71882fg_remove(struct platform_device *pdev)
 		}
 	}
 
+	platform_set_drvdata(pdev, NULL);
 	kfree(data);
 
 	return 0;

I'd suggest a
Cc: [email protected]
for this fix too.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#2 lore raw

Re: [lm-sensors] [PATCH 2/3] hwmon/f71882fg: Set platform drvdata

In reply to Hans de Goede
Quoted 27 lines · Jean Delvare
Quoted 26 lines · Hans de Goede

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

---
 drivers/hwmon/f71882fg.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hwmon/f71882fg.c +1 -1
index 9cb52f5..a4d430e 100644
@@ -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);
 
Quoted 9 lines

drivers/hwmon/f71882fg.c static int f71882fg_remove(struct platform_device *pdev) · line 2368

Quoted 1 line
drivers/hwmon/f71882fg.c +0 -0
 	return 0;

I'd suggest a
Cc: [email protected]
for this fix too.

Applied, and added.

Thanks,
Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors