]> git.baikalelectronics.ru Git - kernel.git/commit
ARM: cpuidle: Correct driver unregistration if init fails
authorLeo Yan <leo.yan@linaro.org>
Tue, 10 Oct 2017 05:47:55 +0000 (13:47 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 13 Oct 2017 23:00:18 +0000 (01:00 +0200)
commite8e00bc4fd2e7bdf74bcfe2c1fd3c4f369971a26
tree6ef9d4c0b21f146549e135a3886fb5a7a4167831
parent33f51281db010aa2439bb92ab88155314e92c07a
ARM: cpuidle: Correct driver unregistration if init fails

If cpuidle init fails, the code misses to unregister the driver for
current CPU. Furthermore, we also need to rollback to cancel all
previous CPUs registration; but the code retrieves driver handler by
using function cpuidle_get_driver(), this function returns back
current CPU driver handler but not previous CPU's handler, which leads
to the failure handling code cannot unregister previous CPUs driver.

This commit fixes two mentioned issues, it adds error handling path
'goto out_unregister_drv' for current CPU driver unregistration; and
it is to replace cpuidle_get_driver() with cpuidle_get_cpu_driver(),
the later function can retrieve driver handler for previous CPUs
according to the CPU device handler so can unregister the driver
properly.

This patch also adds extra error handling paths 'goto out_kfree_dev'
and 'goto out_kfree_drv' and adjusts the freeing sentences for previous
CPUs; so make the code more readable for freeing 'dev' and 'drv'
structures.

Suggested-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Fixes: 39a634230ac2 (ARM: cpuidle: Support asymmetric idle definition)
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpuidle/cpuidle-arm.c