We need to clear cpumask only if the relevant cpu is set and we could
have used cpumask_test_and_clear_cpu() and set instead.

Signed-off-by: Viresh Kumar <[email protected]>
---
 drivers/cpufreq/cpufreq.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index d01cad993fa7..b223c9c5296b 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1498,10 +1498,9 @@ static int cpufreq_remove_dev(struct device *dev, struct 
subsys_interface *sif)
        }
 
        /* sysfs links are removed only on subsys callback */
-       if (cpumask_test_cpu(cpu, policy->linked_cpus)) {
+       if (cpumask_test_and_clear_cpu(cpu, policy->linked_cpus)) {
                dev_dbg(dev, "%s: Removing symlink for CPU: %u\n", __func__,
                        cpu);
-               cpumask_clear_cpu(cpu, policy->linked_cpus);
                sysfs_remove_link(&dev->kobj, "cpufreq");
                return 0;
        }
-- 
2.4.0

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

Reply via email to