Re: [PATCH 1/4] base/drivers/arch_topology: Remove useless check

From: Daniel Lezcano
Date: Tue Oct 30 2018 - 03:55:38 EST


On 30/10/2018 06:50, Viresh Kumar wrote:
> On Mon, Oct 29, 2018 at 9:56 PM Daniel Lezcano
> <daniel.lezcano@xxxxxxxxxx> wrote:
>
> Would have been better if I was cc'd on all the patches since I was
> looking at this
> stuff actively this week :)

ah, yes. Sorry for that.


>> The function 'register_cpufreq_notifier' registers the
>> init_cpu_capacity_notifier() only if raw_capacity is not NULL.
>>
>> Hence init_cpu_capacity_notifier() can not be called with raw_capacity
>> set to NULL, it is pointless to check it.
>
> It isn't entirely pointless though.
>
> It is possible for init_cpu_capacity_notifier() to get called after
> free_raw_capacity()
> is called from it as the notifier unregistration happens from a workqueue.

The workqueue is called from init_cpu_capacity_callback(). This one is
called in the notifier callback. IOW the notification callback
unregisters itself. But if it is not registered, it won't unregister,
hence it won't call the workqueue and init_cpu_capacity_notifier() is
not called.



--
<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