Skip to contentSkip to conversation

ASoC: cppcheck fixes of the week

PATCH In review Pierre-Louis Bossart 2 participants 6 messages Apr 26, 2021 – May 11, 2021

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

cover ASoC: cppcheck fixes of the week

While running some checks on a rebased branch, I realized I missed a couple of trivial cases on newer code.

Pierre-Louis Bossart (4):
ASoC: codecs: mt6359-accdet: remove useless initialization
ASoc: codecs: mt6359: remove useless initializations
ASoC: codecs: rt1019: clarify expression
ASoC: fsl: imx-pcm-rpmsg: remove useless initialization

 sound/soc/codecs/mt6359-accdet.c | 2 +-
 sound/soc/codecs/mt6359.c        | 2 +-
 sound/soc/codecs/rt1019.c        | 4 ++--
 sound/soc/fsl/imx-pcm-rpmsg.c    | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/4 ASoC: codecs: mt6359-accdet: remove useless initialization

cppcheck warning

sound/soc/codecs/mt6359-accdet.c:417:10: style: Variable 'ret' is assigned a value that is never used. [unreadVariable]

 int ret = 0;
         ^

sound/soc/codecs/mt6359-accdet.c:464:10: style: Variable 'ret' is assigned a value that is never used. [unreadVariable]

 int ret = 0;
         ^
---
 sound/soc/codecs/mt6359-accdet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/mt6359-accdet.c +1 -1
index 4222aed013f1..78314187d37e 100644
@@ -414,7 +414,7 @@ static void mt6359_accdet_work(struct work_struct *work)
 
 static void mt6359_accdet_jd_work(struct work_struct *work)
 {
-	int ret = 0;
+	int ret;
 	unsigned int value = 0;
 
 	struct mt6359_accdet *priv =
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/4 ASoc: codecs: mt6359: remove useless initializations

In reply to Pierre-Louis Bossart

cppcheck warning:

sound/soc/codecs/mt6359.c:274:8: style: Variable 'i' is assigned a value that is never used. [unreadVariable]

 int i = 0, stage = 0;
       ^
sound/soc/codecs/mt6359.c:274:19: style: Variable 'stage' is assigned
a value that is never used. [unreadVariable]
 int i = 0, stage = 0;
                  ^
---
 sound/soc/codecs/mt6359.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/mt6359.c +1 -1
index b909b36582b7..2d6a4a29b850 100644
@@ -271,7 +271,7 @@ static void hp_aux_feedback_loop_gain_ramp(struct mt6359_priv *priv, bool up)
 
 static void hp_in_pair_current(struct mt6359_priv *priv, bool increase)
 {
-	int i = 0, stage = 0;
+	int i, stage;
 	int target = 0x3;
 
 	/* Set input diff pair bias select (Hi-Fi mode) */
Signature · 1 line
2.25.1
#3 lore raw

PATCH 3/4 ASoC: codecs: rt1019: clarify expression

In reply to Pierre-Louis Bossart

cppcheck warning, add parentheses:

sound/soc/codecs/rt1019.c:375:61: style: Boolean result is used in bitwise operation. Clarify expression with
parentheses. [clarifyCondition]
(pll_code.m_bp ? 0 : pll_code.m_code) << RT1019_PLL_M_SFT |

                                                            ^
---
 sound/soc/codecs/rt1019.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/rt1019.c +2 -2
index 10656a5927f1..1ed85eca4888 100644
@@ -372,8 +372,8 @@ static int rt1019_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source,
 		RT1019_AUTO_BITS_SEL_MANU | RT1019_AUTO_CLK_SEL_MANU);
 	snd_soc_component_update_bits(component, RT1019_PLL_1,
 		RT1019_PLL_M_MASK | RT1019_PLL_M_BP_MASK | RT1019_PLL_Q_8_8_MASK,
-		(pll_code.m_bp ? 0 : pll_code.m_code) << RT1019_PLL_M_SFT |
-		pll_code.m_bp << RT1019_PLL_M_BP_SFT |
+		((pll_code.m_bp ? 0 : pll_code.m_code) << RT1019_PLL_M_SFT) |
+		(pll_code.m_bp << RT1019_PLL_M_BP_SFT) |
 		((pll_code.n_code >> 8) & RT1019_PLL_Q_8_8_MASK));
 	snd_soc_component_update_bits(component, RT1019_PLL_2,
 		RT1019_PLL_Q_7_0_MASK, pll_code.n_code & RT1019_PLL_Q_7_0_MASK);
Signature · 1 line
2.25.1
#4 lore raw

PATCH 4/4 ASoC: fsl: imx-pcm-rpmsg: remove useless initialization

In reply to Pierre-Louis Bossart

cppcheck warning:

sound/soc/fsl/imx-pcm-rpmsg.c:547:18: style: Variable 'written_num' is assigned a value that is never used. [unreadVariable]

 int written_num = 0;
                 ^
---
 sound/soc/fsl/imx-pcm-rpmsg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/fsl/imx-pcm-rpmsg.c +1 -1
index 875c0d6df339..6d883a10efd1 100644
@@ -544,7 +544,7 @@ static int imx_rpmsg_pcm_ack(struct snd_soc_component *component,
 	struct rpmsg_msg *msg;
 	unsigned long flags;
 	int buffer_tail = 0;
-	int written_num = 0;
+	int written_num;
 
 	if (!rpmsg->force_lpa)
 		return 0;
Signature · 1 line
2.25.1
maintainer
#5 lore raw
In reply to Pierre-Louis Bossart
Quoted 10 lines · Pierre-Louis Bossart

While running some checks on a rebased branch, I realized I missed a couple of trivial cases on newer code.

Pierre-Louis Bossart (4):
ASoC: codecs: mt6359-accdet: remove useless initialization
ASoc: codecs: mt6359: remove useless initializations
ASoC: codecs: rt1019: clarify expression
ASoC: fsl: imx-pcm-rpmsg: remove useless initialization

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/4] ASoC: codecs: mt6359-accdet: remove useless initialization

      commit: b76d1d86a456fa495f8f74c967b5d646f20915c3
[2/4] ASoc: codecs: mt6359: remove useless initializations
      commit: d51f6dfb9c9843f82825187baa78f0f4c1ec6ac7
[3/4] ASoC: codecs: rt1019: clarify expression
      commit: 16255d4155da9ec8fcafcd7460a334e2e52f934e
[4/4] ASoC: fsl: imx-pcm-rpmsg: remove useless initialization
      commit: cccc16dc175eafa2dec98002dde35d19ace0a696

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