Skip to content

Commit

Permalink
hwmon/f71882fg: Set platform drvdata to NULL later
Browse files Browse the repository at this point in the history
This avoids a possible race leading to trying to dereference NULL.

Signed-off-by: Hans de Goede <[email protected]>
Acked-by: Jean Delvare <[email protected]>
Cc: [email protected]
Signed-off-by: Guenter Roeck <[email protected]>
  • Loading branch information
jwrdegoede authored and Guenter Roeck committed Mar 13, 2011
1 parent 14a4019 commit d9ebaa4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/hwmon/f71882fg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2111,7 +2111,6 @@ static int f71882fg_remove(struct platform_device *pdev)
int nr_fans = (data->type == f71882fg) ? 4 : 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);

Expand Down Expand Up @@ -2178,6 +2177,7 @@ static int f71882fg_remove(struct platform_device *pdev)
}
}

platform_set_drvdata(pdev, NULL);
kfree(data);

return 0;
Expand Down

0 comments on commit d9ebaa4

Please sign in to comment.