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
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 <[email protected]>
---
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
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 <[email protected]>
---
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
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 <[email protected]>
---
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
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 <[email protected]>
---
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
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 <[email protected]>
---
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
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 <[email protected]>
---
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
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 <[email protected]>
---
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
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 <[email protected]>
---
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
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 <[email protected]>
---
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
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 <[email protected]>
---
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
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 <[email protected]>
---
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
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 <[email protected]>
---
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
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 <[email protected]>
---
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
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 <[email protected]>
---
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
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 <[email protected]>
---
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
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 <[email protected]>
---
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
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 <[email protected]>
---
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
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 <[email protected]>
---
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
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 <[email protected]>
---
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
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 <[email protected]>
---
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
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 <[email protected]>
---
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
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 <[email protected]>
Reviewed-by: Takashi Iwai <[email protected]>
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
>
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 <[email protected]>
Reviewed-by: Takashi Iwai <[email protected]>
thanks,
Takashi
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 <[email protected]>
Reviewed-by: Takashi Iwai <[email protected]>
thanks,
Takashi
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 <[email protected]>
Looks good to me, so
Acked-by: Enric Balletbo i Serra <[email protected]>
> ---
> 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;
>
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 <[email protected]>
Acked-by: Adam Thomson <[email protected]>
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