devfreq_cooling: return on allocation failure
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 4 Nov 2015 13:36:20 +0000 (16:36 +0300)
committerJoonyoung Shim <jy0922.shim@samsung.com>
Thu, 7 Jul 2016 05:32:12 +0000 (14:32 +0900)
If the allocation fails then we can't continue.

Fixes: a76caf55e5b3 ('thermal: Add devfreq cooling')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
[jy0922.shim: apply mainline patch]
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
drivers/thermal/devfreq_cooling.c

index d1b7c32..01f0015 100644 (file)
@@ -397,7 +397,7 @@ static int devfreq_cooling_gen_tables(struct devfreq_cooling_device *dfc)
                power_table = kcalloc(num_opps, sizeof(*power_table),
                                      GFP_KERNEL);
                if (!power_table)
-                       ret = -ENOMEM;
+                       return -ENOMEM;
        }
 
        freq_table = kcalloc(num_opps, sizeof(*freq_table),