linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/23] ASoC: codecs: remove cppcheck warnings
@ 2021-03-12 18:22 Pierre-Louis Bossart
  2021-03-12 18:22 ` [PATCH 01/23] ASoC: ab8500-codec: remove useless structure Pierre-Louis Bossart
                   ` (23 more replies)
  0 siblings, 24 replies; 32+ messages in thread
From: Pierre-Louis Bossart @ 2021-03-12 18:22 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, linux-kernel, Pierre-Louis Bossart

Lots of small fixes in various codec drivers that should have no
functional impact.

Pierre-Louis Bossart (23):
  ASoC: ab8500-codec: remove useless structure
  ASoC: ad1836: remove useless return
  ASoC: adau1977: remove useless return
  ASoC: cros_ec_codec: remove null pointer dereference warning
  ASoC: cx2070x: remove useless assignment
  ASoC: cx2070x: remove duplicate else branch
  ASoC: da7219-aad: remove useless initialization
  ASoC: hdac_hdmi: remove useless initializations
  ASoC: hdac_hdmi: align function arguments
  ASoC: hdmi-codec: remove useless initialization
  ASoC: hdmi-codec: remove unused spk_mask member
  ASoC: max98090: remove useless assignment
  ASoC: mt6358: remove useless initializations
  ASoC: mt6359: remove useless assignment
  ASoC: nau8825: remove useless assignment
  ASoC: pcm1681: remove useless assignment
  ASoC: sigmadsp: align function prototype
  ASoC: sti-sas: remove unused struct members
  ASoC: tas2562: remove useless assignment
  ASoC: tas2562: remove warning on return value
  ASoC: tas2770: remove useless initialization
  ASoC: tlv320dac33: clarify expression
  ASoC: tscs454: remove useless test on PLL disable

 sound/soc/codecs/ab8500-codec.c  |  7 -------
 sound/soc/codecs/ad1836.c        |  2 --
 sound/soc/codecs/adau1977.c      |  2 --
 sound/soc/codecs/cros_ec_codec.c |  2 +-
 sound/soc/codecs/cx2072x.c       | 11 ++++-------
 sound/soc/codecs/da7219-aad.c    |  2 +-
 sound/soc/codecs/hdac_hdmi.c     | 14 +++++++-------
 sound/soc/codecs/hdac_hdmi.h     |  2 +-
 sound/soc/codecs/hdmi-codec.c    |  3 +--
 sound/soc/codecs/max98090.c      |  2 +-
 sound/soc/codecs/mt6358.c        |  4 ++--
 sound/soc/codecs/mt6359.c        |  4 ++--
 sound/soc/codecs/nau8825.c       |  2 +-
 sound/soc/codecs/pcm1681.c       |  2 +-
 sound/soc/codecs/sigmadsp.h      |  2 +-
 sound/soc/codecs/sti-sas.c       |  3 ---
 sound/soc/codecs/tas2562.c       |  3 +--
 sound/soc/codecs/tas2770.c       |  2 +-
 sound/soc/codecs/tlv320dac33.c   |  2 +-
 sound/soc/codecs/tscs454.c       |  7 ++++++-
 20 files changed, 32 insertions(+), 46 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 01/23] ASoC: ab8500-codec: remove useless structure
  2021-03-12 18:22 [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Pierre-Louis Bossart
@ 2021-03-12 18:22 ` Pierre-Louis Bossart
  2021-03-12 18:22 ` [PATCH 02/23] ASoC: ad1836: remove useless return Pierre-Louis Bossart
                   ` (22 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Pierre-Louis Bossart @ 2021-03-12 18:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, broonie, linux-kernel, Pierre-Louis Bossart,
	Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto,
	Gustavo A. R. Silva

Cppcheck warnings:

sound/soc/codecs/ab8500-codec.c:117:20: style: struct member 'ab8500_codec_drvdata_dbg::vaud' is never used. [unusedStructMember]
 struct regulator *vaud;
                   ^
sound/soc/codecs/ab8500-codec.c:118:20: style: struct member 'ab8500_codec_drvdata_dbg::vamic1' is never used. [unusedStructMember]
 struct regulator *vamic1;
                   ^
sound/soc/codecs/ab8500-codec.c:119:20: style: struct member 'ab8500_codec_drvdata_dbg::vamic2' is never used. [unusedStructMember]
 struct regulator *vamic2;
                   ^
sound/soc/codecs/ab8500-codec.c:120:20: style: struct member 'ab8500_codec_drvdata_dbg::vdmic' is never used. [unusedStructMember]
 struct regulator *vdmic;
                   ^

The structure is never used, remove.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/ab8500-codec.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/sound/soc/codecs/ab8500-codec.c b/sound/soc/codecs/ab8500-codec.c
index c95f007cede1..5525e1ccab76 100644
--- a/sound/soc/codecs/ab8500-codec.c
+++ b/sound/soc/codecs/ab8500-codec.c
@@ -113,13 +113,6 @@ enum amic_idx {
 	AMIC_IDX_2
 };
 
-struct ab8500_codec_drvdata_dbg {
-	struct regulator *vaud;
-	struct regulator *vamic1;
-	struct regulator *vamic2;
-	struct regulator *vdmic;
-};
-
 /* Private data for AB8500 device-driver */
 struct ab8500_codec_drvdata {
 	struct regmap *regmap;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 02/23] ASoC: ad1836: remove useless return
  2021-03-12 18:22 [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Pierre-Louis Bossart
  2021-03-12 18:22 ` [PATCH 01/23] ASoC: ab8500-codec: remove useless structure Pierre-Louis Bossart
@ 2021-03-12 18:22 ` Pierre-Louis Bossart
  2021-03-12 18:50   ` Lars-Peter Clausen
  2021-03-12 18:22 ` [PATCH 03/23] ASoC: adau1977: " Pierre-Louis Bossart
                   ` (21 subsequent siblings)
  23 siblings, 1 reply; 32+ messages in thread
From: Pierre-Louis Bossart @ 2021-03-12 18:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, broonie, linux-kernel, Pierre-Louis Bossart,
	Lars-Peter Clausen, Nuno Sá,
	Liam Girdwood, Jaroslav Kysela, Takashi Iwai

Cppcheck warning:

sound/soc/codecs/ad1836.c:311:9: warning: Identical condition and return expression 'ret', return value is always 0 [identicalConditionAfterEarlyExit]
 return ret;
        ^
sound/soc/codecs/ad1836.c:308:6: note: If condition 'ret' is true, the function will return/exit
 if (ret)
     ^
sound/soc/codecs/ad1836.c:311:9: note: Returning identical expression 'ret'
 return ret;
        ^

Likely copy/paste between adc and dac cases.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/ad1836.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/codecs/ad1836.c b/sound/soc/codecs/ad1836.c
index a46152560294..08a5651bed9f 100644
--- a/sound/soc/codecs/ad1836.c
+++ b/sound/soc/codecs/ad1836.c
@@ -305,8 +305,6 @@ static int ad1836_probe(struct snd_soc_component *component)
 		return ret;
 
 	ret = snd_soc_dapm_add_routes(dapm, ad183x_adc_routes, num_adcs);
-	if (ret)
-		return ret;
 
 	return ret;
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 03/23] ASoC: adau1977: remove useless return
  2021-03-12 18:22 [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Pierre-Louis Bossart
  2021-03-12 18:22 ` [PATCH 01/23] ASoC: ab8500-codec: remove useless structure Pierre-Louis Bossart
  2021-03-12 18:22 ` [PATCH 02/23] ASoC: ad1836: remove useless return Pierre-Louis Bossart
@ 2021-03-12 18:22 ` Pierre-Louis Bossart
  2021-03-12 18:22 ` [PATCH 04/23] ASoC: cros_ec_codec: remove null pointer dereference warning Pierre-Louis Bossart
                   ` (20 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Pierre-Louis Bossart @ 2021-03-12 18:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, broonie, linux-kernel, Pierre-Louis Bossart,
	Lars-Peter Clausen, Nuno Sá,
	Liam Girdwood, Jaroslav Kysela, Takashi Iwai

Cppcheck warning:

sound/soc/codecs/adau1977.c:242:9: warning: Identical condition and
return expression 'ret', return value is always 0
[identicalConditionAfterEarlyExit]

 return ret;
        ^
sound/soc/codecs/adau1977.c:239:6: note: If condition 'ret' is true,
the function will return/exit

 if (ret)
     ^
sound/soc/codecs/adau1977.c:242:9: note: Returning identical expression 'ret'
 return ret;
        ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/adau1977.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/codecs/adau1977.c b/sound/soc/codecs/adau1977.c
index 8260f49caa24..e347a48131d1 100644
--- a/sound/soc/codecs/adau1977.c
+++ b/sound/soc/codecs/adau1977.c
@@ -236,8 +236,6 @@ static int adau1977_reset(struct adau1977 *adau1977)
 	ret = regmap_write(adau1977->regmap, ADAU1977_REG_POWER,
 			ADAU1977_POWER_RESET);
 	regcache_cache_bypass(adau1977->regmap, false);
-	if (ret)
-		return ret;
 
 	return ret;
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 04/23] ASoC: cros_ec_codec: remove null pointer dereference warning
  2021-03-12 18:22 [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Pierre-Louis Bossart
                   ` (2 preceding siblings ...)
  2021-03-12 18:22 ` [PATCH 03/23] ASoC: adau1977: " Pierre-Louis Bossart
@ 2021-03-12 18:22 ` Pierre-Louis Bossart
  2021-03-15 10:39   ` Enric Balletbo i Serra
  2021-03-12 18:22 ` [PATCH 05/23] ASoC: cx2070x: remove useless assignment Pierre-Louis Bossart
                   ` (19 subsequent siblings)
  23 siblings, 1 reply; 32+ messages in thread
From: Pierre-Louis Bossart @ 2021-03-12 18:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, broonie, linux-kernel, Pierre-Louis Bossart,
	Cheng-Yi Chiang, Enric Balletbo i Serra, Guenter Roeck,
	Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Benson Leung

Cppcheck complains of a possible issue:

sound/soc/codecs/cros_ec_codec.c:98:10: warning: Possible null pointer
dereference: in [nullPointer]
  memcpy(in, msg->data, insize);
         ^
sound/soc/codecs/cros_ec_codec.c:162:34: note: Calling function
'send_ec_host_command', 5th argument 'NULL' value is 0
       (uint8_t *)&p, sizeof(p), NULL, 0);
                                 ^
sound/soc/codecs/cros_ec_codec.c:98:10: note: Null pointer dereference
  memcpy(in, msg->data, insize);
         ^

In practice the access to the pointer is protected by another
argument, but this is likely to fool other static analysis tools. Add
a test to avoid doing the memcpy if the pointer is NULL or the size is
zero.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/cros_ec_codec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/cros_ec_codec.c b/sound/soc/codecs/cros_ec_codec.c
index c4772f82485a..a201d652aca2 100644
--- a/sound/soc/codecs/cros_ec_codec.c
+++ b/sound/soc/codecs/cros_ec_codec.c
@@ -94,7 +94,7 @@ static int send_ec_host_command(struct cros_ec_device *ec_dev, uint32_t cmd,
 	if (ret < 0)
 		goto error;
 
-	if (insize)
+	if (in && insize)
 		memcpy(in, msg->data, insize);
 
 	ret = 0;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 05/23] ASoC: cx2070x: remove useless assignment
  2021-03-12 18:22 [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Pierre-Louis Bossart
                   ` (3 preceding siblings ...)
  2021-03-12 18:22 ` [PATCH 04/23] ASoC: cros_ec_codec: remove null pointer dereference warning Pierre-Louis Bossart
@ 2021-03-12 18:22 ` Pierre-Louis Bossart
  2021-03-14  8:30   ` Takashi Iwai
  2021-03-14  8:30   ` Takashi Iwai
  2021-03-12 18:22 ` [PATCH 06/23] ASoC: cx2070x: remove duplicate else branch Pierre-Louis Bossart
                   ` (18 subsequent siblings)
  23 siblings, 2 replies; 32+ messages in thread
From: Pierre-Louis Bossart @ 2021-03-12 18:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, broonie, linux-kernel, Pierre-Louis Bossart,
	Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto

Cppcheck warning:

sound/soc/codecs/cx2072x.c:830:26: style: Variable
'reg1.r.rx_data_one_line' is reassigned a value before the old one has
been used. [redundantAssignment]

 reg1.r.rx_data_one_line = 1;
                         ^

sound/soc/codecs/cx2072x.c:782:26: note: reg1.r.rx_data_one_line is
assigned
 reg1.r.rx_data_one_line = 1;
                         ^

sound/soc/codecs/cx2072x.c:830:26: note: reg1.r.rx_data_one_line is
overwritten
 reg1.r.rx_data_one_line = 1;
                         ^

sound/soc/codecs/cx2072x.c:831:26: style: Variable
'reg1.r.tx_data_one_line' is reassigned a value before the old one has
been used. [redundantAssignment]
 reg1.r.tx_data_one_line = 1;
                         ^
sound/soc/codecs/cx2072x.c:783:26: note: reg1.r.tx_data_one_line is
assigned
 reg1.r.tx_data_one_line = 1;
                         ^

sound/soc/codecs/cx2072x.c:831:26: note: reg1.r.tx_data_one_line is
overwritten
 reg1.r.tx_data_one_line = 1;
                         ^

Likely copy/paste.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/cx2072x.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/sound/soc/codecs/cx2072x.c b/sound/soc/codecs/cx2072x.c
index 8ab22815c2c9..d2d004654c9b 100644
--- a/sound/soc/codecs/cx2072x.c
+++ b/sound/soc/codecs/cx2072x.c
@@ -827,9 +827,6 @@ static int cx2072x_config_i2spcm(struct cx2072x_priv *cx2072x)
 	}
 	regdbt2.r.i2s_bclk_invert = is_bclk_inv;
 
-	reg1.r.rx_data_one_line = 1;
-	reg1.r.tx_data_one_line = 1;
-
 	/* Configures the BCLK output */
 	bclk_rate = cx2072x->sample_rate * frame_len;
 	reg5.r.i2s_pcm_clk_div_chan_en = 0;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 06/23] ASoC: cx2070x: remove duplicate else branch
  2021-03-12 18:22 [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Pierre-Louis Bossart
                   ` (4 preceding siblings ...)
  2021-03-12 18:22 ` [PATCH 05/23] ASoC: cx2070x: remove useless assignment Pierre-Louis Bossart
@ 2021-03-12 18:22 ` Pierre-Louis Bossart
  2021-03-14  8:32   ` Takashi Iwai
  2021-03-12 18:22 ` [PATCH 07/23] ASoC: da7219-aad: remove useless initialization Pierre-Louis Bossart
                   ` (17 subsequent siblings)
  23 siblings, 1 reply; 32+ messages in thread
From: Pierre-Louis Bossart @ 2021-03-12 18:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, broonie, linux-kernel, Pierre-Louis Bossart,
	Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto

cppcheck warning:

sound/soc/codecs/cx2072x.c:1436:10: style:inconclusive: Found
duplicate branches for 'if' and 'else'. [duplicateBranch]
  } else if (type & 0x4) {
         ^
sound/soc/codecs/cx2072x.c:1439:5: note: Found duplicate branches for
'if' and 'else'.
  } else {
    ^
sound/soc/codecs/cx2072x.c:1436:10: note: Found duplicate branches for
'if' and 'else'.
  } else if (type & 0x4) {
         ^

The last two branches do the same thing and can be collapsed together.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/cx2072x.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/cx2072x.c b/sound/soc/codecs/cx2072x.c
index d2d004654c9b..d924e3528029 100644
--- a/sound/soc/codecs/cx2072x.c
+++ b/sound/soc/codecs/cx2072x.c
@@ -1430,11 +1430,11 @@ static int cx2072x_jack_status_check(void *data)
 			state |= SND_JACK_HEADSET;
 			if (type & 0x2)
 				state |= SND_JACK_BTN_0;
-		} else if (type & 0x4) {
-			/* Nokia headset */
-			state |= SND_JACK_HEADPHONE;
 		} else {
-			/* Headphone */
+			/*
+			 * Nokia headset (type & 0x4) and
+			 * regular Headphone
+			 */
 			state |= SND_JACK_HEADPHONE;
 		}
 	}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 07/23] ASoC: da7219-aad: remove useless initialization
  2021-03-12 18:22 [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Pierre-Louis Bossart
                   ` (5 preceding siblings ...)
  2021-03-12 18:22 ` [PATCH 06/23] ASoC: cx2070x: remove duplicate else branch Pierre-Louis Bossart
@ 2021-03-12 18:22 ` Pierre-Louis Bossart
  2021-03-15 14:50   ` Adam Thomson
  2021-03-12 18:22 ` [PATCH 08/23] ASoC: hdac_hdmi: remove useless initializations Pierre-Louis Bossart
                   ` (16 subsequent siblings)
  23 siblings, 1 reply; 32+ messages in thread
From: Pierre-Louis Bossart @ 2021-03-12 18:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, broonie, linux-kernel, Pierre-Louis Bossart,
	Support Opensource, Liam Girdwood, Jaroslav Kysela, Takashi Iwai

cppcheck warning:

sound/soc/codecs/da7219-aad.c:118:22: style: Variable 'ret' is
assigned a value that is never used. [unreadVariable]
 int report = 0, ret = 0;
                     ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/da7219-aad.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/da7219-aad.c b/sound/soc/codecs/da7219-aad.c
index 48081d71c22c..7998fdd3b378 100644
--- a/sound/soc/codecs/da7219-aad.c
+++ b/sound/soc/codecs/da7219-aad.c
@@ -115,7 +115,7 @@ static void da7219_aad_hptest_work(struct work_struct *work)
 
 	__le16 tonegen_freq_hptest;
 	u8 pll_srm_sts, pll_ctrl, gain_ramp_ctrl, accdet_cfg8;
-	int report = 0, ret = 0;
+	int report = 0, ret;
 
 	/* Lock DAPM, Kcontrols affected by this test and the PLL */
 	snd_soc_dapm_mutex_lock(dapm);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 08/23] ASoC: hdac_hdmi: remove useless initializations
  2021-03-12 18:22 [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Pierre-Louis Bossart
                   ` (6 preceding siblings ...)
  2021-03-12 18:22 ` [PATCH 07/23] ASoC: da7219-aad: remove useless initialization Pierre-Louis Bossart
@ 2021-03-12 18:22 ` Pierre-Louis Bossart
  2021-03-12 18:22 ` [PATCH 09/23] ASoC: hdac_hdmi: align function arguments Pierre-Louis Bossart
                   ` (15 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Pierre-Louis Bossart @ 2021-03-12 18:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, broonie, linux-kernel, Pierre-Louis Bossart,
	Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Brent Lu,
	Guennadi Liakhovetski, Amadeusz Sławiński,
	Dan Carpenter

Cppcheck complains a lot about possible null pointer dereferences but
it's again a case of useless initializations to NULL.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/hdac_hdmi.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c
index 2c1305bf0572..66408a98298b 100644
--- a/sound/soc/codecs/hdac_hdmi.c
+++ b/sound/soc/codecs/hdac_hdmi.c
@@ -523,7 +523,7 @@ static struct hdac_hdmi_port *hdac_hdmi_get_port_from_cvt(
 			struct hdac_hdmi_cvt *cvt)
 {
 	struct hdac_hdmi_pcm *pcm;
-	struct hdac_hdmi_port *port = NULL;
+	struct hdac_hdmi_port *port;
 	int ret, i;
 
 	list_for_each_entry(pcm, &hdmi->pcm_list, head) {
@@ -713,7 +713,7 @@ static struct hdac_hdmi_pcm *hdac_hdmi_get_pcm(struct hdac_device *hdev,
 					struct hdac_hdmi_port *port)
 {
 	struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
-	struct hdac_hdmi_pcm *pcm = NULL;
+	struct hdac_hdmi_pcm *pcm;
 	struct hdac_hdmi_port *p;
 
 	list_for_each_entry(pcm, &hdmi->pcm_list, head) {
@@ -900,7 +900,7 @@ static int hdac_hdmi_set_pin_port_mux(struct snd_kcontrol *kcontrol,
 	struct hdac_hdmi_port *port = w->priv;
 	struct hdac_device *hdev = dev_to_hdac_dev(dapm->dev);
 	struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
-	struct hdac_hdmi_pcm *pcm = NULL;
+	struct hdac_hdmi_pcm *pcm;
 	const char *cvt_name =  e->texts[ucontrol->value.enumerated.item[0]];
 
 	ret = snd_soc_dapm_put_enum_double(kcontrol, ucontrol);
@@ -1693,7 +1693,7 @@ static void hdac_hdmi_eld_notify_cb(void *aptr, int port, int pipe)
 {
 	struct hdac_device *hdev = aptr;
 	struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
-	struct hdac_hdmi_pin *pin = NULL;
+	struct hdac_hdmi_pin *pin;
 	struct hdac_hdmi_port *hport = NULL;
 	struct snd_soc_component *component = hdmi->component;
 	int i;
@@ -1958,7 +1958,7 @@ static int hdmi_codec_probe(struct snd_soc_component *component)
 	struct hdac_device *hdev = hdmi->hdev;
 	struct snd_soc_dapm_context *dapm =
 		snd_soc_component_get_dapm(component);
-	struct hdac_ext_link *hlink = NULL;
+	struct hdac_ext_link *hlink;
 	int ret;
 
 	hdmi->component = component;
@@ -2227,7 +2227,7 @@ static int hdac_hdmi_runtime_suspend(struct device *dev)
 {
 	struct hdac_device *hdev = dev_to_hdac_dev(dev);
 	struct hdac_bus *bus = hdev->bus;
-	struct hdac_ext_link *hlink = NULL;
+	struct hdac_ext_link *hlink;
 
 	dev_dbg(dev, "Enter: %s\n", __func__);
 
@@ -2263,7 +2263,7 @@ static int hdac_hdmi_runtime_resume(struct device *dev)
 {
 	struct hdac_device *hdev = dev_to_hdac_dev(dev);
 	struct hdac_bus *bus = hdev->bus;
-	struct hdac_ext_link *hlink = NULL;
+	struct hdac_ext_link *hlink;
 
 	dev_dbg(dev, "Enter: %s\n", __func__);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 09/23] ASoC: hdac_hdmi: align function arguments
  2021-03-12 18:22 [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Pierre-Louis Bossart
                   ` (7 preceding siblings ...)
  2021-03-12 18:22 ` [PATCH 08/23] ASoC: hdac_hdmi: remove useless initializations Pierre-Louis Bossart
@ 2021-03-12 18:22 ` Pierre-Louis Bossart
  2021-03-12 18:22 ` [PATCH 10/23] ASoC: hdmi-codec: remove useless initialization Pierre-Louis Bossart
                   ` (14 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Pierre-Louis Bossart @ 2021-03-12 18:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, broonie, linux-kernel, Pierre-Louis Bossart,
	Liam Girdwood, Jaroslav Kysela, Takashi Iwai

cppcheck warning:

sound/soc/codecs/hdac_hdmi.c:1882:54: style:inconclusive: Function
'hdac_hdmi_jack_init' argument 2 names different: declaration 'pcm'
definition 'device'. [funcArgNamesDifferent]
int hdac_hdmi_jack_init(struct snd_soc_dai *dai, int device,
                                                     ^
sound/soc/codecs/hdac_hdmi.h:5:54: note: Function
'hdac_hdmi_jack_init' argument 2 names different: declaration 'pcm'
definition 'device'.
int hdac_hdmi_jack_init(struct snd_soc_dai *dai, int pcm,
                                                     ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/hdac_hdmi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/hdac_hdmi.h b/sound/soc/codecs/hdac_hdmi.h
index 4fa2fc9ee893..493fa3b4ef75 100644
--- a/sound/soc/codecs/hdac_hdmi.h
+++ b/sound/soc/codecs/hdac_hdmi.h
@@ -2,7 +2,7 @@
 #ifndef __HDAC_HDMI_H__
 #define __HDAC_HDMI_H__
 
-int hdac_hdmi_jack_init(struct snd_soc_dai *dai, int pcm,
+int hdac_hdmi_jack_init(struct snd_soc_dai *dai, int device,
 				struct snd_soc_jack *jack);
 
 int hdac_hdmi_jack_port_init(struct snd_soc_component *component,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 10/23] ASoC: hdmi-codec: remove useless initialization
  2021-03-12 18:22 [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Pierre-Louis Bossart
                   ` (8 preceding siblings ...)
  2021-03-12 18:22 ` [PATCH 09/23] ASoC: hdac_hdmi: align function arguments Pierre-Louis Bossart
@ 2021-03-12 18:22 ` Pierre-Louis Bossart
  2021-03-12 18:22 ` [PATCH 11/23] ASoC: hdmi-codec: remove unused spk_mask member Pierre-Louis Bossart
                   ` (13 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Pierre-Louis Bossart @ 2021-03-12 18:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, broonie, linux-kernel, Pierre-Louis Bossart,
	Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto,
	Cheng-Yi Chiang, Peter Ujfalusi, Stephan Gerhold, Sia Jee Heng,
	Shengjiu Wang

Fix cppcheck warning:

sound/soc/codecs/hdmi-codec.c:745:5: style: Redundant initialization
for 'cf'. The initialized value is overwritten before it is
read. [redundantInitialization]
 cf = dai->playback_dma_data;
    ^
sound/soc/codecs/hdmi-codec.c:738:31: note: cf is initialized
 struct hdmi_codec_daifmt *cf = dai->playback_dma_data;
                              ^
sound/soc/codecs/hdmi-codec.c:745:5: note: cf is overwritten
 cf = dai->playback_dma_data;
    ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/hdmi-codec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
index 422539f933de..83e74ddccf59 100644
--- a/sound/soc/codecs/hdmi-codec.c
+++ b/sound/soc/codecs/hdmi-codec.c
@@ -735,7 +735,7 @@ static int hdmi_codec_set_jack(struct snd_soc_component *component,
 
 static int hdmi_dai_spdif_probe(struct snd_soc_dai *dai)
 {
-	struct hdmi_codec_daifmt *cf = dai->playback_dma_data;
+	struct hdmi_codec_daifmt *cf;
 	int ret;
 
 	ret = hdmi_dai_probe(dai);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 11/23] ASoC: hdmi-codec: remove unused spk_mask member
  2021-03-12 18:22 [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Pierre-Louis Bossart
                   ` (9 preceding siblings ...)
  2021-03-12 18:22 ` [PATCH 10/23] ASoC: hdmi-codec: remove useless initialization Pierre-Louis Bossart
@ 2021-03-12 18:22 ` Pierre-Louis Bossart
  2021-03-12 18:22 ` [PATCH 12/23] ASoC: max98090: remove useless assignment Pierre-Louis Bossart
                   ` (12 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Pierre-Louis Bossart @ 2021-03-12 18:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, broonie, linux-kernel, Pierre-Louis Bossart,
	Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Cheng-Yi Chiang,
	Kuninori Morimoto, Peter Ujfalusi, Shengjiu Wang,
	Stephan Gerhold

fix cppcheck warning:

sound/soc/codecs/hdmi-codec.c:25:16: style: struct member
'hdmi_codec_channel_map_table::spk_mask' is never
used. [unusedStructMember]
 unsigned long spk_mask;  /* speaker position bit mask */
               ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/hdmi-codec.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
index 83e74ddccf59..1567ba196ab9 100644
--- a/sound/soc/codecs/hdmi-codec.c
+++ b/sound/soc/codecs/hdmi-codec.c
@@ -22,7 +22,6 @@
 
 struct hdmi_codec_channel_map_table {
 	unsigned char map;	/* ALSA API channel map position */
-	unsigned long spk_mask;		/* speaker position bit mask */
 };
 
 /*
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 12/23] ASoC: max98090: remove useless assignment
  2021-03-12 18:22 [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Pierre-Louis Bossart
                   ` (10 preceding siblings ...)
  2021-03-12 18:22 ` [PATCH 11/23] ASoC: hdmi-codec: remove unused spk_mask member Pierre-Louis Bossart
@ 2021-03-12 18:22 ` Pierre-Louis Bossart
  2021-03-12 18:22 ` [PATCH 13/23] ASoC: mt6358: remove useless initializations Pierre-Louis Bossart
                   ` (11 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Pierre-Louis Bossart @ 2021-03-12 18:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, broonie, linux-kernel, Pierre-Louis Bossart,
	Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto,
	Ranjani Sridharan, Krzysztof Kozlowski, Peter Ujfalusi

cppcheck warning:

sound/soc/codecs/max98090.c:1835:16: style: Variable 'test_diff' is
assigned a value that is never used. [unreadVariable]
 int test_diff = INT_MAX;
               ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/max98090.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index 06276ff5f8a3..bc30a1dc7530 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -1832,7 +1832,7 @@ static const struct dmic_table dmic_table[] = { /* One for each pclk freq. */
 static int max98090_find_divisor(int target_freq, int pclk)
 {
 	int current_diff = INT_MAX;
-	int test_diff = INT_MAX;
+	int test_diff;
 	int divisor_index = 0;
 	int i;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 13/23] ASoC: mt6358: remove useless initializations
  2021-03-12 18:22 [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Pierre-Louis Bossart
                   ` (11 preceding siblings ...)
  2021-03-12 18:22 ` [PATCH 12/23] ASoC: max98090: remove useless assignment Pierre-Louis Bossart
@ 2021-03-12 18:22 ` Pierre-Louis Bossart
  2021-03-12 18:22 ` [PATCH 14/23] ASoC: mt6359: remove useless assignment Pierre-Louis Bossart
                   ` (10 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Pierre-Louis Bossart @ 2021-03-12 18:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, broonie, linux-kernel, Pierre-Louis Bossart,
	Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Matthias Brugger,
	Jiaxin Yu, moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

cppcheck warnings:

sound/soc/codecs/mt6358.c:334:19: style: Variable 'stage' is assigned
a value that is never used. [unreadVariable]
 int i = 0, stage = 0;
                  ^
sound/soc/codecs/mt6358.c:350:19: style: Variable 'stage' is assigned
a value that is never used. [unreadVariable]
 int i = 0, stage = 0;
                  ^
185/930 files checked 25% done
Checking sound/soc/codecs/mt6359.c ...
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;
                  ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/mt6358.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/mt6358.c b/sound/soc/codecs/mt6358.c
index 1f39d5998cf6..9b263a9a669d 100644
--- a/sound/soc/codecs/mt6358.c
+++ b/sound/soc/codecs/mt6358.c
@@ -331,7 +331,7 @@ static void hp_zcd_disable(struct mt6358_priv *priv)
 
 static void hp_main_output_ramp(struct mt6358_priv *priv, bool up)
 {
-	int i = 0, stage = 0;
+	int i, stage;
 	int target = 7;
 
 	/* Enable/Reduce HPL/R main output stage step by step */
@@ -347,7 +347,7 @@ static void hp_main_output_ramp(struct mt6358_priv *priv, bool up)
 
 static void hp_aux_feedback_loop_gain_ramp(struct mt6358_priv *priv, bool up)
 {
-	int i = 0, stage = 0;
+	int i, stage;
 
 	/* Reduce HP aux feedback loop gain step by step */
 	for (i = 0; i <= 0xf; i++) {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 14/23] ASoC: mt6359: remove useless assignment
  2021-03-12 18:22 [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Pierre-Louis Bossart
                   ` (12 preceding siblings ...)
  2021-03-12 18:22 ` [PATCH 13/23] ASoC: mt6358: remove useless initializations Pierre-Louis Bossart
@ 2021-03-12 18:22 ` Pierre-Louis Bossart
  2021-03-12 18:22 ` [PATCH 15/23] ASoC: nau8825: " Pierre-Louis Bossart
                   ` (9 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Pierre-Louis Bossart @ 2021-03-12 18:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, broonie, linux-kernel, Pierre-Louis Bossart,
	Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Matthias Brugger,
	Tzung-Bi Shih, Jiaxin Yu, Shane.Chien,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

cppcheck warning:

sound/soc/codecs/mt6359.c:242:19: style: Variable 'stage' is assigned a value that is never used. [unreadVariable]
 int i = 0, stage = 0;
                  ^
sound/soc/codecs/mt6359.c:260:19: style: Variable 'stage' is assigned a value that is never used. [unreadVariable]
 int i = 0, stage = 0;
                  ^
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;
                  ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/mt6359.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/mt6359.c b/sound/soc/codecs/mt6359.c
index 6f4b1da52082..b909b36582b7 100644
--- a/sound/soc/codecs/mt6359.c
+++ b/sound/soc/codecs/mt6359.c
@@ -239,7 +239,7 @@ static void zcd_disable(struct mt6359_priv *priv)
 
 static void hp_main_output_ramp(struct mt6359_priv *priv, bool up)
 {
-	int i = 0, stage = 0;
+	int i, stage;
 	int target = 7;
 
 	/* Enable/Reduce HPL/R main output stage step by step */
@@ -257,7 +257,7 @@ static void hp_main_output_ramp(struct mt6359_priv *priv, bool up)
 
 static void hp_aux_feedback_loop_gain_ramp(struct mt6359_priv *priv, bool up)
 {
-	int i = 0, stage = 0;
+	int i, stage;
 	int target = 0xf;
 
 	/* Enable/Reduce HP aux feedback loop gain step by step */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 15/23] ASoC: nau8825: remove useless assignment
  2021-03-12 18:22 [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Pierre-Louis Bossart
                   ` (13 preceding siblings ...)
  2021-03-12 18:22 ` [PATCH 14/23] ASoC: mt6359: remove useless assignment Pierre-Louis Bossart
@ 2021-03-12 18:22 ` Pierre-Louis Bossart
  2021-03-12 18:22 ` [PATCH 16/23] ASoC: pcm1681: " Pierre-Louis Bossart
                   ` (8 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Pierre-Louis Bossart @ 2021-03-12 18:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, broonie, linux-kernel, Pierre-Louis Bossart,
	Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Randy Dunlap

cppcheck warning:

sound/soc/codecs/nau8825.c:2113:10: style: Variable 'ret' is assigned
a value that is never used. [unreadVariable]
 int ret = 0;
         ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/nau8825.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/nau8825.c b/sound/soc/codecs/nau8825.c
index e19db30c457b..67de0e49ccf4 100644
--- a/sound/soc/codecs/nau8825.c
+++ b/sound/soc/codecs/nau8825.c
@@ -2111,7 +2111,7 @@ static int nau8825_set_pll(struct snd_soc_component *component, int pll_id, int
 
 static int nau8825_mclk_prepare(struct nau8825 *nau8825, unsigned int freq)
 {
-	int ret = 0;
+	int ret;
 
 	nau8825->mclk = devm_clk_get(nau8825->dev, "mclk");
 	if (IS_ERR(nau8825->mclk)) {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 16/23] ASoC: pcm1681: remove useless assignment
  2021-03-12 18:22 [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Pierre-Louis Bossart
                   ` (14 preceding siblings ...)
  2021-03-12 18:22 ` [PATCH 15/23] ASoC: nau8825: " Pierre-Louis Bossart
@ 2021-03-12 18:22 ` Pierre-Louis Bossart
  2021-03-12 18:22 ` [PATCH 17/23] ASoC: sigmadsp: align function prototype Pierre-Louis Bossart
                   ` (7 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Pierre-Louis Bossart @ 2021-03-12 18:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, broonie, linux-kernel, Pierre-Louis Bossart,
	Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Peter Ujfalusi,
	Kuninori Morimoto

cppcheck warning:

sound/soc/codecs/pcm1681.c:87:8: style: Variable 'i' is assigned a
value that is never used. [unreadVariable]
 int i = 0, val = -1, enable = 0;
       ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/pcm1681.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/pcm1681.c b/sound/soc/codecs/pcm1681.c
index 07ed8fded471..5b78e9299c95 100644
--- a/sound/soc/codecs/pcm1681.c
+++ b/sound/soc/codecs/pcm1681.c
@@ -84,7 +84,7 @@ static const int pcm1681_deemph[] = { 44100, 48000, 32000 };
 static int pcm1681_set_deemph(struct snd_soc_component *component)
 {
 	struct pcm1681_private *priv = snd_soc_component_get_drvdata(component);
-	int i = 0, val = -1, enable = 0;
+	int i, val = -1, enable = 0;
 
 	if (priv->deemph) {
 		for (i = 0; i < ARRAY_SIZE(pcm1681_deemph); i++) {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 17/23] ASoC: sigmadsp: align function prototype
  2021-03-12 18:22 [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Pierre-Louis Bossart
                   ` (15 preceding siblings ...)
  2021-03-12 18:22 ` [PATCH 16/23] ASoC: pcm1681: " Pierre-Louis Bossart
@ 2021-03-12 18:22 ` Pierre-Louis Bossart
  2021-03-12 18:22 ` [PATCH 18/23] ASoC: sti-sas: remove unused struct members Pierre-Louis Bossart
                   ` (6 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Pierre-Louis Bossart @ 2021-03-12 18:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, broonie, linux-kernel, Pierre-Louis Bossart,
	Lars-Peter Clausen, Nuno Sá,
	Liam Girdwood, Jaroslav Kysela, Takashi Iwai

cppcheck warning:

sound/soc/codecs/sigmadsp.c:736:60: style:inconclusive: Function
'sigmadsp_setup' argument 2 names different: declaration 'rate'
definition 'samplerate'. [funcArgNamesDifferent]
int sigmadsp_setup(struct sigmadsp *sigmadsp, unsigned int samplerate)
                                                           ^

sound/soc/codecs/sigmadsp.h:62:60: note: Function 'sigmadsp_setup'
argument 2 names different: declaration 'rate' definition
'samplerate'.
int sigmadsp_setup(struct sigmadsp *sigmadsp, unsigned int rate);
                                                           ^

sound/soc/codecs/sigmadsp.c:736:60: note: Function 'sigmadsp_setup'
argument 2 names different: declaration 'rate' definition
'samplerate'.
int sigmadsp_setup(struct sigmadsp *sigmadsp, unsigned int samplerate)
                                                           ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/sigmadsp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/sigmadsp.h b/sound/soc/codecs/sigmadsp.h
index e3c9656e006d..d63b8c366efb 100644
--- a/sound/soc/codecs/sigmadsp.h
+++ b/sound/soc/codecs/sigmadsp.h
@@ -59,7 +59,7 @@ struct sigmadsp *devm_sigmadsp_init_i2c(struct i2c_client *client,
 
 int sigmadsp_attach(struct sigmadsp *sigmadsp,
 	struct snd_soc_component *component);
-int sigmadsp_setup(struct sigmadsp *sigmadsp, unsigned int rate);
+int sigmadsp_setup(struct sigmadsp *sigmadsp, unsigned int samplerate);
 void sigmadsp_reset(struct sigmadsp *sigmadsp);
 
 #endif
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 18/23] ASoC: sti-sas: remove unused struct members
  2021-03-12 18:22 [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Pierre-Louis Bossart
                   ` (16 preceding siblings ...)
  2021-03-12 18:22 ` [PATCH 17/23] ASoC: sigmadsp: align function prototype Pierre-Louis Bossart
@ 2021-03-12 18:22 ` Pierre-Louis Bossart
  2021-03-12 18:22 ` [PATCH 19/23] ASoC: tas2562: remove useless assignment Pierre-Louis Bossart
                   ` (5 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Pierre-Louis Bossart @ 2021-03-12 18:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, broonie, linux-kernel, Pierre-Louis Bossart,
	Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Philipp Zabel

cppcheck warnings:

sound/soc/codecs/sti-sas.c:54:25: style: struct member
'sti_dac_audio::field' is never used. [unusedStructMember]
 struct regmap_field  **field;
                        ^

sound/soc/codecs/sti-sas.c:55:24: style: struct member
'sti_dac_audio::rst' is never used. [unusedStructMember]
 struct reset_control *rst;
                       ^

sound/soc/codecs/sti-sas.c:61:25: style: struct member
'sti_spdif_audio::field' is never used. [unusedStructMember]
 struct regmap_field  **field;
                        ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/sti-sas.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/sound/soc/codecs/sti-sas.c b/sound/soc/codecs/sti-sas.c
index ec9933b054ad..ffdf7e559515 100644
--- a/sound/soc/codecs/sti-sas.c
+++ b/sound/soc/codecs/sti-sas.c
@@ -51,14 +51,11 @@ static const struct reg_default stih407_sas_reg_defaults[] = {
 struct sti_dac_audio {
 	struct regmap *regmap;
 	struct regmap *virt_regmap;
-	struct regmap_field  **field;
-	struct reset_control *rst;
 	int mclk;
 };
 
 struct sti_spdif_audio {
 	struct regmap *regmap;
-	struct regmap_field  **field;
 	int mclk;
 };
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 19/23] ASoC: tas2562: remove useless assignment
  2021-03-12 18:22 [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Pierre-Louis Bossart
                   ` (17 preceding siblings ...)
  2021-03-12 18:22 ` [PATCH 18/23] ASoC: sti-sas: remove unused struct members Pierre-Louis Bossart
@ 2021-03-12 18:22 ` Pierre-Louis Bossart
  2021-03-12 18:22 ` [PATCH 20/23] ASoC: tas2562: remove warning on return value Pierre-Louis Bossart
                   ` (4 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Pierre-Louis Bossart @ 2021-03-12 18:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, broonie, linux-kernel, Pierre-Louis Bossart,
	Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Dan Murphy,
	Jonghwan Choi, Peter Ujfalusi, Krzysztof Kozlowski,
	Kuninori Morimoto

cppcheck throws a warning:

sound/soc/codecs/tas2562.c:203:4: style: Assignment of function
parameter has no effect outside the function. [uselessAssignmentArg]
   tx_mask &= ~(1 << right_slot);
   ^

This assignment seems to come from a copy/paste but the value is
indeed not used. Let's remove it.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/tas2562.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sound/soc/codecs/tas2562.c b/sound/soc/codecs/tas2562.c
index 19965fabe949..ba23f9f07f04 100644
--- a/sound/soc/codecs/tas2562.c
+++ b/sound/soc/codecs/tas2562.c
@@ -200,7 +200,6 @@ static int tas2562_set_dai_tdm_slot(struct snd_soc_dai *dai,
 			right_slot = left_slot;
 		} else {
 			right_slot = __ffs(tx_mask);
-			tx_mask &= ~(1 << right_slot);
 		}
 	}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 20/23] ASoC: tas2562: remove warning on return value
  2021-03-12 18:22 [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Pierre-Louis Bossart
                   ` (18 preceding siblings ...)
  2021-03-12 18:22 ` [PATCH 19/23] ASoC: tas2562: remove useless assignment Pierre-Louis Bossart
@ 2021-03-12 18:22 ` Pierre-Louis Bossart
  2021-03-12 18:22 ` [PATCH 21/23] ASoC: tas2770: remove useless initialization Pierre-Louis Bossart
                   ` (3 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Pierre-Louis Bossart @ 2021-03-12 18:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, broonie, linux-kernel, Pierre-Louis Bossart,
	Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Dan Murphy,
	Kuninori Morimoto, Krzysztof Kozlowski, Jonghwan Choi

cppcheck warning:

sound/soc/codecs/tas2562.c:530:9: warning: Identical condition and return expression 'ret', return value is always 0 [identicalConditionAfterEarlyExit]
 return ret;
        ^
sound/soc/codecs/tas2562.c:525:6: note: If condition 'ret' is true, the function will return/exit
 if (ret)
     ^
sound/soc/codecs/tas2562.c:530:9: note: Returning identical expression 'ret'
 return ret;
        ^

Fix with return 0

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/tas2562.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/tas2562.c b/sound/soc/codecs/tas2562.c
index ba23f9f07f04..10302552195e 100644
--- a/sound/soc/codecs/tas2562.c
+++ b/sound/soc/codecs/tas2562.c
@@ -526,7 +526,7 @@ static int tas2562_volume_control_put(struct snd_kcontrol *kcontrol,
 
 	tas2562->volume_lvl = ucontrol->value.integer.value[0];
 
-	return ret;
+	return 0;
 }
 
 /* Digital Volume Control. From 0 dB to -110 dB in 1 dB steps */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 21/23] ASoC: tas2770: remove useless initialization
  2021-03-12 18:22 [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Pierre-Louis Bossart
                   ` (19 preceding siblings ...)
  2021-03-12 18:22 ` [PATCH 20/23] ASoC: tas2562: remove warning on return value Pierre-Louis Bossart
@ 2021-03-12 18:22 ` Pierre-Louis Bossart
  2021-03-12 18:22 ` [PATCH 22/23] ASoC: tlv320dac33: clarify expression Pierre-Louis Bossart
                   ` (2 subsequent siblings)
  23 siblings, 0 replies; 32+ messages in thread
From: Pierre-Louis Bossart @ 2021-03-12 18:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, broonie, linux-kernel, Pierre-Louis Bossart,
	Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Dan Murphy,
	Kuninori Morimoto, Alexander A. Klimov

cppcheck warning:

sound/soc/codecs/tas2770.c:109:10: style: Variable 'ret' is assigned a
value that is never used. [unreadVariable]
 int ret = 0;
         ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/tas2770.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/tas2770.c b/sound/soc/codecs/tas2770.c
index 15fca5109e14..781bf9cc4faa 100644
--- a/sound/soc/codecs/tas2770.c
+++ b/sound/soc/codecs/tas2770.c
@@ -106,7 +106,7 @@ static int tas2770_codec_suspend(struct snd_soc_component *component)
 static int tas2770_codec_resume(struct snd_soc_component *component)
 {
 	struct tas2770_priv *tas2770 = snd_soc_component_get_drvdata(component);
-	int ret = 0;
+	int ret;
 
 	if (tas2770->sdz_gpio) {
 		gpiod_set_value_cansleep(tas2770->sdz_gpio, 1);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 22/23] ASoC: tlv320dac33: clarify expression
  2021-03-12 18:22 [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Pierre-Louis Bossart
                   ` (20 preceding siblings ...)
  2021-03-12 18:22 ` [PATCH 21/23] ASoC: tas2770: remove useless initialization Pierre-Louis Bossart
@ 2021-03-12 18:22 ` Pierre-Louis Bossart
  2021-03-12 18:22 ` [PATCH 23/23] ASoC: tscs454: remove useless test on PLL disable Pierre-Louis Bossart
  2021-03-18 18:33 ` [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Mark Brown
  23 siblings, 0 replies; 32+ messages in thread
From: Pierre-Louis Bossart @ 2021-03-12 18:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, broonie, linux-kernel, Pierre-Louis Bossart,
	Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto,
	Ranjani Sridharan

cppcheck warning:

sound/soc/codecs/tlv320dac33.c:1074:43: style: Clarify calculation
precedence for '%' and '?'. [clarifyCalculation]
    (dac33->alarm_threshold % period_size ?
                                          ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/tlv320dac33.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c
index d905e03aaec7..48572d66cb3b 100644
--- a/sound/soc/codecs/tlv320dac33.c
+++ b/sound/soc/codecs/tlv320dac33.c
@@ -1071,7 +1071,7 @@ static void dac33_calculate_times(struct snd_pcm_substream *substream,
 			 */
 			dac33->nsample = period_size *
 				((dac33->alarm_threshold / period_size) +
-				(dac33->alarm_threshold % period_size ?
+				 ((dac33->alarm_threshold % period_size) ?
 				1 : 0));
 		else if (period_size > nsample_limit)
 			dac33->nsample = nsample_limit;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 23/23] ASoC: tscs454: remove useless test on PLL disable
  2021-03-12 18:22 [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Pierre-Louis Bossart
                   ` (21 preceding siblings ...)
  2021-03-12 18:22 ` [PATCH 22/23] ASoC: tlv320dac33: clarify expression Pierre-Louis Bossart
@ 2021-03-12 18:22 ` Pierre-Louis Bossart
  2021-03-18 18:33 ` [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Mark Brown
  23 siblings, 0 replies; 32+ messages in thread
From: Pierre-Louis Bossart @ 2021-03-12 18:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, broonie, linux-kernel, Pierre-Louis Bossart,
	Steven Eckhoff, Liam Girdwood, Jaroslav Kysela, Takashi Iwai

cppcheck warning:

sound/soc/codecs/tscs454.c:730:37: style: Same value in both branches
of ternary operator. [duplicateValueTernary]
  val = pll1 ? FV_PLL1CLKEN_DISABLE : FV_PLL2CLKEN_DISABLE;
                                    ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/tscs454.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/tscs454.c b/sound/soc/codecs/tscs454.c
index 1bafc9d1101c..43220bb36701 100644
--- a/sound/soc/codecs/tscs454.c
+++ b/sound/soc/codecs/tscs454.c
@@ -727,7 +727,12 @@ static int pll_power_event(struct snd_soc_dapm_widget *w,
 	if (enable)
 		val = pll1 ? FV_PLL1CLKEN_ENABLE : FV_PLL2CLKEN_ENABLE;
 	else
-		val = pll1 ? FV_PLL1CLKEN_DISABLE : FV_PLL2CLKEN_DISABLE;
+		/*
+		 * FV_PLL1CLKEN_DISABLE and FV_PLL2CLKEN_DISABLE are
+		 * identical zero vzalues, there is no need to test
+		 * the PLL index
+		 */
+		val = FV_PLL1CLKEN_DISABLE;
 
 	ret = snd_soc_component_update_bits(component, R_PLLCTL, msk, val);
 	if (ret < 0) {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [PATCH 02/23] ASoC: ad1836: remove useless return
  2021-03-12 18:22 ` [PATCH 02/23] ASoC: ad1836: remove useless return Pierre-Louis Bossart
@ 2021-03-12 18:50   ` Lars-Peter Clausen
  0 siblings, 0 replies; 32+ messages in thread
From: Lars-Peter Clausen @ 2021-03-12 18:50 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel
  Cc: tiwai, broonie, linux-kernel, Nuno Sá,
	Liam Girdwood, Jaroslav Kysela, Takashi Iwai

On 3/12/21 7:22 PM, Pierre-Louis Bossart wrote:
> Cppcheck warning:
>
> sound/soc/codecs/ad1836.c:311:9: warning: Identical condition and return expression 'ret', return value is always 0 [identicalConditionAfterEarlyExit]
>   return ret;
>          ^
> sound/soc/codecs/ad1836.c:308:6: note: If condition 'ret' is true, the function will return/exit
>   if (ret)
>       ^
> sound/soc/codecs/ad1836.c:311:9: note: Returning identical expression 'ret'
>   return ret;
>          ^
>
> Likely copy/paste between adc and dac cases.
>
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---
>   sound/soc/codecs/ad1836.c | 2 --
>   1 file changed, 2 deletions(-)
>
> diff --git a/sound/soc/codecs/ad1836.c b/sound/soc/codecs/ad1836.c
> index a46152560294..08a5651bed9f 100644
> --- a/sound/soc/codecs/ad1836.c
> +++ b/sound/soc/codecs/ad1836.c
> @@ -305,8 +305,6 @@ static int ad1836_probe(struct snd_soc_component *component)
>   		return ret;
>   
>   	ret = snd_soc_dapm_add_routes(dapm, ad183x_adc_routes, num_adcs);
> -	if (ret)
> -		return ret;
>   
>   	return ret;
>   }

We could even go one step further and do

return snd_soc_dapm_add_routes(dapm, ad183x_adc_routes, num_adcs);

But either is fine. Thanks for cleaning this up


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 05/23] ASoC: cx2070x: remove useless assignment
  2021-03-12 18:22 ` [PATCH 05/23] ASoC: cx2070x: remove useless assignment Pierre-Louis Bossart
@ 2021-03-14  8:30   ` Takashi Iwai
  2021-03-14  8:30   ` Takashi Iwai
  1 sibling, 0 replies; 32+ messages in thread
From: Takashi Iwai @ 2021-03-14  8:30 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: alsa-devel, broonie, linux-kernel, Liam Girdwood,
	Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto

On Fri, 12 Mar 2021 19:22:28 +0100,
Pierre-Louis Bossart wrote:
> 
> Cppcheck warning:
> 
> sound/soc/codecs/cx2072x.c:830:26: style: Variable
> 'reg1.r.rx_data_one_line' is reassigned a value before the old one has
> been used. [redundantAssignment]
> 
>  reg1.r.rx_data_one_line = 1;
>                          ^
> 
> sound/soc/codecs/cx2072x.c:782:26: note: reg1.r.rx_data_one_line is
> assigned
>  reg1.r.rx_data_one_line = 1;
>                          ^
> 
> sound/soc/codecs/cx2072x.c:830:26: note: reg1.r.rx_data_one_line is
> overwritten
>  reg1.r.rx_data_one_line = 1;
>                          ^
> 
> sound/soc/codecs/cx2072x.c:831:26: style: Variable
> 'reg1.r.tx_data_one_line' is reassigned a value before the old one has
> been used. [redundantAssignment]
>  reg1.r.tx_data_one_line = 1;
>                          ^
> sound/soc/codecs/cx2072x.c:783:26: note: reg1.r.tx_data_one_line is
> assigned
>  reg1.r.tx_data_one_line = 1;
>                          ^
> 
> sound/soc/codecs/cx2072x.c:831:26: note: reg1.r.tx_data_one_line is
> overwritten
>  reg1.r.tx_data_one_line = 1;
>                          ^
> 
> Likely copy/paste.
> 
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Reviewed-by: Takashi Iwai <tiwai@suse.de>


thanks,

Takashi


> ---
>  sound/soc/codecs/cx2072x.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/sound/soc/codecs/cx2072x.c b/sound/soc/codecs/cx2072x.c
> index 8ab22815c2c9..d2d004654c9b 100644
> --- a/sound/soc/codecs/cx2072x.c
> +++ b/sound/soc/codecs/cx2072x.c
> @@ -827,9 +827,6 @@ static int cx2072x_config_i2spcm(struct cx2072x_priv *cx2072x)
>  	}
>  	regdbt2.r.i2s_bclk_invert = is_bclk_inv;
>  
> -	reg1.r.rx_data_one_line = 1;
> -	reg1.r.tx_data_one_line = 1;
> -
>  	/* Configures the BCLK output */
>  	bclk_rate = cx2072x->sample_rate * frame_len;
>  	reg5.r.i2s_pcm_clk_div_chan_en = 0;
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 05/23] ASoC: cx2070x: remove useless assignment
  2021-03-12 18:22 ` [PATCH 05/23] ASoC: cx2070x: remove useless assignment Pierre-Louis Bossart
  2021-03-14  8:30   ` Takashi Iwai
@ 2021-03-14  8:30   ` Takashi Iwai
  1 sibling, 0 replies; 32+ messages in thread
From: Takashi Iwai @ 2021-03-14  8:30 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: alsa-devel, broonie, linux-kernel, Liam Girdwood,
	Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto

On Fri, 12 Mar 2021 19:22:28 +0100,
Pierre-Louis Bossart wrote:
> 
> Cppcheck warning:
> 
> sound/soc/codecs/cx2072x.c:830:26: style: Variable
> 'reg1.r.rx_data_one_line' is reassigned a value before the old one has
> been used. [redundantAssignment]
> 
>  reg1.r.rx_data_one_line = 1;
>                          ^
> 
> sound/soc/codecs/cx2072x.c:782:26: note: reg1.r.rx_data_one_line is
> assigned
>  reg1.r.rx_data_one_line = 1;
>                          ^
> 
> sound/soc/codecs/cx2072x.c:830:26: note: reg1.r.rx_data_one_line is
> overwritten
>  reg1.r.rx_data_one_line = 1;
>                          ^
> 
> sound/soc/codecs/cx2072x.c:831:26: style: Variable
> 'reg1.r.tx_data_one_line' is reassigned a value before the old one has
> been used. [redundantAssignment]
>  reg1.r.tx_data_one_line = 1;
>                          ^
> sound/soc/codecs/cx2072x.c:783:26: note: reg1.r.tx_data_one_line is
> assigned
>  reg1.r.tx_data_one_line = 1;
>                          ^
> 
> sound/soc/codecs/cx2072x.c:831:26: note: reg1.r.tx_data_one_line is
> overwritten
>  reg1.r.tx_data_one_line = 1;
>                          ^
> 
> Likely copy/paste.
> 
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Reviewed-by: Takashi Iwai <tiwai@suse.de>


thanks,

Takashi

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 06/23] ASoC: cx2070x: remove duplicate else branch
  2021-03-12 18:22 ` [PATCH 06/23] ASoC: cx2070x: remove duplicate else branch Pierre-Louis Bossart
@ 2021-03-14  8:32   ` Takashi Iwai
  0 siblings, 0 replies; 32+ messages in thread
From: Takashi Iwai @ 2021-03-14  8:32 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: alsa-devel, broonie, linux-kernel, Liam Girdwood,
	Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto

On Fri, 12 Mar 2021 19:22:29 +0100,
Pierre-Louis Bossart wrote:
> 
> cppcheck warning:
> 
> sound/soc/codecs/cx2072x.c:1436:10: style:inconclusive: Found
> duplicate branches for 'if' and 'else'. [duplicateBranch]
>   } else if (type & 0x4) {
>          ^
> sound/soc/codecs/cx2072x.c:1439:5: note: Found duplicate branches for
> 'if' and 'else'.
>   } else {
>     ^
> sound/soc/codecs/cx2072x.c:1436:10: note: Found duplicate branches for
> 'if' and 'else'.
>   } else if (type & 0x4) {
>          ^
> 
> The last two branches do the same thing and can be collapsed together.
> 
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Reviewed-by: Takashi Iwai <tiwai@suse.de>


thanks,

Takashi

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 04/23] ASoC: cros_ec_codec: remove null pointer dereference warning
  2021-03-12 18:22 ` [PATCH 04/23] ASoC: cros_ec_codec: remove null pointer dereference warning Pierre-Louis Bossart
@ 2021-03-15 10:39   ` Enric Balletbo i Serra
  0 siblings, 0 replies; 32+ messages in thread
From: Enric Balletbo i Serra @ 2021-03-15 10:39 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel
  Cc: tiwai, broonie, linux-kernel, Cheng-Yi Chiang, Guenter Roeck,
	Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Benson Leung

Hi Pierre-Louis,

Thank you for you patch.

On 12/3/21 19:22, Pierre-Louis Bossart wrote:
> Cppcheck complains of a possible issue:
> 
> sound/soc/codecs/cros_ec_codec.c:98:10: warning: Possible null pointer
> dereference: in [nullPointer]
>   memcpy(in, msg->data, insize);
>          ^
> sound/soc/codecs/cros_ec_codec.c:162:34: note: Calling function
> 'send_ec_host_command', 5th argument 'NULL' value is 0
>        (uint8_t *)&p, sizeof(p), NULL, 0);
>                                  ^
> sound/soc/codecs/cros_ec_codec.c:98:10: note: Null pointer dereference
>   memcpy(in, msg->data, insize);
>          ^
> 
> In practice the access to the pointer is protected by another
> argument, but this is likely to fool other static analysis tools. Add
> a test to avoid doing the memcpy if the pointer is NULL or the size is
> zero.
> 
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Looks good to me, so

Acked-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>


> ---
>  sound/soc/codecs/cros_ec_codec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/soc/codecs/cros_ec_codec.c b/sound/soc/codecs/cros_ec_codec.c
> index c4772f82485a..a201d652aca2 100644
> --- a/sound/soc/codecs/cros_ec_codec.c
> +++ b/sound/soc/codecs/cros_ec_codec.c
> @@ -94,7 +94,7 @@ static int send_ec_host_command(struct cros_ec_device *ec_dev, uint32_t cmd,
>  	if (ret < 0)
>  		goto error;
>  
> -	if (insize)
> +	if (in && insize)
>  		memcpy(in, msg->data, insize);
>  
>  	ret = 0;
> 

^ permalink raw reply	[flat|nested] 32+ messages in thread

* RE: [PATCH 07/23] ASoC: da7219-aad: remove useless initialization
  2021-03-12 18:22 ` [PATCH 07/23] ASoC: da7219-aad: remove useless initialization Pierre-Louis Bossart
@ 2021-03-15 14:50   ` Adam Thomson
  0 siblings, 0 replies; 32+ messages in thread
From: Adam Thomson @ 2021-03-15 14:50 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel
  Cc: tiwai, broonie, linux-kernel, Support Opensource, Liam Girdwood,
	Jaroslav Kysela, Takashi Iwai

On 12 March 2021 18:23, Pierre-Louis Bossart wrote:

> cppcheck warning:
> 
> sound/soc/codecs/da7219-aad.c:118:22: style: Variable 'ret' is
> assigned a value that is never used. [unreadVariable]
>  int report = 0, ret = 0;
>                      ^
> 
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 00/23] ASoC: codecs: remove cppcheck warnings
  2021-03-12 18:22 [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Pierre-Louis Bossart
                   ` (22 preceding siblings ...)
  2021-03-12 18:22 ` [PATCH 23/23] ASoC: tscs454: remove useless test on PLL disable Pierre-Louis Bossart
@ 2021-03-18 18:33 ` Mark Brown
  2021-03-18 18:36   ` Mark Brown
  23 siblings, 1 reply; 32+ messages in thread
From: Mark Brown @ 2021-03-18 18:33 UTC (permalink / raw)
  To: alsa-devel, Pierre-Louis Bossart; +Cc: Mark Brown, linux-kernel, tiwai

On Fri, 12 Mar 2021 12:22:23 -0600, Pierre-Louis Bossart wrote:
> Lots of small fixes in various codec drivers that should have no
> functional impact.
> 
> Pierre-Louis Bossart (23):
>   ASoC: ab8500-codec: remove useless structure
>   ASoC: ad1836: remove useless return
>   ASoC: adau1977: remove useless return
>   ASoC: cros_ec_codec: remove null pointer dereference warning
>   ASoC: cx2070x: remove useless assignment
>   ASoC: cx2070x: remove duplicate else branch
>   ASoC: da7219-aad: remove useless initialization
>   ASoC: hdac_hdmi: remove useless initializations
>   ASoC: hdac_hdmi: align function arguments
>   ASoC: hdmi-codec: remove useless initialization
>   ASoC: hdmi-codec: remove unused spk_mask member
>   ASoC: max98090: remove useless assignment
>   ASoC: mt6358: remove useless initializations
>   ASoC: mt6359: remove useless assignment
>   ASoC: nau8825: remove useless assignment
>   ASoC: pcm1681: remove useless assignment
>   ASoC: sigmadsp: align function prototype
>   ASoC: sti-sas: remove unused struct members
>   ASoC: tas2562: remove useless assignment
>   ASoC: tas2562: remove warning on return value
>   ASoC: tas2770: remove useless initialization
>   ASoC: tlv320dac33: clarify expression
>   ASoC: tscs454: remove useless test on PLL disable
> 
> [...]

Applied to

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

Thanks!

[01/23] ASoC: ab8500-codec: remove useless structure
        commit: 73b4fe4a03db519977a22cdf34303bd0ac21c69d
[02/23] ASoC: ad1836: remove useless return
        commit: ca6b3a6ca047d23b9b2a54af9f7f4d6f41200719
[03/23] ASoC: adau1977: remove useless return
        commit: 5b349c8f355ae4bd1de462f1f1b6164d14796b0e
[04/23] ASoC: cros_ec_codec: remove null pointer dereference warning
        commit: 157c4df677569daad6f204c63cfaf226c941bf03
[05/23] ASoC: cx2070x: remove useless assignment
        commit: 4d753b6642ee7304fc56f9fc463bb69ec641a037
[06/23] ASoC: cx2070x: remove duplicate else branch
        commit: 8d41c1ab248fa6e6bfd4728a31eec6d3b9e0f924
[07/23] ASoC: da7219-aad: remove useless initialization
        commit: f8a684a4c2c9a6f922453f0e5dc6d20b1bdb082b
[08/23] ASoC: hdac_hdmi: remove useless initializations
        commit: 426b3bbcee199e1e96ec62b1c1d9cb7019a84efb
[09/23] ASoC: hdac_hdmi: align function arguments
        commit: 997994d7e6fab713d1c03843c9698919e64cc135
[10/23] ASoC: hdmi-codec: remove useless initialization
        commit: 3c011ef344cddd15be0a9b2256f7886f6b5eeec5
[11/23] ASoC: hdmi-codec: remove unused spk_mask member
        commit: 9ad869fee5c598d914fa5cf8fb26f5e106e90956
[12/23] ASoC: max98090: remove useless assignment
        commit: 226a783f3dcf7f565c173627d565135424ee0be9
[13/23] ASoC: mt6358: remove useless initializations
        commit: 2b5e8cd53ffad8c586d8a9d47087fdb058a21287
[14/23] ASoC: mt6359: remove useless assignment
        commit: d068ab4eab0de3224b32ac37234d4d33452d5b01
[15/23] ASoC: nau8825: remove useless assignment
        commit: a3966b254c481ee1890f75d809a52e5aa358c4b1
[16/23] ASoC: pcm1681: remove useless assignment
        commit: f10280d5c59b8d83ae9e9e2307075cc7ad32a6b8
[17/23] ASoC: sigmadsp: align function prototype
        commit: 17d74e68e9765d9549acf1c36caa8b7559dc99ce
[18/23] ASoC: sti-sas: remove unused struct members
        commit: 02a70d7f26e7a3d87c9a5af39ca399b52a451a1a
[19/23] ASoC: tas2562: remove useless assignment
        commit: e83c47861c266f704d2344f51031ee67a93309ab
[20/23] ASoC: tas2562: remove warning on return value
        commit: 2e40b21cd4f697a761f1c5e4f08aac1a5c6c6018
[21/23] ASoC: tas2770: remove useless initialization
        commit: ffab1215bdbea7358051f8dd87b1240e4c6d56e6
[22/23] ASoC: tlv320dac33: clarify expression
        commit: 39e69cef0aa9f6897161a11ed84362f5805c43fd
[23/23] ASoC: tscs454: remove useless test on PLL disable
        commit: a2cc1568dc50020a807c94bd14a053dd54e9c35e

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

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 00/23] ASoC: codecs: remove cppcheck warnings
  2021-03-18 18:33 ` [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Mark Brown
@ 2021-03-18 18:36   ` Mark Brown
  0 siblings, 0 replies; 32+ messages in thread
From: Mark Brown @ 2021-03-18 18:36 UTC (permalink / raw)
  To: alsa-devel, Pierre-Louis Bossart; +Cc: Mark Brown, linux-kernel, tiwai

On Fri, 12 Mar 2021 12:22:23 -0600, Pierre-Louis Bossart wrote:
> Lots of small fixes in various codec drivers that should have no
> functional impact.
> 
> Pierre-Louis Bossart (23):
>   ASoC: ab8500-codec: remove useless structure
>   ASoC: ad1836: remove useless return
>   ASoC: adau1977: remove useless return
>   ASoC: cros_ec_codec: remove null pointer dereference warning
>   ASoC: cx2070x: remove useless assignment
>   ASoC: cx2070x: remove duplicate else branch
>   ASoC: da7219-aad: remove useless initialization
>   ASoC: hdac_hdmi: remove useless initializations
>   ASoC: hdac_hdmi: align function arguments
>   ASoC: hdmi-codec: remove useless initialization
>   ASoC: hdmi-codec: remove unused spk_mask member
>   ASoC: max98090: remove useless assignment
>   ASoC: mt6358: remove useless initializations
>   ASoC: mt6359: remove useless assignment
>   ASoC: nau8825: remove useless assignment
>   ASoC: pcm1681: remove useless assignment
>   ASoC: sigmadsp: align function prototype
>   ASoC: sti-sas: remove unused struct members
>   ASoC: tas2562: remove useless assignment
>   ASoC: tas2562: remove warning on return value
>   ASoC: tas2770: remove useless initialization
>   ASoC: tlv320dac33: clarify expression
>   ASoC: tscs454: remove useless test on PLL disable
> 
> [...]

Applied to

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

Thanks!

[01/23] ASoC: ab8500-codec: remove useless structure
        commit: 73b4fe4a03db519977a22cdf34303bd0ac21c69d
[02/23] ASoC: ad1836: remove useless return
        commit: ca6b3a6ca047d23b9b2a54af9f7f4d6f41200719
[03/23] ASoC: adau1977: remove useless return
        commit: 5b349c8f355ae4bd1de462f1f1b6164d14796b0e
[04/23] ASoC: cros_ec_codec: remove null pointer dereference warning
        commit: 157c4df677569daad6f204c63cfaf226c941bf03
[05/23] ASoC: cx2070x: remove useless assignment
        commit: 4d753b6642ee7304fc56f9fc463bb69ec641a037
[06/23] ASoC: cx2070x: remove duplicate else branch
        commit: 8d41c1ab248fa6e6bfd4728a31eec6d3b9e0f924
[07/23] ASoC: da7219-aad: remove useless initialization
        commit: f8a684a4c2c9a6f922453f0e5dc6d20b1bdb082b
[08/23] ASoC: hdac_hdmi: remove useless initializations
        commit: 426b3bbcee199e1e96ec62b1c1d9cb7019a84efb
[09/23] ASoC: hdac_hdmi: align function arguments
        commit: 997994d7e6fab713d1c03843c9698919e64cc135
[10/23] ASoC: hdmi-codec: remove useless initialization
        commit: 3c011ef344cddd15be0a9b2256f7886f6b5eeec5
[11/23] ASoC: hdmi-codec: remove unused spk_mask member
        commit: 9ad869fee5c598d914fa5cf8fb26f5e106e90956
[12/23] ASoC: max98090: remove useless assignment
        commit: 226a783f3dcf7f565c173627d565135424ee0be9
[13/23] ASoC: mt6358: remove useless initializations
        commit: 2b5e8cd53ffad8c586d8a9d47087fdb058a21287
[14/23] ASoC: mt6359: remove useless assignment
        commit: d068ab4eab0de3224b32ac37234d4d33452d5b01
[15/23] ASoC: nau8825: remove useless assignment
        commit: a3966b254c481ee1890f75d809a52e5aa358c4b1
[16/23] ASoC: pcm1681: remove useless assignment
        commit: f10280d5c59b8d83ae9e9e2307075cc7ad32a6b8
[17/23] ASoC: sigmadsp: align function prototype
        commit: 17d74e68e9765d9549acf1c36caa8b7559dc99ce
[18/23] ASoC: sti-sas: remove unused struct members
        commit: 02a70d7f26e7a3d87c9a5af39ca399b52a451a1a
[19/23] ASoC: tas2562: remove useless assignment
        commit: e83c47861c266f704d2344f51031ee67a93309ab
[20/23] ASoC: tas2562: remove warning on return value
        commit: 2e40b21cd4f697a761f1c5e4f08aac1a5c6c6018
[21/23] ASoC: tas2770: remove useless initialization
        commit: ffab1215bdbea7358051f8dd87b1240e4c6d56e6
[22/23] ASoC: tlv320dac33: clarify expression
        commit: 39e69cef0aa9f6897161a11ed84362f5805c43fd
[23/23] ASoC: tscs454: remove useless test on PLL disable
        commit: a2cc1568dc50020a807c94bd14a053dd54e9c35e

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

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2021-03-18 18:37 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-12 18:22 [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Pierre-Louis Bossart
2021-03-12 18:22 ` [PATCH 01/23] ASoC: ab8500-codec: remove useless structure Pierre-Louis Bossart
2021-03-12 18:22 ` [PATCH 02/23] ASoC: ad1836: remove useless return Pierre-Louis Bossart
2021-03-12 18:50   ` Lars-Peter Clausen
2021-03-12 18:22 ` [PATCH 03/23] ASoC: adau1977: " Pierre-Louis Bossart
2021-03-12 18:22 ` [PATCH 04/23] ASoC: cros_ec_codec: remove null pointer dereference warning Pierre-Louis Bossart
2021-03-15 10:39   ` Enric Balletbo i Serra
2021-03-12 18:22 ` [PATCH 05/23] ASoC: cx2070x: remove useless assignment Pierre-Louis Bossart
2021-03-14  8:30   ` Takashi Iwai
2021-03-14  8:30   ` Takashi Iwai
2021-03-12 18:22 ` [PATCH 06/23] ASoC: cx2070x: remove duplicate else branch Pierre-Louis Bossart
2021-03-14  8:32   ` Takashi Iwai
2021-03-12 18:22 ` [PATCH 07/23] ASoC: da7219-aad: remove useless initialization Pierre-Louis Bossart
2021-03-15 14:50   ` Adam Thomson
2021-03-12 18:22 ` [PATCH 08/23] ASoC: hdac_hdmi: remove useless initializations Pierre-Louis Bossart
2021-03-12 18:22 ` [PATCH 09/23] ASoC: hdac_hdmi: align function arguments Pierre-Louis Bossart
2021-03-12 18:22 ` [PATCH 10/23] ASoC: hdmi-codec: remove useless initialization Pierre-Louis Bossart
2021-03-12 18:22 ` [PATCH 11/23] ASoC: hdmi-codec: remove unused spk_mask member Pierre-Louis Bossart
2021-03-12 18:22 ` [PATCH 12/23] ASoC: max98090: remove useless assignment Pierre-Louis Bossart
2021-03-12 18:22 ` [PATCH 13/23] ASoC: mt6358: remove useless initializations Pierre-Louis Bossart
2021-03-12 18:22 ` [PATCH 14/23] ASoC: mt6359: remove useless assignment Pierre-Louis Bossart
2021-03-12 18:22 ` [PATCH 15/23] ASoC: nau8825: " Pierre-Louis Bossart
2021-03-12 18:22 ` [PATCH 16/23] ASoC: pcm1681: " Pierre-Louis Bossart
2021-03-12 18:22 ` [PATCH 17/23] ASoC: sigmadsp: align function prototype Pierre-Louis Bossart
2021-03-12 18:22 ` [PATCH 18/23] ASoC: sti-sas: remove unused struct members Pierre-Louis Bossart
2021-03-12 18:22 ` [PATCH 19/23] ASoC: tas2562: remove useless assignment Pierre-Louis Bossart
2021-03-12 18:22 ` [PATCH 20/23] ASoC: tas2562: remove warning on return value Pierre-Louis Bossart
2021-03-12 18:22 ` [PATCH 21/23] ASoC: tas2770: remove useless initialization Pierre-Louis Bossart
2021-03-12 18:22 ` [PATCH 22/23] ASoC: tlv320dac33: clarify expression Pierre-Louis Bossart
2021-03-12 18:22 ` [PATCH 23/23] ASoC: tscs454: remove useless test on PLL disable Pierre-Louis Bossart
2021-03-18 18:33 ` [PATCH 00/23] ASoC: codecs: remove cppcheck warnings Mark Brown
2021-03-18 18:36   ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).