diff mbox

ARM: cpuidle: Fix error return code

Message ID 1470920550-21625-1-git-send-email-christophe.jaillet@wanadoo.fr (mailing list archive)
State Accepted, archived
Delegated to: Rafael Wysocki
Headers show

Commit Message

Christophe JAILLET Aug. 11, 2016, 1:02 p.m. UTC
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>
---
 drivers/cpuidle/cpuidle-arm.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Lorenzo Pieralisi Aug. 11, 2016, 1:39 p.m. UTC | #1
On Thu, Aug 11, 2016 at 03:02:30PM +0200, Christophe JAILLET wrote:
> 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>
> ---
>  drivers/cpuidle/cpuidle-arm.c | 1 +
>  1 file changed, 1 insertion(+)

Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Daniel Lezcano Aug. 17, 2016, 2:16 p.m. UTC | #2
On 08/11/2016 03:02 PM, Christophe JAILLET wrote:
> 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>

Applied, thanks !

  -- Daniel
Rafael J. Wysocki Aug. 18, 2016, 1:13 a.m. UTC | #3
On Wednesday, August 17, 2016 04:16:09 PM Daniel Lezcano wrote:
> On 08/11/2016 03:02 PM, Christophe JAILLET wrote:
> > 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>
> 
> Applied, thanks !

Daniel, I've applied it too and earlier.

Thanks,
Rafael

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Daniel Lezcano Aug. 18, 2016, 7:55 a.m. UTC | #4
On 08/18/2016 03:13 AM, Rafael J. Wysocki wrote:
> On Wednesday, August 17, 2016 04:16:09 PM Daniel Lezcano wrote:
>> On 08/11/2016 03:02 PM, Christophe JAILLET wrote:
>>> 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>
>>
>> Applied, thanks !
> 
> Daniel, I've applied it too and earlier.

Ok, thanks for the head up.

  -- Daniel
diff mbox

Patch

diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c
index 4ba3d3fe142f..f440d385ed34 100644
--- a/drivers/cpuidle/cpuidle-arm.c
+++ b/drivers/cpuidle/cpuidle-arm.c
@@ -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;