Negative indexes are not valid here. Signed-off-by: Gergo Koteles <soyer@xxxxxx> --- sound/soc/codecs/tas2781-fmwlib.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sound/soc/codecs/tas2781-fmwlib.c b/sound/soc/codecs/tas2781-fmwlib.c index 20dc2df034e9..aa5f56f9ad33 100644 --- a/sound/soc/codecs/tas2781-fmwlib.c +++ b/sound/soc/codecs/tas2781-fmwlib.c @@ -2198,21 +2198,21 @@ int tasdevice_select_tuningprm_cfg(void *context, int prm_no, goto out; } - if (cfg_no >= tas_fmw->nr_configurations) { + if (cfg_no < 0 || cfg_no >= tas_fmw->nr_configurations) { dev_err(tas_priv->dev, "%s: cfg(%d) is not in range of conf %u\n", __func__, cfg_no, tas_fmw->nr_configurations); goto out; } - if (prm_no >= tas_fmw->nr_programs) { + if (prm_no < 0 || prm_no >= tas_fmw->nr_programs) { dev_err(tas_priv->dev, "%s: prm(%d) is not in range of Programs %u\n", __func__, prm_no, tas_fmw->nr_programs); goto out; } - if (rca_conf_no >= rca->ncfgs || rca_conf_no < 0 || + if (rca_conf_no < 0 || rca_conf_no >= rca->ncfgs || !cfg_info) { dev_err(tas_priv->dev, "conf_no:%d should be in range from 0 to %u\n", @@ -2304,7 +2304,7 @@ int tasdevice_prmg_load(void *context, int prm_no) goto out; } - if (prm_no >= tas_fmw->nr_programs) { + if (prm_no < 0 || prm_no >= tas_fmw->nr_programs) { dev_err(tas_priv->dev, "%s: prm(%d) is not in range of Programs %u\n", __func__, prm_no, tas_fmw->nr_programs); @@ -2349,7 +2349,7 @@ int tasdevice_prmg_calibdata_load(void *context, int prm_no) goto out; } - if (prm_no >= tas_fmw->nr_programs) { + if (prm_no < 0 || prm_no >= tas_fmw->nr_programs) { dev_err(tas_priv->dev, "%s: prm(%d) is not in range of Programs %u\n", __func__, prm_no, tas_fmw->nr_programs); -- 2.43.0