ARM: cpuidle: Fix error return code
authorChristophe Jaillet <christophe.jaillet@wanadoo.fr>
Thu, 11 Aug 2016 13:02:30 +0000 (15:02 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 12 Aug 2016 00:33:14 +0000 (02:33 +0200)
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: a0d46a3dfdc3 ("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>
drivers/cpuidle/cpuidle-arm.c

index e342565..1855b9e 100644 (file)
@@ -135,6 +135,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;