[PATCH 0/9] ASoC: soc-xxx: cleanup cppcheck warning
Hi Mark
Now I'm posting audio-graph-card2 patch-set, but it seems it needs longer discussion. Thus I want to post more easy patch first, and reduce my local patches.
These are cppcheck warning cleanup patches for soc-xxx.
Kuninori Morimoto (9): ASoC: soc-generic-dmaengine-pcm: cleanup cppcheck warning at dmaengine_pcm_hw_params() ASoC: soc-generic-dmaengine-pcm: cleanup cppcheck warning at dmaengine_pcm_new() ASoC: soc-generic-dmaengine-pcm: cleanup cppcheck warning at dmaengine_copy_user() ASoC: soc-dai: cleanup cppcheck warning at snd_soc_dai_link_set_capabilities() ASoC: soc-dai: cleanup cppcheck warning at snd_soc_pcm_dai_new() ASoC: soc-jack: cleanup cppcheck warning at snd_soc_jack_report() ASoC: soc-jack: cleanup cppcheck warning for CONFIG_GPIOLIB ASoC: soc-component: cleanup cppcheck warning at snd_soc_pcm_component_pm_runtime_get() ASoC: soc-ac97: cleanup cppcheck warning
sound/soc/soc-ac97.c | 14 ++++++-------- sound/soc/soc-component.c | 4 ++-- sound/soc/soc-dai.c | 18 ++++++++---------- sound/soc/soc-generic-dmaengine-pcm.c | 9 +++------ sound/soc/soc-jack.c | 15 +++++++-------- 5 files changed, 26 insertions(+), 34 deletions(-)
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
This patch cleanups below cppcheck warning.
sound/soc/soc-generic-dmaengine-pcm.c:82:6: style: The scope of the variable 'ret' can be reduced. [variableScope] int ret; ^
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-generic-dmaengine-pcm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c index 9ef80a48707e..9949db4649f4 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c @@ -79,7 +79,6 @@ static int dmaengine_pcm_hw_params(struct snd_soc_component *component, struct snd_pcm_hw_params *params, struct dma_slave_config *slave_config); struct dma_slave_config slave_config; - int ret;
memset(&slave_config, 0, sizeof(slave_config));
@@ -89,7 +88,7 @@ static int dmaengine_pcm_hw_params(struct snd_soc_component *component, prepare_slave_config = pcm->config->prepare_slave_config;
if (prepare_slave_config) { - ret = prepare_slave_config(substream, params, &slave_config); + int ret = prepare_slave_config(substream, params, &slave_config); if (ret) return ret;
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
This patch cleanups below cppcheck warning.
sound/soc/soc-generic-dmaengine-pcm.c:233:28: style: The scope of the variable 'substream' can be reduced. [variableScope] struct snd_pcm_substream *substream; ^
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-generic-dmaengine-pcm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c index 9949db4649f4..24b240783cf1 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c @@ -229,7 +229,6 @@ static int dmaengine_pcm_new(struct snd_soc_component *component, struct dmaengine_pcm *pcm = soc_component_to_pcm(component); const struct snd_dmaengine_pcm_config *config = pcm->config; struct device *dev = component->dev; - struct snd_pcm_substream *substream; size_t prealloc_buffer_size; size_t max_buffer_size; unsigned int i; @@ -243,7 +242,7 @@ static int dmaengine_pcm_new(struct snd_soc_component *component, }
for_each_pcm_streams(i) { - substream = rtd->pcm->streams[i].substream; + struct snd_pcm_substream *substream = rtd->pcm->streams[i].substream; if (!substream) continue;
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
This patch cleanups below cppcheck warning.
sound/soc/soc-generic-dmaengine-pcm.c:310:6: style: The scope of the variable 'ret' can be reduced. [variableScope] int ret; ^
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-generic-dmaengine-pcm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c index 24b240783cf1..4aa48c74f21a 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c @@ -305,14 +305,13 @@ static int dmaengine_copy_user(struct snd_soc_component *component, bool is_playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; void *dma_ptr = runtime->dma_area + hwoff + channel * (runtime->dma_bytes / runtime->channels); - int ret;
if (is_playback) if (copy_from_user(dma_ptr, buf, bytes)) return -EFAULT;
if (process) { - ret = process(substream, channel, hwoff, (__force void *)buf, bytes); + int ret = process(substream, channel, hwoff, (__force void *)buf, bytes); if (ret < 0) return ret; }
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
This patch cleanups below cppcheck warning.
sound/soc/soc-dai.c:454:7: style: The scope of the variable 'supported_cpu' can be reduced. [variableScope] bool supported_cpu; ^ sound/soc/soc-dai.c:455:7: style: The scope of the variable 'supported_codec' can be reduced. [variableScope] bool supported_codec; ^
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-dai.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c index a56dcc8d6fb7..a4e1c27a4ed2 100644 --- a/sound/soc/soc-dai.c +++ b/sound/soc/soc-dai.c @@ -492,18 +492,16 @@ bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int dir) */ void snd_soc_dai_link_set_capabilities(struct snd_soc_dai_link *dai_link) { - struct snd_soc_dai_link_component *cpu; - struct snd_soc_dai_link_component *codec; - struct snd_soc_dai *dai; bool supported[SNDRV_PCM_STREAM_LAST + 1]; - bool supported_cpu; - bool supported_codec; int direction; - int i;
for_each_pcm_streams(direction) { - supported_cpu = false; - supported_codec = false; + struct snd_soc_dai_link_component *cpu; + struct snd_soc_dai_link_component *codec; + struct snd_soc_dai *dai; + bool supported_cpu = false; + bool supported_codec = false; + int i;
for_each_link_cpus(dai_link, i, cpu) { dai = snd_soc_find_dai_with_mutex(cpu);
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
This patch cleanups below cppcheck warning.
sound/soc/soc-dai.c:553:13: style: Variable 'ret' is assigned a value that is never used. [unreadVariable] int i, ret = 0; ^
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-dai.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c index a4e1c27a4ed2..3db0fcf24385 100644 --- a/sound/soc/soc-dai.c +++ b/sound/soc/soc-dai.c @@ -595,11 +595,11 @@ int snd_soc_pcm_dai_remove(struct snd_soc_pcm_runtime *rtd, int order) int snd_soc_pcm_dai_new(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_dai *dai; - int i, ret = 0; + int i;
for_each_rtd_dais(rtd, i, dai) { if (dai->driver->pcm_new) { - ret = dai->driver->pcm_new(rtd, dai); + int ret = dai->driver->pcm_new(rtd, dai); if (ret < 0) return soc_dai_ret(dai, ret); }
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
This patch cleanups below cppcheck warning.
sound/soc/soc-jack.c:45:6: style: The scope of the variable 'enable' can be reduced. [variableScope] int enable; ^
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-jack.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c index 0f1820f36b4d..11961e35ad02 100644 --- a/sound/soc/soc-jack.c +++ b/sound/soc/soc-jack.c @@ -42,7 +42,6 @@ void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask) struct snd_soc_dapm_context *dapm; struct snd_soc_jack_pin *pin; unsigned int sync = 0; - int enable;
if (!jack) return; @@ -58,7 +57,7 @@ void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask) trace_snd_soc_jack_notify(jack, status);
list_for_each_entry(pin, &jack->pins, list) { - enable = pin->mask & jack->status; + int enable = pin->mask & jack->status;
if (pin->invert) enable = !enable;
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
This patch cleanups below cppcheck warning.
sound/soc/soc-jack.c:21:6: style: struct member 'jack_gpio_tbl::count' is never used. [unusedStructMember] int count; ^ sound/soc/soc-jack.c:23:28: style: struct member 'jack_gpio_tbl::gpios' is never used. [unusedStructMember] struct snd_soc_jack_gpio *gpios; ^
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-jack.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c index 11961e35ad02..d798765d168c 100644 --- a/sound/soc/soc-jack.c +++ b/sound/soc/soc-jack.c @@ -17,12 +17,6 @@ #include <linux/suspend.h> #include <trace/events/asoc.h>
-struct jack_gpio_tbl { - int count; - struct snd_soc_jack *jack; - struct snd_soc_jack_gpio *gpios; -}; - /** * snd_soc_jack_report - Report the current status for a jack * @@ -207,6 +201,12 @@ void snd_soc_jack_notifier_unregister(struct snd_soc_jack *jack, EXPORT_SYMBOL_GPL(snd_soc_jack_notifier_unregister);
#ifdef CONFIG_GPIOLIB +struct jack_gpio_tbl { + int count; + struct snd_soc_jack *jack; + struct snd_soc_jack_gpio *gpios; +}; + /* gpio detect */ static void snd_soc_jack_gpio_detect(struct snd_soc_jack_gpio *gpio) {
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
This patch cleanups below cppcheck warning.
sound/soc/soc-component.c:1183:9: style: The scope of the variable 'ret' can be reduced. [variableScope] int i, ret; ^
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-component.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c index c8dfd0de30e4..8e8d917d22f8 100644 --- a/sound/soc/soc-component.c +++ b/sound/soc/soc-component.c @@ -1171,10 +1171,10 @@ int snd_soc_pcm_component_pm_runtime_get(struct snd_soc_pcm_runtime *rtd, void *stream) { struct snd_soc_component *component; - int i, ret; + int i;
for_each_rtd_components(rtd, i, component) { - ret = pm_runtime_get_sync(component->dev); + int ret = pm_runtime_get_sync(component->dev); if (ret < 0 && ret != -EACCES) { pm_runtime_put_noidle(component->dev); return soc_component_ret(component, ret);
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
This patch cleanups below cppcheck warning.
sound/soc/soc-ac97.c:41:15: style: struct member 'snd_ac97_gpio_priv::gpios_set' is never used. [unusedStructMember] unsigned int gpios_set; ^ sound/soc/soc-ac97.c:42:28: style: struct member 'snd_ac97_gpio_priv::component' is never used. [unusedStructMember] struct snd_soc_component *component; ^
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-ac97.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/sound/soc/soc-ac97.c b/sound/soc/soc-ac97.c index 65db083e242b..5f49e3dec3fc 100644 --- a/sound/soc/soc-ac97.c +++ b/sound/soc/soc-ac97.c @@ -34,14 +34,6 @@ struct snd_ac97_reset_cfg { int gpio_reset; };
-struct snd_ac97_gpio_priv { -#ifdef CONFIG_GPIOLIB - struct gpio_chip gpio_chip; -#endif - unsigned int gpios_set; - struct snd_soc_component *component; -}; - static struct snd_ac97_bus soc_ac97_bus = { .ops = NULL, /* Gets initialized in snd_soc_set_ac97_ops() */ }; @@ -52,6 +44,12 @@ static void soc_ac97_device_release(struct device *dev) }
#ifdef CONFIG_GPIOLIB +struct snd_ac97_gpio_priv { + struct gpio_chip gpio_chip; + unsigned int gpios_set; + struct snd_soc_component *component; +}; + static inline struct snd_soc_component *gpio_to_component(struct gpio_chip *chip) { struct snd_ac97_gpio_priv *gpio_priv = gpiochip_get_data(chip);
On 16 Aug 2021 13:55:18 +0900, Kuninori Morimoto wrote:
Now I'm posting audio-graph-card2 patch-set, but it seems it needs longer discussion. Thus I want to post more easy patch first, and reduce my local patches.
These are cppcheck warning cleanup patches for soc-xxx.
Kuninori Morimoto (9): ASoC: soc-generic-dmaengine-pcm: cleanup cppcheck warning at dmaengine_pcm_hw_params() ASoC: soc-generic-dmaengine-pcm: cleanup cppcheck warning at dmaengine_pcm_new() ASoC: soc-generic-dmaengine-pcm: cleanup cppcheck warning at dmaengine_copy_user() ASoC: soc-dai: cleanup cppcheck warning at snd_soc_dai_link_set_capabilities() ASoC: soc-dai: cleanup cppcheck warning at snd_soc_pcm_dai_new() ASoC: soc-jack: cleanup cppcheck warning at snd_soc_jack_report() ASoC: soc-jack: cleanup cppcheck warning for CONFIG_GPIOLIB ASoC: soc-component: cleanup cppcheck warning at snd_soc_pcm_component_pm_runtime_get() ASoC: soc-ac97: cleanup cppcheck warning
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/9] ASoC: soc-generic-dmaengine-pcm: cleanup cppcheck warning at dmaengine_pcm_hw_params() commit: 0a1e5ac50de2185d6e50b0d09fbed3ef06950d90 [2/9] ASoC: soc-generic-dmaengine-pcm: cleanup cppcheck warning at dmaengine_pcm_new() commit: 9cec66fa702646b83ed970a91edd712d156c380f [3/9] ASoC: soc-generic-dmaengine-pcm: cleanup cppcheck warning at dmaengine_copy_user() commit: a2659768893bd90be4a243472e8bd2ef614c9de7 [4/9] ASoC: soc-dai: cleanup cppcheck warning at snd_soc_dai_link_set_capabilities() commit: d490f4e73e3c0b217242d92a8f679e62dc657001 [5/9] ASoC: soc-dai: cleanup cppcheck warning at snd_soc_pcm_dai_new() commit: 454a7422fa287d38fbc433260932383ed70b8af0 [6/9] ASoC: soc-jack: cleanup cppcheck warning at snd_soc_jack_report() commit: c2dea1fba206b6e16940fb2bbf5209b30018833c [7/9] ASoC: soc-jack: cleanup cppcheck warning for CONFIG_GPIOLIB commit: c7577906865c5da232c1eeabaa80129f4702290d [8/9] ASoC: soc-component: cleanup cppcheck warning at snd_soc_pcm_component_pm_runtime_get() commit: 500b39da62499721ffd287994322a36440d1bb9c [9/9] ASoC: soc-ac97: cleanup cppcheck warning commit: 834a36ddc6d276fce177fde6c994751aa40d498f
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
participants (2)
-
Kuninori Morimoto
-
Mark Brown