Commit f75953bc authored by Mark Brown's avatar Mark Brown

Merge series "ASoC: soc-xxx: cleanup cppcheck warning" from Kuninori Morimoto...

Merge series "ASoC: soc-xxx: cleanup cppcheck warning" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

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(-)

--
2.25.1
parents 356b94a3 834a36dd
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......@@ -597,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);
}
......
......@@ -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;
......@@ -230,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;
......@@ -244,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;
......@@ -307,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;
}
......
......@@ -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
*
......@@ -42,7 +36,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 +51,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;
......@@ -208,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)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment