Commit d7172c0e authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab

media: ccs-pll: Add sanity checks

Add sanity checks for fields that could cause division by zero.
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 9490a227
...@@ -421,6 +421,15 @@ int ccs_pll_calculate(struct device *dev, const struct ccs_pll_limits *lim, ...@@ -421,6 +421,15 @@ int ccs_pll_calculate(struct device *dev, const struct ccs_pll_limits *lim,
pll->vt_lanes = 1; pll->vt_lanes = 1;
} }
if (!pll->op_lanes || !pll->vt_lanes || !pll->bits_per_pixel ||
!pll->ext_clk_freq_hz || !pll->link_freq || !pll->scale_m ||
!op_lim_fr->min_pll_ip_clk_freq_hz ||
!op_lim_fr->max_pll_ip_clk_freq_hz ||
!op_lim_fr->min_pll_op_clk_freq_hz ||
!op_lim_fr->max_pll_op_clk_freq_hz ||
!op_lim_bk->max_sys_clk_div || !op_lim_fr->max_pll_multiplier)
return -EINVAL;
/* /*
* Make sure op_pix_clk_div will be integer --- unless flexible * Make sure op_pix_clk_div will be integer --- unless flexible
* op_pix_clk_div is supported * op_pix_clk_div is supported
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment