Re: [PATCH v2] cpufreq: Fix timer/workqueue corruption by protectingreading governor_enabled

From: Jane Li
Date: Fri Jan 03 2014 - 01:45:13 EST



On 01/03/2014 07:26 AM, Dmitry Torokhov wrote
Unlocking in different branches is not the best practice IMO, I'd
recommend doing:

mutex_lock(&cpufreq_governor_lock);

if (!policy->governor_enabled)
goto out_unlock;

...

out_unlock:
mutex_unlock(&cpufreq_governor_lock);

Thanks!

OK. I have pushed PATCH v3. Please review again.

Besides, I use checkpatch.pl to check this patch, and find there is warning. PATCH v3 also move cpufreq_governor_lock declaration to cpufreq.h.

WARNING: externs should be avoided in .c files
#106: FILE: drivers/cpufreq/cpufreq_governor.c:25:
+extern struct mutex cpufreq_governor_lock;

Thanks!

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/