Skip to content

Commit

Permalink
ARM: cpuidle: Fix error return code
Browse files Browse the repository at this point in the history
commit af48d7b upstream.

We know that 'ret = 0' because it has been tested a few lines above.
So, if 'kzalloc' fails, 0 will be returned instead of an error code.
Return -ENOMEM instead.

Fixes: a0d46a3 ("ARM: cpuidle: Register per cpuidle device")
Signed-off-by: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Christophe Jaillet authored and Greg Kroah-Hartman committed Oct 16, 2016
1 parent 88277ac commit ec07719
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/cpuidle/cpuidle-arm.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ static int __init arm_idle_init(void)
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (!dev) {
pr_err("Failed to allocate cpuidle device\n");
ret = -ENOMEM;
goto out_fail;
}
dev->cpu = cpu;
Expand Down

0 comments on commit ec07719

Please sign in to comment.