diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2017-12-08 14:54:25 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2017-12-11 14:43:15 +0300 |
commit | 87684d338a22d15e47b16ee68f569d74ad1d076e (patch) | |
tree | 26ad02718d44718aac966527aca866cbd2ad092a /sound/soc/intel/skylake/skl-nhlt.c | |
parent | 9452314d92d600e8702533b10f10ec440aad5db9 (diff) | |
download | linux-87684d338a22d15e47b16ee68f569d74ad1d076e.tar.xz |
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: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Sriram Periyasamy <sriramx.periyasamy@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel/skylake/skl-nhlt.c')
-rw-r--r-- | sound/soc/intel/skylake/skl-nhlt.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/soc/intel/skylake/skl-nhlt.c b/sound/soc/intel/skylake/skl-nhlt.c index ca5dc2be7b68..bde7f40f29f5 100644 --- a/sound/soc/intel/skylake/skl-nhlt.c +++ b/sound/soc/intel/skylake/skl-nhlt.c @@ -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; |