[PATCH 00/24] ASoC: realtek: fix cppcheck warnings
Lots of trivial issues that make cppcheck too verbose. There shouldn't be any functionality change with this patchset.
Pierre-Louis Bossart (24): ASoC: rt1011: use logical OR ASoC: rt1011: remove redundant test ASoC: rt1011: clarify expression ASoC: rt1015: clarify expression ASoC: rt1016: clarify expression ASoC: rt1305: clarify expression ASoC: rt1308: clarify expression ASoC: rt5640: clarify expression ASoC: rt5645: use logical OR ASoC: rt5645: clarify expression ASoC: rt5651: clarify expression ASoC: rt5651: remove useless assignment ASoC: rt5659: clarify expression ASoC: rt5660: clarify expression ASoC: rt5663: clarify expression ASoC: rt5665: clarify expression ASoC: rt5668: clarify expression ASoC: rt5668: remove useless assignments ASoC: rt5670: clarify expression ASoC: rt5677: clarify expression ASoC: rt5677: remove useless assignment ASoC: rt5682: clarify expression ASoC: rt5682: remove useless assignments ASoC: rt5682: remove useless initialization
sound/soc/codecs/rt1011.c | 47 ++++++++++++++++++--------------------- sound/soc/codecs/rt1015.c | 5 +++-- sound/soc/codecs/rt1016.c | 7 +++--- sound/soc/codecs/rt1305.c | 4 ++-- sound/soc/codecs/rt1308.c | 8 +++---- sound/soc/codecs/rt5640.c | 6 ++--- sound/soc/codecs/rt5645.c | 6 ++--- sound/soc/codecs/rt5651.c | 6 ++--- sound/soc/codecs/rt5659.c | 4 ++-- sound/soc/codecs/rt5660.c | 4 ++-- sound/soc/codecs/rt5663.c | 4 ++-- sound/soc/codecs/rt5665.c | 4 ++-- sound/soc/codecs/rt5668.c | 8 +++---- sound/soc/codecs/rt5670.c | 4 ++-- sound/soc/codecs/rt5677.c | 6 ++--- sound/soc/codecs/rt5682.c | 12 +++++----- 16 files changed, 67 insertions(+), 68 deletions(-)
cppcheck complains a lot about mixing booleans and bitwise operations.
There is no good reason to use && and |, fix with ||
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/codecs/rt1011.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-)
diff --git a/sound/soc/codecs/rt1011.c b/sound/soc/codecs/rt1011.c index 6877be5f36b9..b9dadc8243b3 100644 --- a/sound/soc/codecs/rt1011.c +++ b/sound/soc/codecs/rt1011.c @@ -1089,25 +1089,21 @@ static int rt1011_recv_spk_mode_put(struct snd_kcontrol *kcontrol,
static bool rt1011_validate_bq_drc_coeff(unsigned short reg) { - if ((reg == RT1011_DAC_SET_1) | - (reg >= RT1011_ADC_SET && reg <= RT1011_ADC_SET_1) | - (reg == RT1011_ADC_SET_4) | (reg == RT1011_ADC_SET_5) | - (reg == RT1011_MIXER_1) | - (reg == RT1011_A_TIMING_1) | (reg >= RT1011_POWER_7 && - reg <= RT1011_POWER_8) | - (reg == RT1011_CLASS_D_POS) | (reg == RT1011_ANALOG_CTRL) | - (reg >= RT1011_SPK_TEMP_PROTECT_0 && - reg <= RT1011_SPK_TEMP_PROTECT_6) | - (reg >= RT1011_SPK_PRO_DC_DET_5 && reg <= RT1011_BAT_GAIN_1) | - (reg >= RT1011_RT_DRC_CROSS && reg <= RT1011_RT_DRC_POS_8) | - (reg >= RT1011_CROSS_BQ_SET_1 && reg <= RT1011_BQ_10_A2_15_0) | - (reg >= RT1011_SMART_BOOST_TIMING_1 && - reg <= RT1011_SMART_BOOST_TIMING_36) | - (reg == RT1011_SINE_GEN_REG_1) | - (reg >= RT1011_STP_ALPHA_RECIPROCAL_MSB && - reg <= RT1011_BQ_6_PARAMS_CHECK_5) | - (reg >= RT1011_BQ_7_PARAMS_CHECK_1 && - reg <= RT1011_BQ_10_PARAMS_CHECK_5)) + if ((reg == RT1011_DAC_SET_1) || + (reg >= RT1011_ADC_SET && reg <= RT1011_ADC_SET_1) || + (reg == RT1011_ADC_SET_4) || (reg == RT1011_ADC_SET_5) || + (reg == RT1011_MIXER_1) || + (reg == RT1011_A_TIMING_1) || + (reg >= RT1011_POWER_7 && reg <= RT1011_POWER_8) || + (reg == RT1011_CLASS_D_POS) || (reg == RT1011_ANALOG_CTRL) || + (reg >= RT1011_SPK_TEMP_PROTECT_0 && reg <= RT1011_SPK_TEMP_PROTECT_6) || + (reg >= RT1011_SPK_PRO_DC_DET_5 && reg <= RT1011_BAT_GAIN_1) || + (reg >= RT1011_RT_DRC_CROSS && reg <= RT1011_RT_DRC_POS_8) || + (reg >= RT1011_CROSS_BQ_SET_1 && reg <= RT1011_BQ_10_A2_15_0) || + (reg >= RT1011_SMART_BOOST_TIMING_1 && reg <= RT1011_SMART_BOOST_TIMING_36) || + (reg == RT1011_SINE_GEN_REG_1) || + (reg >= RT1011_STP_ALPHA_RECIPROCAL_MSB && reg <= RT1011_BQ_6_PARAMS_CHECK_5) || + (reg >= RT1011_BQ_7_PARAMS_CHECK_1 && reg <= RT1011_BQ_10_PARAMS_CHECK_5)) return true;
return false;
cppcheck warning:
sound/soc/codecs/rt1011.c:1994:6: style: Condition 'tx_slotnum' is always true [knownConditionTrueFalse] if (tx_slotnum) ^ sound/soc/codecs/rt1011.c:1895:24: note: Assuming that condition '!tx_slotnum' is not redundant if (tx_slotnum > 2 || !tx_slotnum) { ^ sound/soc/codecs/rt1011.c:1994:6: note: Condition 'tx_slotnum' is always true if (tx_slotnum) ^
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/codecs/rt1011.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/rt1011.c b/sound/soc/codecs/rt1011.c index b9dadc8243b3..39a9f17ca0a9 100644 --- a/sound/soc/codecs/rt1011.c +++ b/sound/soc/codecs/rt1011.c @@ -1987,10 +1987,10 @@ static int rt1011_set_tdm_slot(struct snd_soc_dai *dai, RT1011_TDM_I2S_DOCK_EN_1_MASK, tdm_en); snd_soc_component_update_bits(component, RT1011_TDM2_SET_2, RT1011_TDM_I2S_DOCK_EN_2_MASK, tdm_en); - if (tx_slotnum) - snd_soc_component_update_bits(component, RT1011_TDM_TOTAL_SET, - RT1011_ADCDAT1_PIN_CONFIG | RT1011_ADCDAT2_PIN_CONFIG, - RT1011_ADCDAT1_OUTPUT | RT1011_ADCDAT2_OUTPUT); + + snd_soc_component_update_bits(component, RT1011_TDM_TOTAL_SET, + RT1011_ADCDAT1_PIN_CONFIG | RT1011_ADCDAT2_PIN_CONFIG, + RT1011_ADCDAT1_OUTPUT | RT1011_ADCDAT2_OUTPUT);
_set_tdm_err_: snd_soc_dapm_mutex_unlock(dapm);
cppcheck warning:
sound/soc/codecs/rt1011.c:1781:63: style: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition]
(pll_code.m_bp ? 0 : pll_code.m_code) << RT1011_PLL1_QM_SFT | ^
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/codecs/rt1011.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/rt1011.c b/sound/soc/codecs/rt1011.c index 39a9f17ca0a9..238cb66f4c6a 100644 --- a/sound/soc/codecs/rt1011.c +++ b/sound/soc/codecs/rt1011.c @@ -1778,8 +1778,9 @@ static int rt1011_set_component_pll(struct snd_soc_component *component, pll_code.n_code, pll_code.k_code);
snd_soc_component_write(component, RT1011_PLL_1, - (pll_code.m_bp ? 0 : pll_code.m_code) << RT1011_PLL1_QM_SFT | - pll_code.m_bp << RT1011_PLL1_BPM_SFT | pll_code.n_code); + ((pll_code.m_bp ? 0 : pll_code.m_code) << RT1011_PLL1_QM_SFT) | + (pll_code.m_bp << RT1011_PLL1_BPM_SFT) | + pll_code.n_code); snd_soc_component_write(component, RT1011_PLL_2, pll_code.k_code);
cppcheck warning:
sound/soc/codecs/rt1015.c:894:61: style: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition] (pll_code.m_bp ? 0 : pll_code.m_code) << RT1015_PLL_M_SFT | ^
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/codecs/rt1015.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/rt1015.c b/sound/soc/codecs/rt1015.c index 3cd967ae999d..10a7b7745f4b 100644 --- a/sound/soc/codecs/rt1015.c +++ b/sound/soc/codecs/rt1015.c @@ -893,8 +893,9 @@ static int rt1015_set_component_pll(struct snd_soc_component *component, pll_code.n_code, pll_code.k_code);
snd_soc_component_write(component, RT1015_PLL1, - (pll_code.m_bp ? 0 : pll_code.m_code) << RT1015_PLL_M_SFT | - pll_code.m_bp << RT1015_PLL_M_BP_SFT | pll_code.n_code); + ((pll_code.m_bp ? 0 : pll_code.m_code) << RT1015_PLL_M_SFT) | + (pll_code.m_bp << RT1015_PLL_M_BP_SFT) | + pll_code.n_code); snd_soc_component_write(component, RT1015_PLL2, pll_code.k_code);
cppcheck warning:
sound/soc/codecs/rt1016.c:503:61: style: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition] (pll_code.m_bp ? 0 : pll_code.m_code) << RT1016_PLL_M_SFT | ^ sound/soc/codecs/rt1016.c:506:40: style: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition] pll_code.k_bp << RT1016_PLL_K_BP_SFT | ^
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/codecs/rt1016.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/rt1016.c b/sound/soc/codecs/rt1016.c index c14a809da52b..7561d202274c 100644 --- a/sound/soc/codecs/rt1016.c +++ b/sound/soc/codecs/rt1016.c @@ -500,10 +500,11 @@ static int rt1016_set_component_pll(struct snd_soc_component *component, (pll_code.k_bp ? 0 : pll_code.k_code));
snd_soc_component_write(component, RT1016_PLL1, - (pll_code.m_bp ? 0 : pll_code.m_code) << RT1016_PLL_M_SFT | - pll_code.m_bp << RT1016_PLL_M_BP_SFT | pll_code.n_code); + ((pll_code.m_bp ? 0 : pll_code.m_code) << RT1016_PLL_M_SFT) | + (pll_code.m_bp << RT1016_PLL_M_BP_SFT) | + pll_code.n_code); snd_soc_component_write(component, RT1016_PLL2, - pll_code.k_bp << RT1016_PLL_K_BP_SFT | + (pll_code.k_bp << RT1016_PLL_K_BP_SFT) | (pll_code.k_bp ? 0 : pll_code.k_code));
rt1016->pll_in = freq_in;
cppcheck warning:
sound/soc/codecs/rt1305.c:853:63: style: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition] (pll_code.m_bp ? 0 : pll_code.m_code) << RT1305_PLL_1_M_SFT | ^
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/codecs/rt1305.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/rt1305.c b/sound/soc/codecs/rt1305.c index 16aa405fb8f0..7a0094578e46 100644 --- a/sound/soc/codecs/rt1305.c +++ b/sound/soc/codecs/rt1305.c @@ -850,8 +850,8 @@ static int rt1305_set_component_pll(struct snd_soc_component *component, pll_code.n_code, pll_code.k_code);
snd_soc_component_write(component, RT1305_PLL1_1, - (pll_code.m_bp ? 0 : pll_code.m_code) << RT1305_PLL_1_M_SFT | - pll_code.m_bp << RT1305_PLL_1_M_BYPASS_SFT | + ((pll_code.m_bp ? 0 : pll_code.m_code) << RT1305_PLL_1_M_SFT) | + (pll_code.m_bp << RT1305_PLL_1_M_BYPASS_SFT) | pll_code.n_code); snd_soc_component_write(component, RT1305_PLL1_2, pll_code.k_code);
cppcheck warning:
sound/soc/codecs/rt1308.c:676:40: style: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition] pll_code.k_code << RT1308_PLL1_K_SFT | ^
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/codecs/rt1308.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/rt1308.c b/sound/soc/codecs/rt1308.c index 76e65844543d..b4e5546e2e21 100644 --- a/sound/soc/codecs/rt1308.c +++ b/sound/soc/codecs/rt1308.c @@ -673,10 +673,10 @@ static int rt1308_set_component_pll(struct snd_soc_component *component, pll_code.n_code, pll_code.k_code);
snd_soc_component_write(component, RT1308_PLL_1, - pll_code.k_code << RT1308_PLL1_K_SFT | - pll_code.m_bp << RT1308_PLL1_M_BYPASS_SFT | - (pll_code.m_bp ? 0 : pll_code.m_code) << RT1308_PLL1_M_SFT | - pll_code.n_code << RT1308_PLL1_N_SFT); + (pll_code.k_code << RT1308_PLL1_K_SFT) | + (pll_code.m_bp << RT1308_PLL1_M_BYPASS_SFT) | + ((pll_code.m_bp ? 0 : pll_code.m_code) << RT1308_PLL1_M_SFT) | + (pll_code.n_code << RT1308_PLL1_N_SFT));
rt1308->pll_in = freq_in; rt1308->pll_out = freq_out;
cppcheck warning:
sound/soc/codecs/rt5640.c:1923:61: style: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition] (pll_code.m_bp ? 0 : pll_code.m_code) << RT5640_PLL_M_SFT | ^
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/codecs/rt5640.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c index a5674c227b3a..8c1766954b92 100644 --- a/sound/soc/codecs/rt5640.c +++ b/sound/soc/codecs/rt5640.c @@ -1918,10 +1918,10 @@ static int rt5640_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, pll_code.n_code, pll_code.k_code);
snd_soc_component_write(component, RT5640_PLL_CTRL1, - pll_code.n_code << RT5640_PLL_N_SFT | pll_code.k_code); + (pll_code.n_code << RT5640_PLL_N_SFT) | pll_code.k_code); snd_soc_component_write(component, RT5640_PLL_CTRL2, - (pll_code.m_bp ? 0 : pll_code.m_code) << RT5640_PLL_M_SFT | - pll_code.m_bp << RT5640_PLL_M_BP_SFT); + ((pll_code.m_bp ? 0 : pll_code.m_code) << RT5640_PLL_M_SFT) | + (pll_code.m_bp << RT5640_PLL_M_BP_SFT));
rt5640->pll_in = freq_in; rt5640->pll_out = freq_out;
cppcheck warning:
sound/soc/codecs/rt5645.c:693:37: style:inconclusive: Boolean expression 'reg>=420&®<=461' is used in bitwise operation. Did you mean '||'? [bitwiseOnBoolean] if ((reg >= 0x1a4 && reg <= 0x1cd) | (reg >= 0x1e5 && reg <= 0x1f8) | ^ sound/soc/codecs/rt5645.c:693:70: style:inconclusive: Boolean expression 'reg==177' is used in bitwise operation. Did you mean '||'? [bitwiseOnBoolean] if ((reg >= 0x1a4 && reg <= 0x1cd) | (reg >= 0x1e5 && reg <= 0x1f8) | ^
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/codecs/rt5645.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 63a7e052eaa0..4db6cd70e32b 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -690,7 +690,7 @@ static int rt5645_hweq_get(struct snd_kcontrol *kcontrol,
static bool rt5645_validate_hweq(unsigned short reg) { - if ((reg >= 0x1a4 && reg <= 0x1cd) | (reg >= 0x1e5 && reg <= 0x1f8) | + if ((reg >= 0x1a4 && reg <= 0x1cd) || (reg >= 0x1e5 && reg <= 0x1f8) || (reg == RT5645_EQ_CTRL2)) return true;
cppcheck warning:
sound/soc/codecs/rt5645.c:2959:61: style: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition] (pll_code.m_bp ? 0 : pll_code.m_code) << RT5645_PLL_M_SFT | ^
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/codecs/rt5645.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 4db6cd70e32b..c39095fa14ce 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -2956,8 +2956,8 @@ static int rt5645_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, snd_soc_component_write(component, RT5645_PLL_CTRL1, pll_code.n_code << RT5645_PLL_N_SFT | pll_code.k_code); snd_soc_component_write(component, RT5645_PLL_CTRL2, - (pll_code.m_bp ? 0 : pll_code.m_code) << RT5645_PLL_M_SFT | - pll_code.m_bp << RT5645_PLL_M_BP_SFT); + ((pll_code.m_bp ? 0 : pll_code.m_code) << RT5645_PLL_M_SFT) | + (pll_code.m_bp << RT5645_PLL_M_BP_SFT));
rt5645->pll_in = freq_in; rt5645->pll_out = freq_out;
cppcheck warning:
sound/soc/codecs/rt5659.c:3515:61: style: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition] (pll_code.m_bp ? 0 : pll_code.m_code) << RT5659_PLL_M_SFT | ^
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/codecs/rt5651.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/rt5651.c b/sound/soc/codecs/rt5651.c index e59fdc81dbd4..49fab9db5917 100644 --- a/sound/soc/codecs/rt5651.c +++ b/sound/soc/codecs/rt5651.c @@ -1498,8 +1498,8 @@ static int rt5651_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, snd_soc_component_write(component, RT5651_PLL_CTRL1, pll_code.n_code << RT5651_PLL_N_SFT | pll_code.k_code); snd_soc_component_write(component, RT5651_PLL_CTRL2, - (pll_code.m_bp ? 0 : pll_code.m_code) << RT5651_PLL_M_SFT | - pll_code.m_bp << RT5651_PLL_M_BP_SFT); + ((pll_code.m_bp ? 0 : pll_code.m_code) << RT5651_PLL_M_SFT) | + (pll_code.m_bp << RT5651_PLL_M_BP_SFT));
rt5651->pll_in = freq_in; rt5651->pll_out = freq_out;
cppcheck warning:
sound/soc/codecs/rt5651.c:1786:13: style: Variable 'report' is assigned a value that is never used. [unreadVariable] int report = 0; ^
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/codecs/rt5651.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/rt5651.c b/sound/soc/codecs/rt5651.c index 49fab9db5917..fc0c83b73f09 100644 --- a/sound/soc/codecs/rt5651.c +++ b/sound/soc/codecs/rt5651.c @@ -1783,7 +1783,7 @@ static void rt5651_jack_detect_work(struct work_struct *work) struct rt5651_priv *rt5651 = container_of(work, struct rt5651_priv, jack_detect_work); struct snd_soc_component *component = rt5651->component; - int report = 0; + int report;
if (!rt5651_jack_inserted(component)) { /* Jack removed, or spurious IRQ? */
cppcheck warning:
sound/soc/codecs/rt5659.c:3515:61: style: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition] (pll_code.m_bp ? 0 : pll_code.m_code) << RT5659_PLL_M_SFT | ^
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/codecs/rt5659.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/rt5659.c b/sound/soc/codecs/rt5659.c index 41e5917b16a5..67f0ab817135 100644 --- a/sound/soc/codecs/rt5659.c +++ b/sound/soc/codecs/rt5659.c @@ -3512,8 +3512,8 @@ static int rt5659_set_component_pll(struct snd_soc_component *component, int pll snd_soc_component_write(component, RT5659_PLL_CTRL_1, pll_code.n_code << RT5659_PLL_N_SFT | pll_code.k_code); snd_soc_component_write(component, RT5659_PLL_CTRL_2, - (pll_code.m_bp ? 0 : pll_code.m_code) << RT5659_PLL_M_SFT | - pll_code.m_bp << RT5659_PLL_M_BP_SFT); + ((pll_code.m_bp ? 0 : pll_code.m_code) << RT5659_PLL_M_SFT) | + (pll_code.m_bp << RT5659_PLL_M_BP_SFT));
rt5659->pll_in = freq_in; rt5659->pll_out = freq_out;
cppcheck warning:
sound/soc/codecs/rt5660.c:1060:61: style: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition] (pll_code.m_bp ? 0 : pll_code.m_code) << RT5660_PLL_M_SFT | ^
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/codecs/rt5660.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/rt5660.c b/sound/soc/codecs/rt5660.c index 0edf09d3a499..33ff9156358b 100644 --- a/sound/soc/codecs/rt5660.c +++ b/sound/soc/codecs/rt5660.c @@ -1057,8 +1057,8 @@ static int rt5660_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, snd_soc_component_write(component, RT5660_PLL_CTRL1, pll_code.n_code << RT5660_PLL_N_SFT | pll_code.k_code); snd_soc_component_write(component, RT5660_PLL_CTRL2, - (pll_code.m_bp ? 0 : pll_code.m_code) << RT5660_PLL_M_SFT | - pll_code.m_bp << RT5660_PLL_M_BP_SFT); + ((pll_code.m_bp ? 0 : pll_code.m_code) << RT5660_PLL_M_SFT) | + (pll_code.m_bp << RT5660_PLL_M_BP_SFT));
rt5660->pll_in = freq_in; rt5660->pll_out = freq_out;
cppcheck warning:
sound/soc/codecs/rt5663.c:2955:63: style: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition] (pll_code.m_bp ? 0 : pll_code.m_code) << RT5663_PLL_M_SHIFT | ^ Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/codecs/rt5663.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/rt5663.c b/sound/soc/codecs/rt5663.c index 619fb9a031e3..be9fc58ff681 100644 --- a/sound/soc/codecs/rt5663.c +++ b/sound/soc/codecs/rt5663.c @@ -2952,8 +2952,8 @@ static int rt5663_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, snd_soc_component_write(component, RT5663_PLL_1, pll_code.n_code << RT5663_PLL_N_SHIFT | pll_code.k_code); snd_soc_component_write(component, RT5663_PLL_2, - (pll_code.m_bp ? 0 : pll_code.m_code) << RT5663_PLL_M_SHIFT | - pll_code.m_bp << RT5663_PLL_M_BP_SHIFT); + ((pll_code.m_bp ? 0 : pll_code.m_code) << RT5663_PLL_M_SHIFT) | + (pll_code.m_bp << RT5663_PLL_M_BP_SHIFT));
rt5663->pll_in = freq_in; rt5663->pll_out = freq_out;
cppcheck warning:
sound/soc/codecs/rt5665.c:4388:61: style: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition] (pll_code.m_bp ? 0 : pll_code.m_code) << RT5665_PLL_M_SFT | ^
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/codecs/rt5665.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/rt5665.c b/sound/soc/codecs/rt5665.c index 8a915cdce0fe..e59323fd5bf2 100644 --- a/sound/soc/codecs/rt5665.c +++ b/sound/soc/codecs/rt5665.c @@ -4385,8 +4385,8 @@ static int rt5665_set_component_pll(struct snd_soc_component *component, int pll snd_soc_component_write(component, RT5665_PLL_CTRL_1, pll_code.n_code << RT5665_PLL_N_SFT | pll_code.k_code); snd_soc_component_write(component, RT5665_PLL_CTRL_2, - (pll_code.m_bp ? 0 : pll_code.m_code) << RT5665_PLL_M_SFT | - pll_code.m_bp << RT5665_PLL_M_BP_SFT); + ((pll_code.m_bp ? 0 : pll_code.m_code) << RT5665_PLL_M_SFT) | + (pll_code.m_bp << RT5665_PLL_M_BP_SFT));
rt5665->pll_in = freq_in; rt5665->pll_out = freq_out;
cppcheck warning:
sound/soc/codecs/rt5668.c:2185:61: style: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition] (pll_code.m_bp ? 0 : pll_code.m_code) << RT5668_PLL_M_SFT | ^
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/codecs/rt5668.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/rt5668.c b/sound/soc/codecs/rt5668.c index bc69adc9c8b7..d966d6d1bf64 100644 --- a/sound/soc/codecs/rt5668.c +++ b/sound/soc/codecs/rt5668.c @@ -2182,8 +2182,8 @@ static int rt5668_set_component_pll(struct snd_soc_component *component, snd_soc_component_write(component, RT5668_PLL_CTRL_1, pll_code.n_code << RT5668_PLL_N_SFT | pll_code.k_code); snd_soc_component_write(component, RT5668_PLL_CTRL_2, - (pll_code.m_bp ? 0 : pll_code.m_code) << RT5668_PLL_M_SFT | - pll_code.m_bp << RT5668_PLL_M_BP_SFT); + ((pll_code.m_bp ? 0 : pll_code.m_code) << RT5668_PLL_M_SFT) | + (pll_code.m_bp << RT5668_PLL_M_BP_SFT));
rt5668->pll_in = freq_in; rt5668->pll_out = freq_out;
cppcheck warnings:
sound/soc/codecs/rt5668.c:1177:6: style: Redundant initialization for 'idx'. The initialized value is overwritten before it is read. [redundantInitialization] idx = rt5668_div_sel(rt5668, 1500000, div, ARRAY_SIZE(div)); ^ sound/soc/codecs/rt5668.c:1174:10: note: idx is initialized int idx = -EINVAL; ^ sound/soc/codecs/rt5668.c:1177:6: note: idx is overwritten idx = rt5668_div_sel(rt5668, 1500000, div, ARRAY_SIZE(div)); ^
sound/soc/codecs/rt5668.c:1202:6: style: Redundant initialization for 'idx'. The initialized value is overwritten before it is read. [redundantInitialization] idx = rt5668_div_sel(rt5668, ref, div, ARRAY_SIZE(div)); ^ sound/soc/codecs/rt5668.c:1191:25: note: idx is initialized int ref, val, reg, idx = -EINVAL; ^ sound/soc/codecs/rt5668.c:1202:6: note: idx is overwritten idx = rt5668_div_sel(rt5668, ref, div, ARRAY_SIZE(div)); ^
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/codecs/rt5668.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/rt5668.c b/sound/soc/codecs/rt5668.c index d966d6d1bf64..6ab1a8bc3735 100644 --- a/sound/soc/codecs/rt5668.c +++ b/sound/soc/codecs/rt5668.c @@ -1171,7 +1171,7 @@ static int set_dmic_clk(struct snd_soc_dapm_widget *w, struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); struct rt5668_priv *rt5668 = snd_soc_component_get_drvdata(component); - int idx = -EINVAL; + int idx; static const int div[] = {2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128};
idx = rt5668_div_sel(rt5668, 1500000, div, ARRAY_SIZE(div)); @@ -1188,7 +1188,7 @@ static int set_filter_clk(struct snd_soc_dapm_widget *w, struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); struct rt5668_priv *rt5668 = snd_soc_component_get_drvdata(component); - int ref, val, reg, idx = -EINVAL; + int ref, val, reg, idx; static const int div[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48};
val = snd_soc_component_read(component, RT5668_GPIO_CTRL_1) &
cppcheck warning:
sound/soc/codecs/rt5670.c:2519:61: style: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition] (pll_code.m_bp ? 0 : pll_code.m_code) << RT5670_PLL_M_SFT | ^
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/codecs/rt5670.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c index 4063aac2a443..8dcda24f3ceb 100644 --- a/sound/soc/codecs/rt5670.c +++ b/sound/soc/codecs/rt5670.c @@ -2588,8 +2588,8 @@ static int rt5670_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, snd_soc_component_write(component, RT5670_PLL_CTRL1, pll_code.n_code << RT5670_PLL_N_SFT | pll_code.k_code); snd_soc_component_write(component, RT5670_PLL_CTRL2, - (pll_code.m_bp ? 0 : pll_code.m_code) << RT5670_PLL_M_SFT | - pll_code.m_bp << RT5670_PLL_M_BP_SFT); + ((pll_code.m_bp ? 0 : pll_code.m_code) << RT5670_PLL_M_SFT) | + (pll_code.m_bp << RT5670_PLL_M_BP_SFT));
rt5670->pll_in = freq_in; rt5670->pll_out = freq_out;
cppcheck warning:
sound/soc/codecs/rt5677.c:4571:61: style: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition] (pll_code.m_bp ? 0 : pll_code.m_code) << RT5677_PLL_M_SFT | ^
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/codecs/rt5677.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index 9e449d35fc28..bc5d1d73470e 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c @@ -4568,8 +4568,8 @@ static int rt5677_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, regmap_write(rt5677->regmap, RT5677_PLL1_CTRL1, pll_code.n_code << RT5677_PLL_N_SFT | pll_code.k_code); regmap_write(rt5677->regmap, RT5677_PLL1_CTRL2, - (pll_code.m_bp ? 0 : pll_code.m_code) << RT5677_PLL_M_SFT | - pll_code.m_bp << RT5677_PLL_M_BP_SFT); + ((pll_code.m_bp ? 0 : pll_code.m_code) << RT5677_PLL_M_SFT) | + (pll_code.m_bp << RT5677_PLL_M_BP_SFT));
rt5677->pll_in = freq_in; rt5677->pll_out = freq_out;
cppcheck warning:
sound/soc/codecs/rt5677.c:5335:10: style: Variable 'ret' is assigned a value that is never used. [unreadVariable] int ret = 0, loop, i, reg_irq, virq; ^
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/codecs/rt5677.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index bc5d1d73470e..f655228c8c4b 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c @@ -5332,7 +5332,7 @@ static bool rt5677_check_hotword(struct rt5677_priv *rt5677) static irqreturn_t rt5677_irq(int unused, void *data) { struct rt5677_priv *rt5677 = data; - int ret = 0, loop, i, reg_irq, virq; + int ret, loop, i, reg_irq, virq; bool irq_fired = false;
mutex_lock(&rt5677->irq_lock);
cppcheck warning:
sound/soc/codecs/rt5682.c:2401:65: style: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition] (pll_code.m_bp ? 0 : pll_code.m_code) << RT5682_PLL_M_SFT |
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/codecs/rt5682.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c index b306ac4b9b2e..e4542200009d 100644 --- a/sound/soc/codecs/rt5682.c +++ b/sound/soc/codecs/rt5682.c @@ -2396,10 +2396,10 @@ static int rt5682_set_component_pll(struct snd_soc_component *component, pll_code.n_code, pll_code.k_code);
snd_soc_component_write(component, RT5682_PLL_CTRL_1, - pll_code.n_code << RT5682_PLL_N_SFT | pll_code.k_code); + (pll_code.n_code << RT5682_PLL_N_SFT) | pll_code.k_code); snd_soc_component_write(component, RT5682_PLL_CTRL_2, - (pll_code.m_bp ? 0 : pll_code.m_code) << RT5682_PLL_M_SFT | - pll_code.m_bp << RT5682_PLL_M_BP_SFT | RT5682_PLL_RST); + ((pll_code.m_bp ? 0 : pll_code.m_code) << RT5682_PLL_M_SFT) | + (pll_code.m_bp << RT5682_PLL_M_BP_SFT | RT5682_PLL_RST)); }
rt5682->pll_in[pll_id] = freq_in;
cppcheck warnings:
sound/soc/codecs/rt5682.c:1234:6: style: Redundant initialization for 'idx'. The initialized value is overwritten before it is read. [redundantInitialization] idx = rt5682_div_sel(rt5682, dmic_clk_rate, div, ARRAY_SIZE(div)); ^ sound/soc/codecs/rt5682.c:1228:10: note: idx is initialized int idx = -EINVAL, dmic_clk_rate = 3072000; ^ sound/soc/codecs/rt5682.c:1234:6: note: idx is overwritten idx = rt5682_div_sel(rt5682, dmic_clk_rate, div, ARRAY_SIZE(div)); ^
sound/soc/codecs/rt5682.c:1263:6: style: Redundant initialization for 'idx'. The initialized value is overwritten before it is read. [redundantInitialization] idx = rt5682_div_sel(rt5682, ref, div_f, ARRAY_SIZE(div_f)); ^ sound/soc/codecs/rt5682.c:1248:25: note: idx is initialized int ref, val, reg, idx = -EINVAL; ^ sound/soc/codecs/rt5682.c:1263:6: note: idx is overwritten idx = rt5682_div_sel(rt5682, ref, div_f, ARRAY_SIZE(div_f)); ^
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/codecs/rt5682.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c index e4542200009d..8d5b8f01f55c 100644 --- a/sound/soc/codecs/rt5682.c +++ b/sound/soc/codecs/rt5682.c @@ -1225,7 +1225,7 @@ static int set_dmic_clk(struct snd_soc_dapm_widget *w, struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component); - int idx = -EINVAL, dmic_clk_rate = 3072000; + int idx, dmic_clk_rate = 3072000; static const int div[] = {2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128};
if (rt5682->pdata.dmic_clk_rate) @@ -1245,7 +1245,7 @@ static int set_filter_clk(struct snd_soc_dapm_widget *w, struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component); - int ref, val, reg, idx = -EINVAL; + int ref, val, reg, idx; static const int div_f[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48}; static const int div_o[] = {1, 2, 4, 6, 8, 12, 16, 24, 32, 48};
cppcheck complains about a possible null pointer dereference, but the problem is rather an useless initialization before walking through a list.
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/codecs/rt5682.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c index 8d5b8f01f55c..559dc6db1f7c 100644 --- a/sound/soc/codecs/rt5682.c +++ b/sound/soc/codecs/rt5682.c @@ -2751,7 +2751,7 @@ static int rt5682_bclk_set_rate(struct clk_hw *hw, unsigned long rate, container_of(hw, struct rt5682_priv, dai_clks_hw[RT5682_DAI_BCLK_IDX]); struct snd_soc_component *component = rt5682->component; - struct snd_soc_dai *dai = NULL; + struct snd_soc_dai *dai; unsigned long factor;
if (!rt5682_clk_check(rt5682))
On Tue, 2 Mar 2021 15:25:03 -0600, Pierre-Louis Bossart wrote:
Lots of trivial issues that make cppcheck too verbose. There shouldn't be any functionality change with this patchset.
Pierre-Louis Bossart (24): ASoC: rt1011: use logical OR ASoC: rt1011: remove redundant test ASoC: rt1011: clarify expression ASoC: rt1015: clarify expression ASoC: rt1016: clarify expression ASoC: rt1305: clarify expression ASoC: rt1308: clarify expression ASoC: rt5640: clarify expression ASoC: rt5645: use logical OR ASoC: rt5645: clarify expression ASoC: rt5651: clarify expression ASoC: rt5651: remove useless assignment ASoC: rt5659: clarify expression ASoC: rt5660: clarify expression ASoC: rt5663: clarify expression ASoC: rt5665: clarify expression ASoC: rt5668: clarify expression ASoC: rt5668: remove useless assignments ASoC: rt5670: clarify expression ASoC: rt5677: clarify expression ASoC: rt5677: remove useless assignment ASoC: rt5682: clarify expression ASoC: rt5682: remove useless assignments ASoC: rt5682: remove useless initialization
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[01/24] ASoC: rt1011: use logical OR commit: 5acc964734db7ec5b2d8d1dd22cee32594a551f3 [02/24] ASoC: rt1011: remove redundant test commit: c573fca0fac3f5eca28a0780ab5ecbb1deacb386 [03/24] ASoC: rt1011: clarify expression commit: 068bde16c9d1fdf2ae2fd62ce3fba536eaea623d [04/24] ASoC: rt1015: clarify expression commit: 2f76b7f704f2155a2da2a8d0f7d5253e12c6fdf5 [05/24] ASoC: rt1016: clarify expression commit: 175a02a87b5a938bb664ceae33121bfeba2b45c1 [06/24] ASoC: rt1305: clarify expression commit: 25d4b3c27916a0d723e2cdc1550f239869eefdf4 [07/24] ASoC: rt1308: clarify expression commit: 2e0c5a4fdb83bb8d816edb6c12948e95f13cb741 [08/24] ASoC: rt5640: clarify expression commit: 88704a9c9b6d7ee7ec3018fd248130ce46acfc38 [09/24] ASoC: rt5645: use logical OR commit: 8fb4c29534f45c2bc34881960453ff133bcedb36 [10/24] ASoC: rt5645: clarify expression commit: 1a96045422465d1edb75bc80292294d73e29fa4b [11/24] ASoC: rt5651: clarify expression commit: 5906d0c64ddc090b7fa7f26b72ca133b803fb1e4 [12/24] ASoC: rt5651: remove useless assignment commit: 0b6fe4729dfb39920fefac41d752b48914ee901e [13/24] ASoC: rt5659: clarify expression commit: 54ae982a9fd4dc2d18cdc45201b92b02a08fcc27 [14/24] ASoC: rt5660: clarify expression commit: 4b5fdec4f702ce626025f7820b618c5e6915141a [15/24] ASoC: rt5663: clarify expression commit: 7fe6b7ffe542055107dcc5f3d70dd5877ce86ae0 [16/24] ASoC: rt5665: clarify expression commit: ef138bbc4eb001898437e4c4f93d5b6076c63fba [17/24] ASoC: rt5668: clarify expression commit: c7c2a964c73e3e4b571da7b8e185fbf9e054bc3d [18/24] ASoC: rt5668: remove useless assignments commit: 9fe9e3733061d9e1037048e7a73d35860506c447 [19/24] ASoC: rt5670: clarify expression commit: 78d61c46ac12ce112682b9848bb50b7e0105962a [20/24] ASoC: rt5677: clarify expression commit: 71205f24bf7906a104c118d339e91d3bc3d49b89 [21/24] ASoC: rt5677: remove useless assignment commit: aeaf814964282da53696c1ece267f9d27aff025a [22/24] ASoC: rt5682: clarify expression commit: 3398dfd4984a7d164d913124976f85cdb197de90 [23/24] ASoC: rt5682: remove useless assignments commit: df665ec288c78884ce8f1dbe5e90805c919e4cdf [24/24] ASoC: rt5682: remove useless initialization commit: 175fb03e241919cd1bad3d599bf306ae8eb66f23
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
participants (2)
-
Mark Brown
-
Pierre-Louis Bossart