未验证 提交 87684d33 编写于 作者: D Dan Carpenter 提交者: Mark Brown

ASoC: Intel: Skylake: Re-order some code to silence a warning

I get a Smatch warning here:

    sound/soc/intel/skylake/skl-nhlt.c:335 skl_get_ssp_clks()
    error: testing array offset 'j' after use.

The code is harmless, but the checker is right that we should swap these
two conditions so we verify that the offset is within bounds before we
use it.
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: NSriram Periyasamy <sriramx.periyasamy@intel.com>
Acked-By: NVinod Koul <vinod.koul@intel.com>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 9452314d
......@@ -322,8 +322,8 @@ static void skl_get_ssp_clks(struct skl *skl, struct skl_ssp_clk *ssp_clks,
rate = channels * bps * fs;
/* check if the rate is added already to the given SSP's sclk */
for (j = 0; (sclk[id].rate_cfg[j].rate != 0) &&
(j < SKL_MAX_CLK_RATES); j++) {
for (j = 0; (j < SKL_MAX_CLK_RATES) &&
(sclk[id].rate_cfg[j].rate != 0); j++) {
if (sclk[id].rate_cfg[j].rate == rate) {
present = true;
break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册