]> git.kernelconcepts.de Git - karo-tx-linux.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)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 15 Mar 2010 16:06:11 +0000 (09:06 -0700)
commit44fc910605e7b0ece4b2151309d6edbefa96517a
treed0895c0febe5f395a462cfa4f87dd7208c7436af
parent9a255c79b215c5cf9790ff46a25188e3af2dfc42
macintosh/therm_adt746x: Fix sysfs attributes lifetime

commit 33a470f6d5e1879c26f16f6b34dc09f82d44f6e9 upstream.

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>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/macintosh/therm_adt746x.c