• Jean Delvare's avatar
    macintosh/therm_adt746x: Fix sysfs attributes lifetime · 33a470f6
    Jean Delvare authored
    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: default avatarJean Delvare <khali@linux-fr.org>
    Tested-by: default avatarChristian Kujau <lists@nerdbynature.de>
    Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    Cc: Colin Leroy <colin@colino.net>
    Cc: stable@kernel.org
    Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
    33a470f6
therm_adt746x.c 17.9 KB