Re: [PATCH v3 6/7] thermal/drivers/cpu_cooling: Introduce the cpu idle cooling driver

From: Daniel Lezcano
Date: Fri Apr 13 2018 - 07:46:17 EST


On 13/04/2018 13:38, Daniel Thompson wrote:

[ ... ]

>> + /*
>> + * Allocate the cpuidle cooling device with the list
>> + * of the cpus belonging to the cluster.
>> + */
>> + idle_cdev = cpuidle_cooling_alloc(topology_core_cpumask(cpu));
>> + if (!idle_cdev)
>> + goto out;
>
> Perhaps nitpicking but it might be better to set ret to -ENOMEM here
> and avoid initializing it during the declarations.
>
> There's no bug in the current form since ret is never assigned to
> outside of the error paths, but the unwritten assumption that ret keeps
> its original value throughout the loop seems like a bit of a landmine
> w.r.t. future maintainance.

Agree.

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