Skip to content

Commit

Permalink
cpuidle: Check if device is already registered
Browse files Browse the repository at this point in the history
Make __cpuidle_register_device() check whether or not the device has
been registered already and return -EBUSY immediately if that's the
case.

[rjw: Changelog]
Signed-off-by: Daniel Lezcano <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
dlezcano authored and rafaeljw committed Jul 15, 2013
1 parent 5df0aa7 commit c878a52
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/cpuidle/cpuidle.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,13 +400,16 @@ static int __cpuidle_register_device(struct cpuidle_device *dev)
*/
int cpuidle_register_device(struct cpuidle_device *dev)
{
int ret;
int ret = -EBUSY;

if (!dev)
return -EINVAL;

mutex_lock(&cpuidle_lock);

if (dev->registered)
goto out_unlock;

ret = __cpuidle_device_init(dev);
if (ret)
goto out_unlock;
Expand Down

0 comments on commit c878a52

Please sign in to comment.