]> bbs.cooldavid.org Git - net-next-2.6.git/commit
macintosh/therm_adt746x: Fix sysfs attributes lifetime
authorJean Delvare <khali@linux-fr.org>
Sun, 31 Jan 2010 04:00:30 +0000 (04:00 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 3 Feb 2010 06:39:49 +0000 (17:39 +1100)
commit33a470f6d5e1879c26f16f6b34dc09f82d44f6e9
treefc3111cc16b918e9a5f643118653f8b163184a24
parent119ea10947cc1402abbf9d6200815b0606536906
macintosh/therm_adt746x: Fix sysfs attributes lifetime

Looking at drivers/macintosh/therm_adt746x.c, the sysfs files are
created in thermostat_init() and removed in thermostat_exit(), which
are the driver's init and exit functions. These files are backed-up by
a per-device structure, so it looks like the wrong thing to do: the
sysfs files have a lifetime longer than the data structure that is
backing it up.

I think that sysfs files creation should be moved to the end of
probe_thermostat() and sysfs files removal should be moved to the
beginning of remove_thermostat().

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Christian Kujau <lists@nerdbynature.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Colin Leroy <colin@colino.net>
Cc: stable@kernel.org
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
drivers/macintosh/therm_adt746x.c