ARM: tegra: edp: fix Coverity issue of resource leak
Deepak Nibade [Thu, 14 Feb 2013 13:46:39 +0000 (18:46 +0530)]
Coverity id : 22377

Bug 1046331

Change-Id: I888eac8268c1ba8027907dbc260f1d414d36ad73
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/200796
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>

arch/arm/mach-tegra/edp.c

index c76e7e8..f789d8b 100644 (file)
@@ -609,11 +609,15 @@ static int init_cpu_edp_limits_calculated(void)
                                   * freq_voltage_lut_size, GFP_KERNEL);
        if (!freq_voltage_lut) {
                pr_err("%s: failed alloc mem for freq/voltage LUT\n", __func__);
+               kfree(power_edp_calc_limits);
+               kfree(edp_calculated_limits);
                return -ENOMEM;
        }
 
        ret = edp_relate_freq_voltage(clk_cpu_g, cpu_speedo_idx);
        if (ret) {
+               kfree(power_edp_calc_limits);
+               kfree(edp_calculated_limits);
                kfree(freq_voltage_lut);
                return ret;
        }