瀏覽代碼

drm/nouveau/clk/gk20a: only compute n_lo if needed

n_lo is used if we are going to slide. Compute it only if that condition
succeeds to avoid confusion about future usage of this computation.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Alexandre Courbot 9 年之前
父節點
當前提交
a08c8bae66
共有 1 個文件被更改,包括 5 次插入3 次删除
  1. 5 3
      drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk20a.c

+ 5 - 3
drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk20a.c

@@ -367,10 +367,12 @@ _gk20a_pllg_program_mnp(struct gk20a_clk *clk, bool allow_slide)
 	}
 	}
 
 
 	/* slide down to NDIV_LO */
 	/* slide down to NDIV_LO */
-	n_lo = DIV_ROUND_UP(m_old * clk->params->min_vco,
-			    clk->parent_rate / KHZ);
 	if (allow_slide && (cfg & GPCPLL_CFG_ENABLE)) {
 	if (allow_slide && (cfg & GPCPLL_CFG_ENABLE)) {
-		int ret = gk20a_pllg_slide(clk, n_lo);
+		int ret;
+
+		n_lo = DIV_ROUND_UP(m_old * clk->params->min_vco,
+				    clk->parent_rate / KHZ);
+		ret = gk20a_pllg_slide(clk, n_lo);
 
 
 		if (ret)
 		if (ret)
 			return ret;
 			return ret;