* [PATCH 1/9] ASoC: fsl: fsl_asrc: remove useless assignment
[not found] <20210219232937.6440-1-pierre-louis.bossart@linux.intel.com>
@ 2021-02-19 23:29 ` Pierre-Louis Bossart
2021-02-19 23:29 ` [PATCH 2/9] ASoC: fsl: fsl_dma: remove unused variable Pierre-Louis Bossart
` (5 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: Pierre-Louis Bossart @ 2021-02-19 23:29 UTC (permalink / raw)
To: alsa-devel
Cc: Liam Girdwood, Timur Tabi, Xiubo Li, tiwai, Shengjiu Wang,
Takashi Iwai, linux-kernel, Pierre-Louis Bossart, Nicolin Chen,
open list:FREESCALE SOC SOUND DRIVERS, broonie, Jaroslav Kysela,
Fabio Estevam
cppcheck warning:
sound/soc/fsl/fsl_asrc.c:613:8: style: Variable 'i' is assigned a
value that is never used. [unreadVariable]
int i = 0, j = 0;
^
The same issue occurs for the 'j' variable.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
sound/soc/fsl/fsl_asrc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c
index c325c984d165..63d236ef5c4d 100644
--- a/sound/soc/fsl/fsl_asrc.c
+++ b/sound/soc/fsl/fsl_asrc.c
@@ -610,7 +610,7 @@ static void fsl_asrc_select_clk(struct fsl_asrc_priv *asrc_priv,
struct asrc_config *config = pair_priv->config;
int rate[2], select_clk[2]; /* Array size 2 means IN and OUT */
int clk_rate, clk_index;
- int i = 0, j = 0;
+ int i, j;
rate[IN] = in_rate;
rate[OUT] = out_rate;
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/9] ASoC: fsl: fsl_dma: remove unused variable
[not found] <20210219232937.6440-1-pierre-louis.bossart@linux.intel.com>
2021-02-19 23:29 ` [PATCH 1/9] ASoC: fsl: fsl_asrc: remove useless assignment Pierre-Louis Bossart
@ 2021-02-19 23:29 ` Pierre-Louis Bossart
2021-02-19 23:29 ` [PATCH 3/9] ASoC: fsl: fsl_easrc: remove useless assignments Pierre-Louis Bossart
` (4 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: Pierre-Louis Bossart @ 2021-02-19 23:29 UTC (permalink / raw)
To: alsa-devel
Cc: Liam Girdwood, Timur Tabi, Xiubo Li, tiwai, Shengjiu Wang,
Takashi Iwai, linux-kernel, Pierre-Louis Bossart, Nicolin Chen,
open list:FREESCALE SOC SOUND DRIVERS, broonie, Jaroslav Kysela,
Fabio Estevam
cppcheck warning:
sound/soc/fsl/fsl_dma.c:411:10: style: Variable 'channel' is assigned
a value that is never used. [unreadVariable]
channel = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 0 : 1;
^
Removing this line shows the variable isn't needed any longer so
remove declaration as well.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
sound/soc/fsl/fsl_dma.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
index e0c39c5f4854..84bd8a5356eb 100644
--- a/sound/soc/fsl/fsl_dma.c
+++ b/sound/soc/fsl/fsl_dma.c
@@ -392,7 +392,6 @@ static int fsl_dma_open(struct snd_soc_component *component,
dma_addr_t ld_buf_phys;
u64 temp_link; /* Pointer to next link descriptor */
u32 mr;
- unsigned int channel;
int ret = 0;
unsigned int i;
@@ -408,8 +407,6 @@ static int fsl_dma_open(struct snd_soc_component *component,
return ret;
}
- channel = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 0 : 1;
-
if (dma->assigned) {
dev_err(dev, "dma channel already assigned\n");
return -EBUSY;
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 3/9] ASoC: fsl: fsl_easrc: remove useless assignments
[not found] <20210219232937.6440-1-pierre-louis.bossart@linux.intel.com>
2021-02-19 23:29 ` [PATCH 1/9] ASoC: fsl: fsl_asrc: remove useless assignment Pierre-Louis Bossart
2021-02-19 23:29 ` [PATCH 2/9] ASoC: fsl: fsl_dma: remove unused variable Pierre-Louis Bossart
@ 2021-02-19 23:29 ` Pierre-Louis Bossart
2021-02-19 23:29 ` [PATCH 4/9] ASoC: fsl: fsl_esai: clarify expression Pierre-Louis Bossart
` (3 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: Pierre-Louis Bossart @ 2021-02-19 23:29 UTC (permalink / raw)
To: alsa-devel
Cc: Liam Girdwood, Timur Tabi, Xiubo Li, tiwai, Shengjiu Wang,
Takashi Iwai, linux-kernel, Pierre-Louis Bossart, Nicolin Chen,
open list:FREESCALE SOC SOUND DRIVERS, broonie, Jaroslav Kysela,
Fabio Estevam
cppcheck warnings:
sound/soc/fsl/fsl_easrc.c:751:53: style: Variable 'st2_mem_alloc' is
assigned a value that is never used. [unreadVariable]
int st1_chanxexp, st1_mem_alloc = 0, st2_mem_alloc = 0;
^
sound/soc/fsl/fsl_easrc.c:1331:11: style: Variable 'size' is assigned
a value that is never used. [unreadVariable]
int size = 0;
^
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
sound/soc/fsl/fsl_easrc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/fsl/fsl_easrc.c b/sound/soc/fsl/fsl_easrc.c
index 636a702f37a6..725a5d3aaa02 100644
--- a/sound/soc/fsl/fsl_easrc.c
+++ b/sound/soc/fsl/fsl_easrc.c
@@ -710,7 +710,7 @@ static int fsl_easrc_max_ch_for_slot(struct fsl_asrc_pair *ctx,
struct fsl_easrc_slot *slot)
{
struct fsl_easrc_ctx_priv *ctx_priv = ctx->private;
- int st1_mem_alloc = 0, st2_mem_alloc = 0;
+ int st1_mem_alloc = 0, st2_mem_alloc;
int pf_mem_alloc = 0;
int max_channels = 8 - slot->num_channel;
int channels = 0;
@@ -748,7 +748,7 @@ static int fsl_easrc_config_one_slot(struct fsl_asrc_pair *ctx,
{
struct fsl_asrc *easrc = ctx->asrc;
struct fsl_easrc_ctx_priv *ctx_priv = ctx->private;
- int st1_chanxexp, st1_mem_alloc = 0, st2_mem_alloc = 0;
+ int st1_chanxexp, st1_mem_alloc = 0, st2_mem_alloc;
unsigned int reg0, reg1, reg2, reg3;
unsigned int addr;
@@ -1328,7 +1328,7 @@ static int fsl_easrc_stop_context(struct fsl_asrc_pair *ctx)
{
struct fsl_asrc *easrc = ctx->asrc;
int val, i;
- int size = 0;
+ int size;
int retry = 200;
regmap_read(easrc->regmap, REG_EASRC_CC(ctx->index), &val);
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 4/9] ASoC: fsl: fsl_esai: clarify expression
[not found] <20210219232937.6440-1-pierre-louis.bossart@linux.intel.com>
` (2 preceding siblings ...)
2021-02-19 23:29 ` [PATCH 3/9] ASoC: fsl: fsl_easrc: remove useless assignments Pierre-Louis Bossart
@ 2021-02-19 23:29 ` Pierre-Louis Bossart
2021-02-19 23:29 ` [PATCH 5/9] ASoC: fsl: fsl_ssi: remove unnecessary tests Pierre-Louis Bossart
` (2 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: Pierre-Louis Bossart @ 2021-02-19 23:29 UTC (permalink / raw)
To: alsa-devel
Cc: Liam Girdwood, Timur Tabi, Xiubo Li, tiwai, Shengjiu Wang,
Takashi Iwai, linux-kernel, Pierre-Louis Bossart, Nicolin Chen,
open list:FREESCALE SOC SOUND DRIVERS, broonie, Jaroslav Kysela,
Fabio Estevam
cppcheck warning:
sound/soc/fsl/fsl_esai.c:307:16: style: Clarify calculation precedence
for '%' and '?'. [clarifyCalculation]
clk_id % 2 ? "extal" : "fsys");
^
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
sound/soc/fsl/fsl_esai.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
index 08056fa0a0fa..41b154417b92 100644
--- a/sound/soc/fsl/fsl_esai.c
+++ b/sound/soc/fsl/fsl_esai.c
@@ -304,7 +304,7 @@ static int fsl_esai_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id,
if (IS_ERR(clksrc)) {
dev_err(dai->dev, "no assigned %s clock\n",
- clk_id % 2 ? "extal" : "fsys");
+ (clk_id % 2) ? "extal" : "fsys");
return PTR_ERR(clksrc);
}
clk_rate = clk_get_rate(clksrc);
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 5/9] ASoC: fsl: fsl_ssi: remove unnecessary tests
[not found] <20210219232937.6440-1-pierre-louis.bossart@linux.intel.com>
` (3 preceding siblings ...)
2021-02-19 23:29 ` [PATCH 4/9] ASoC: fsl: fsl_esai: clarify expression Pierre-Louis Bossart
@ 2021-02-19 23:29 ` Pierre-Louis Bossart
2021-02-19 23:29 ` [PATCH 6/9] ASoC: fsl: imx-hdmi: remove unused structure members Pierre-Louis Bossart
2021-02-19 23:29 ` [PATCH 8/9] ASoC: fsl: mpc8610: remove useless assignment Pierre-Louis Bossart
6 siblings, 0 replies; 7+ messages in thread
From: Pierre-Louis Bossart @ 2021-02-19 23:29 UTC (permalink / raw)
To: alsa-devel
Cc: Liam Girdwood, Timur Tabi, Xiubo Li, tiwai, Shengjiu Wang,
Takashi Iwai, linux-kernel, Pierre-Louis Bossart, Nicolin Chen,
open list:FREESCALE SOC SOUND DRIVERS, broonie, Jaroslav Kysela,
Fabio Estevam
cppcheck warnings:
sound/soc/fsl/fsl_ssi.c:767:34: style: Condition 'div2' is always
false [knownConditionTrueFalse]
stccr = SSI_SxCCR_PM(pm + 1) | (div2 ? SSI_SxCCR_DIV2 : 0) |
^
sound/soc/fsl/fsl_ssi.c:722:9: note: Assignment 'div2=0', assigned value is 0
div2 = 0;
^
sound/soc/fsl/fsl_ssi.c:767:34: note: Condition 'div2' is always false
stccr = SSI_SxCCR_PM(pm + 1) | (div2 ? SSI_SxCCR_DIV2 : 0) |
^
sound/soc/fsl/fsl_ssi.c:768:4: style: Condition 'psr' is always false
[knownConditionTrueFalse]
(psr ? SSI_SxCCR_PSR : 0);
^
sound/soc/fsl/fsl_ssi.c:721:8: note: Assignment 'psr=0', assigned
value is 0
psr = 0;
^
sound/soc/fsl/fsl_ssi.c:768:4: note: Condition 'psr' is always false
(psr ? SSI_SxCCR_PSR : 0);
^
Upon further analysis, the variables 'div2' and 'psr' are set to zero
and never modified. All the tests can be removed.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
sound/soc/fsl/fsl_ssi.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 57811743c294..c57d0428c0a3 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -747,7 +747,7 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream,
sub *= 100000;
do_div(sub, freq);
- if (sub < savesub && !(i == 0 && psr == 0 && div2 == 0)) {
+ if (sub < savesub && !(i == 0)) {
baudrate = tmprate;
savesub = sub;
pm = i;
@@ -764,8 +764,7 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream,
return -EINVAL;
}
- stccr = SSI_SxCCR_PM(pm + 1) | (div2 ? SSI_SxCCR_DIV2 : 0) |
- (psr ? SSI_SxCCR_PSR : 0);
+ stccr = SSI_SxCCR_PM(pm + 1);
mask = SSI_SxCCR_PM_MASK | SSI_SxCCR_DIV2 | SSI_SxCCR_PSR;
/* STCCR is used for RX in synchronous mode */
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 6/9] ASoC: fsl: imx-hdmi: remove unused structure members
[not found] <20210219232937.6440-1-pierre-louis.bossart@linux.intel.com>
` (4 preceding siblings ...)
2021-02-19 23:29 ` [PATCH 5/9] ASoC: fsl: fsl_ssi: remove unnecessary tests Pierre-Louis Bossart
@ 2021-02-19 23:29 ` Pierre-Louis Bossart
2021-02-19 23:29 ` [PATCH 8/9] ASoC: fsl: mpc8610: remove useless assignment Pierre-Louis Bossart
6 siblings, 0 replies; 7+ messages in thread
From: Pierre-Louis Bossart @ 2021-02-19 23:29 UTC (permalink / raw)
To: alsa-devel
Cc: Liam Girdwood, Timur Tabi, Xiubo Li, tiwai, Shengjiu Wang,
Sascha Hauer, Takashi Iwai, linux-kernel, Pierre-Louis Bossart,
Nicolin Chen, open list:FREESCALE SOC SOUND DRIVERS, broonie,
NXP Linux Team, Pengutronix Kernel Team, Shawn Guo,
Jaroslav Kysela, Fabio Estevam,
moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE
cppcheck warning:
sound/soc/fsl/imx-hdmi.c:21:16: style: struct member
'cpu_priv::sysclk_freq' is never used. [unusedStructMember]
unsigned long sysclk_freq[2];
^
Additional checks show the sysclk_dir member is also not used.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
sound/soc/fsl/imx-hdmi.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/sound/soc/fsl/imx-hdmi.c b/sound/soc/fsl/imx-hdmi.c
index dbbb7618351c..1ebcb9a2336b 100644
--- a/sound/soc/fsl/imx-hdmi.c
+++ b/sound/soc/fsl/imx-hdmi.c
@@ -10,16 +10,12 @@
/**
* struct cpu_priv - CPU private data
- * @sysclk_freq: SYSCLK rates for set_sysclk()
- * @sysclk_dir: SYSCLK directions for set_sysclk()
* @sysclk_id: SYSCLK ids for set_sysclk()
* @slot_width: Slot width of each frame
*
* Note: [1] for tx and [0] for rx
*/
struct cpu_priv {
- unsigned long sysclk_freq[2];
- u32 sysclk_dir[2];
u32 sysclk_id[2];
u32 slot_width;
};
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 8/9] ASoC: fsl: mpc8610: remove useless assignment
[not found] <20210219232937.6440-1-pierre-louis.bossart@linux.intel.com>
` (5 preceding siblings ...)
2021-02-19 23:29 ` [PATCH 6/9] ASoC: fsl: imx-hdmi: remove unused structure members Pierre-Louis Bossart
@ 2021-02-19 23:29 ` Pierre-Louis Bossart
6 siblings, 0 replies; 7+ messages in thread
From: Pierre-Louis Bossart @ 2021-02-19 23:29 UTC (permalink / raw)
To: alsa-devel
Cc: Liam Girdwood, Timur Tabi, Xiubo Li, tiwai, Shengjiu Wang,
Takashi Iwai, linux-kernel, Pierre-Louis Bossart, Nicolin Chen,
open list:FREESCALE SOC SOUND DRIVERS, broonie, Jaroslav Kysela,
Fabio Estevam
cppcheck warning:
sound/soc/fsl/mpc8610_hpcd.c:333:6: style: Redundant initialization
for 'ret'. The initialized value is overwritten before it is
read. [redundantInitialization]
ret = fsl_asoc_get_dma_channel(np, "fsl,playback-dma",
^
sound/soc/fsl/mpc8610_hpcd.c:193:10: note: ret is initialized
int ret = -ENODEV;
^
sound/soc/fsl/mpc8610_hpcd.c:333:6: note: ret is overwritten
ret = fsl_asoc_get_dma_channel(np, "fsl,playback-dma",
^
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
sound/soc/fsl/mpc8610_hpcd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c
index eccc833390d4..58b9ca3c4da0 100644
--- a/sound/soc/fsl/mpc8610_hpcd.c
+++ b/sound/soc/fsl/mpc8610_hpcd.c
@@ -190,7 +190,7 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev)
struct device_node *codec_np = NULL;
struct mpc8610_hpcd_data *machine_data;
struct snd_soc_dai_link_component *comp;
- int ret = -ENODEV;
+ int ret;
const char *sprop;
const u32 *iprop;
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread