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

From: Viresh Kumar
Date: Tue Oct 30 2018 - 04:33:15 EST


On 30-10-18, 08:55, Daniel Lezcano wrote:
> 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.

Sorry, couldn't understand most of your reply :)

Though let me try to explain the problem I was trying to show you..

cpufreq-notifier-callback
-> init_cpu_capacity_callback()
-> free raw capacity
-> queue_work() to unregister the notifier
-> return

->init_cpu_capacity_callback() called again before work was processed.
-> If we don't check raw_capacity, we may end up using
NULL pointer, as the notifier isn't unregistered yet.

--
viresh