ARM: cpuidle: Fix error return code

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: a0d46a3dfd ("ARM: cpuidle: Register per cpuidle device")
Signed-off-by: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: 4.1+ <stable@vger.kernel.org> # 4.1+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Christophe Jaillet 2016-08-11 15:02:30 +02:00 committed by Rafael J. Wysocki
parent bef4509625
commit af48d7bc37
1 changed files with 1 additions and 0 deletions

View File

@ -135,6 +135,7 @@ static int __init arm_idle_init(void)
dev = kzalloc(sizeof(*dev), GFP_KERNEL); dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (!dev) { if (!dev) {
pr_err("Failed to allocate cpuidle device\n"); pr_err("Failed to allocate cpuidle device\n");
ret = -ENOMEM;
goto out_fail; goto out_fail;
} }
dev->cpu = cpu; dev->cpu = cpu;