mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
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 <[email protected]> Reviewed-by: Chanwoo Choi <[email protected]> Signed-off-by: MyungJoo Ham <[email protected]>
This commit is contained in:
parent
566cf877a1
commit
924b9111a1
1 changed files with 7 additions and 1 deletions
|
|
@ -112,7 +112,13 @@ out:
|
|||
|
||||
static void userspace_exit(struct devfreq *devfreq)
|
||||
{
|
||||
sysfs_remove_group(&devfreq->dev.kobj, &dev_attr_group);
|
||||
/*
|
||||
* Remove the sysfs entry, unless this is being called after
|
||||
* device_del(), which should have done this already via kobject_del().
|
||||
*/
|
||||
if (devfreq->dev.kobj.sd)
|
||||
sysfs_remove_group(&devfreq->dev.kobj, &dev_attr_group);
|
||||
|
||||
kfree(devfreq->data);
|
||||
devfreq->data = NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue