devfreq_cooling: return on allocation failure
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 4 Nov 2015 13:36:20 +0000 (16:36 +0300)
committerEduardo Valentin <edubezval@gmail.com>
Wed, 4 Nov 2015 19:06:29 +0000 (11:06 -0800)
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>
drivers/thermal/devfreq_cooling.c

index d1b7c32e7406cf819f078313a6f4cfc175c11d37..01f0015f80dc3f4d03409aff8d4732c1f17e57b6 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),