PM / devfreq: Don't delete sysfs group twice
authorChris Diamand <chris.diamand@arm.com>
Thu, 12 Jan 2017 14:57:41 +0000 (14:57 +0000)
committerChanwoo Choi <cw00.choi@samsung.com>
Mon, 4 Sep 2017 05:33:30 +0000 (14:33 +0900)
commit4b45ea5c64d27885087dff216513818e42868d0c
tree1112c32484103a94e052f453b6c7e52d088dfe5f
parent4b0b67d441238b16cfdff44da1ee6692c1d305a3
PM / devfreq: Don't delete sysfs group twice

The 'userspace' governor adds a sysfs entry, which is removed when
the governor is changed, or the devfreq device is released. However,
when the latter occurs via device_unregister(), device_del() is
called first, which removes the sysfs entries recursively and deletes
the kobject.

This means we get an Oops when the governor calls
sysfs_remove_group() on the deleted kobject. Fix this by only doing
the call when kobj *hasn't* been kobject_del()'d.

Note that we can't just remove the call to sysfs_remove_group()
entirely - it's needed for when the governor is changed to one which
doesn't need a sysfs entry.

Signed-off-by: Chris Diamand <chris.diamand@arm.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
drivers/devfreq/governor_userspace.c