diff --git a/msm/vidc/hfi_common.c b/msm/vidc/hfi_common.c index 4364e8e54308..4fbbda3a8c15 100644 --- a/msm/vidc/hfi_common.c +++ b/msm/vidc/hfi_common.c @@ -1292,13 +1292,12 @@ static int __set_clk_rate(struct venus_hfi_device *device, return rc; } - device->clk_freq = rate; - - if (device->clk_freq >= threshold_freq && rate < threshold_freq) { + if (ipeak && device->clk_freq >= threshold_freq && rate < threshold_freq) { rc = cx_ipeak_update(ipeak, false); if (rc) { dprintk(VIDC_ERR, "cx_ipeak_update failed! ipeak %pK\n", ipeak); + device->clk_freq = rate; return rc; } dprintk(VIDC_PERF, @@ -1306,6 +1305,8 @@ static int __set_clk_rate(struct venus_hfi_device *device, device->clk_freq, rate, threshold_freq); } + device->clk_freq = rate; + return rc; }