cpufreq: Reorder cpufreq_online() error code path
authorViresh Kumar <viresh.kumar@linaro.org>
Thu, 22 Feb 2018 05:59:43 +0000 (11:29 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 27 Feb 2018 17:22:12 +0000 (18:22 +0100)
commitb24b6478e65f140610ab1ffaadc7bc6bf0be8aad
tree0502467742659777a64b04385cb6bc54e32a2e6d
parentcb8bd2ff1528a3f0234ec04b667bf91a3be7ac30
cpufreq: Reorder cpufreq_online() error code path

Ideally the de-allocation of resources should happen in the exact
opposite order in which they were allocated. It helps maintain the code
in long term, even if nothing really breaks with incorrect ordering.

That wasn't followed in cpufreq_online() and it has some
inconsistencies.  For example, the symlinks were created from within
the locked region while they are removed only after putting the locks.
Also ->exit() should have been called only after the symlinks are
removed and the lock is dropped, as that was the case when ->init()
was first called.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
[ rjw: Subject ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/cpufreq.c