RE: [PATCH V3] cpuidle: check dev before usage in cpuidle_use_deepest_state

From: Li, Fei
Date: Thu May 04 2017 - 21:53:34 EST


On Thursday, May 4, 2017 6:16 PM Daniel Lezcano wrote:
> >
> > preempt_disable();
> > dev = cpuidle_get_device();
> > - dev->use_deepest_state = enable;
> > + if (dev)
> > + dev->use_deepest_state = enable;
>
>
> This change is acceptable as a hot fix but the question is 'why is this
> function called if there is no cpuidle driver registered?'

It's called as below:
clamp_idle_injection_func
-> play_idle
-> cpuidle_use_deepest_state
In play_idle, if no cpuidle driver registered, cpu_idle_poll can be called.
It seems to go too far if not calling play_idle in case of no cpuidle driver
registered.
At present no other suitable and simple fix seen.

>
> > preempt_enable();
> > }
> >
> > --
> > 1.9.1
> >
> > Best Regards,
> > Fei
>
> --
>
> <http://www.linaro.org/> Linaro.org â Open source software for ARM SoCs
>
> Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
> <http://twitter.com/#!/linaroorg> Twitter |
> <http://www.linaro.org/linaro-blog/> Blog

Best Regards,
Fei