Commit 5ca8f9a5 authored by Mark Brown's avatar Mark Brown

Merge series "ASoC: Intel: fix cppcheck warnings" from Pierre-Louis Bossart...

Merge series "ASoC: Intel: fix cppcheck warnings" from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

This patchset tries to reduce the number of warnings on those drivers,
so that cppcheck can become a viable tool to detect issues (currently
hundreds of reports).

Most of the problems are related to unnecessary/redundant variable
assignments, prototypes and one nice logical mistake resulting in an
always-true condition.

Pierre-Louis Bossart (21):
  ASoC: Intel: Atom: sst-atom-controls: remove redundant assignments
  ASoC: Intel: Atom: compress: remove redundant assignment
  ASoC: Intel: Atom: platform-pcm: remove redundant assignment
  ASoC: Intel: Atom: sst: remove useless NULL assignment
  ASoC: Intel: Atom: remove redundant initialization
  ASoC: Intel: Atom: sst_pvt: remove redundant initialization
  ASoC: Intel: Atom: platform-pcm: fix redundant return
  ASoC: Intel: Atom: remove useless assignment
  ASoC: Intel: Atom: sst_loader: remove always-true condition
  ASoC: Intel: Atom: sst_pvt: simplify return handling
  ASoC: Intel: Atom: (cosmetic) align parameters
  ASoC: Intel: Baytrail: (cosmetic) align function parameters
  ASoC: Intel: common: (cosmetic) align function parameters
  ASoC: Intel: haswell: (cosmetic) align function parameters
  ASoC: Intel: haswell-ipc: remove redundant assignments
  ASoC: Intel: Skylake: skl-nhlt: remove redundant initialization
  ASoC: Intel: Skylake: cldma: remove redundant initialization
  ASoC: Intel: Skylake: sst-utils: remove redundant assignment
  ASoC: Intel: Skylake: skl-topology: remove redundant assignments
  ASoC: Intel: Skylake: skl-topology: remove redundant assignment
  ASoC: Intel: Skylake: (cosmetic) align function parameters

 sound/soc/intel/atom/sst-atom-controls.c      |  4 +--
 .../intel/atom/sst-mfld-platform-compress.c   |  3 +-
 sound/soc/intel/atom/sst-mfld-platform-pcm.c  |  4 +--
 sound/soc/intel/atom/sst-mfld-platform.h      |  4 +--
 sound/soc/intel/atom/sst/sst.c                |  5 ++-
 sound/soc/intel/atom/sst/sst.h                | 34 +++++++++----------
 sound/soc/intel/atom/sst/sst_loader.c         |  3 +-
 sound/soc/intel/atom/sst/sst_pvt.c            |  4 +--
 sound/soc/intel/baytrail/sst-baytrail-ipc.h   |  3 +-
 sound/soc/intel/common/sst-dsp-priv.h         |  2 +-
 sound/soc/intel/common/sst-dsp.h              | 15 ++++----
 sound/soc/intel/haswell/sst-haswell-ipc.c     |  4 +--
 sound/soc/intel/haswell/sst-haswell-ipc.h     |  2 +-
 sound/soc/intel/skylake/cnl-sst-dsp.h         |  4 +--
 sound/soc/intel/skylake/skl-nhlt.c            |  2 +-
 sound/soc/intel/skylake/skl-sst-cldma.c       |  2 +-
 sound/soc/intel/skylake/skl-sst-ipc.h         | 16 ++++-----
 sound/soc/intel/skylake/skl-sst-utils.c       |  2 +-
 sound/soc/intel/skylake/skl-topology.c        |  8 ++---
 sound/soc/intel/skylake/skl-topology.h        |  8 ++---
 sound/soc/intel/skylake/skl.h                 |  2 +-
 21 files changed, 63 insertions(+), 68 deletions(-)

--
2.25.1
parents ba3e069f 8f0ccd59
......@@ -299,7 +299,7 @@ static int sst_find_and_send_pipe_algo(struct sst_data *drv,
{
int ret = 0;
struct sst_algo_control *bc;
struct sst_module *algo = NULL;
struct sst_module *algo;
dev_dbg(&drv->pdev->dev, "Enter: widget=%s\n", pipe);
......@@ -602,7 +602,7 @@ static int sst_set_pipe_gain(struct sst_ids *ids,
int ret = 0;
struct sst_gain_mixer_control *mc;
struct sst_gain_value *gv;
struct sst_module *gain = NULL;
struct sst_module *gain;
list_for_each_entry(gain, &ids->gain_list, node) {
struct snd_kcontrol *kctl = gain->kctl;
......
......@@ -42,8 +42,7 @@ static void sst_drain_notify(void *arg)
static int sst_platform_compr_open(struct snd_soc_component *component,
struct snd_compr_stream *cstream)
{
int ret_val = 0;
int ret_val;
struct snd_compr_runtime *runtime = cstream->runtime;
struct sst_runtime_stream *stream;
......
......@@ -366,7 +366,7 @@ static int sst_media_prepare(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct sst_runtime_stream *stream;
int ret_val = 0, str_id;
int ret_val, str_id;
stream = substream->runtime->private_data;
str_id = stream->stream_info.str_id;
......@@ -385,7 +385,7 @@ static int sst_media_prepare(struct snd_pcm_substream *substream,
if (ret_val)
return ret_val;
substream->runtime->hw.info = SNDRV_PCM_INFO_BLOCK_TRANSFER;
return ret_val;
return 0;
}
static int sst_enable_ssp(struct snd_pcm_substream *substream,
......
......@@ -173,6 +173,6 @@ struct sst_data {
struct snd_soc_card *soc_card;
struct sst_cmd_sba_hw_set_ssp ssp_cmd;
};
int sst_register_dsp(struct sst_device *sst);
int sst_unregister_dsp(struct sst_device *sst);
int sst_register_dsp(struct sst_device *dev);
int sst_unregister_dsp(struct sst_device *dev);
#endif
......@@ -49,7 +49,7 @@ static irqreturn_t intel_sst_interrupt_mrfld(int irq, void *context)
union ipc_header_mrfld header;
union sst_imr_reg_mrfld imr;
struct ipc_post *msg = NULL;
unsigned int size = 0;
unsigned int size;
struct intel_sst_drv *drv = (struct intel_sst_drv *) context;
irqreturn_t retval = IRQ_HANDLED;
......@@ -370,7 +370,6 @@ void sst_context_cleanup(struct intel_sst_drv *ctx)
kfree(ctx->fw_in_mem);
ctx->fw_in_mem = NULL;
sst_memcpy_free_resources(ctx);
ctx = NULL;
}
EXPORT_SYMBOL_GPL(sst_context_cleanup);
......@@ -424,7 +423,7 @@ static int intel_sst_suspend(struct device *dev)
{
struct intel_sst_drv *ctx = dev_get_drvdata(dev);
struct sst_fw_save *fw_save;
int i, ret = 0;
int i, ret;
/* check first if we are already in SW reset */
if (ctx->sst_state == SST_RESET)
......
......@@ -428,34 +428,34 @@ struct intel_sst_ops {
};
int sst_realloc_stream(struct intel_sst_drv *sst_drv_ctx, int str_id);
int sst_pause_stream(struct intel_sst_drv *sst_drv_ctx, int id);
int sst_resume_stream(struct intel_sst_drv *sst_drv_ctx, int id);
int sst_drop_stream(struct intel_sst_drv *sst_drv_ctx, int id);
int sst_free_stream(struct intel_sst_drv *sst_drv_ctx, int id);
int sst_pause_stream(struct intel_sst_drv *sst_drv_ctx, int str_id);
int sst_resume_stream(struct intel_sst_drv *sst_drv_ctx, int str_id);
int sst_drop_stream(struct intel_sst_drv *sst_drv_ctx, int str_id);
int sst_free_stream(struct intel_sst_drv *sst_drv_ctx, int str_id);
int sst_start_stream(struct intel_sst_drv *sst_drv_ctx, int str_id);
int sst_send_byte_stream_mrfld(struct intel_sst_drv *ctx,
struct snd_sst_bytes_v2 *sbytes);
int sst_send_byte_stream_mrfld(struct intel_sst_drv *sst_drv_ctx,
struct snd_sst_bytes_v2 *bytes);
int sst_set_stream_param(int str_id, struct snd_sst_params *str_param);
int sst_set_metadata(int str_id, char *params);
int sst_get_stream(struct intel_sst_drv *sst_drv_ctx,
int sst_get_stream(struct intel_sst_drv *ctx,
struct snd_sst_params *str_param);
int sst_get_stream_allocated(struct intel_sst_drv *ctx,
struct snd_sst_params *str_param,
struct snd_sst_lib_download **lib_dnld);
int sst_drain_stream(struct intel_sst_drv *sst_drv_ctx,
int str_id, bool partial_drain);
int sst_post_message_mrfld(struct intel_sst_drv *ctx,
struct ipc_post *msg, bool sync);
void sst_process_reply_mrfld(struct intel_sst_drv *ctx, struct ipc_post *msg);
int sst_start_mrfld(struct intel_sst_drv *ctx);
int intel_sst_reset_dsp_mrfld(struct intel_sst_drv *ctx);
void intel_sst_clear_intr_mrfld(struct intel_sst_drv *ctx);
int sst_load_fw(struct intel_sst_drv *ctx);
int sst_post_message_mrfld(struct intel_sst_drv *sst_drv_ctx,
struct ipc_post *ipc_msg, bool sync);
void sst_process_reply_mrfld(struct intel_sst_drv *sst_drv_ctx, struct ipc_post *msg);
int sst_start_mrfld(struct intel_sst_drv *sst_drv_ctx);
int intel_sst_reset_dsp_mrfld(struct intel_sst_drv *sst_drv_ctx);
void intel_sst_clear_intr_mrfld(struct intel_sst_drv *sst_drv_ctx);
int sst_load_fw(struct intel_sst_drv *sst_drv_ctx);
int sst_load_library(struct snd_sst_lib_download *lib, u8 ops);
void sst_post_download_mrfld(struct intel_sst_drv *ctx);
int sst_get_block_stream(struct intel_sst_drv *sst_drv_ctx);
void sst_memcpy_free_resources(struct intel_sst_drv *ctx);
void sst_memcpy_free_resources(struct intel_sst_drv *sst_drv_ctx);
int sst_wait_interruptible(struct intel_sst_drv *sst_drv_ctx,
struct sst_block *block);
......@@ -490,7 +490,7 @@ int sst_prepare_and_post_msg(struct intel_sst_drv *sst,
bool large, bool fill_dsp, bool sync, bool response);
void sst_process_pending_msg(struct work_struct *work);
int sst_assign_pvt_id(struct intel_sst_drv *sst_drv_ctx);
int sst_assign_pvt_id(struct intel_sst_drv *drv);
int sst_validate_strid(struct intel_sst_drv *sst_drv_ctx, int str_id);
struct stream_info *get_stream_info(struct intel_sst_drv *sst_drv_ctx,
int str_id);
......
......@@ -398,8 +398,7 @@ int sst_load_fw(struct intel_sst_drv *sst_drv_ctx)
dev_dbg(sst_drv_ctx->dev, "sst_load_fw\n");
if (sst_drv_ctx->sst_state != SST_RESET ||
sst_drv_ctx->sst_state == SST_SHUTDOWN)
if (sst_drv_ctx->sst_state != SST_RESET)
return -EAGAIN;
if (!sst_drv_ctx->fw_in_mem) {
......
......@@ -188,7 +188,7 @@ int sst_create_block_and_ipc_msg(struct ipc_post **arg, bool large,
struct intel_sst_drv *sst_drv_ctx, struct sst_block **block,
u32 msg_id, u32 drv_id)
{
int retval = 0;
int retval;
retval = sst_create_ipc_msg(arg, large);
if (retval)
......@@ -198,7 +198,7 @@ int sst_create_block_and_ipc_msg(struct ipc_post **arg, bool large,
kfree(*arg);
return -ENOMEM;
}
return retval;
return 0;
}
/*
......
......@@ -26,8 +26,7 @@ extern struct sst_ops sst_byt_ops;
/* stream API */
struct sst_byt_stream *sst_byt_stream_new(struct sst_byt *byt, int id,
uint32_t (*get_write_position)(struct sst_byt_stream *stream,
void *data),
uint32_t (*notify_position)(struct sst_byt_stream *stream, void *data),
void *data);
/* stream configuration */
......
......@@ -344,7 +344,7 @@ void sst_fw_unload(struct sst_fw *sst_fw);
/* Create/Free firmware modules */
struct sst_module *sst_module_new(struct sst_fw *sst_fw,
struct sst_module_template *template, void *private);
void sst_module_free(struct sst_module *module);
void sst_module_free(struct sst_module *sst_module);
struct sst_module *sst_module_get_from_id(struct sst_dsp *dsp, u32 id);
int sst_module_alloc_blocks(struct sst_module *module);
int sst_module_free_blocks(struct sst_module *module);
......
......@@ -268,15 +268,14 @@ void sst_dsp_ipc_msg_tx(struct sst_dsp *dsp, u32 msg);
u32 sst_dsp_ipc_msg_rx(struct sst_dsp *dsp);
/* Mailbox management */
int sst_dsp_mailbox_init(struct sst_dsp *dsp, u32 inbox_offset,
int sst_dsp_mailbox_init(struct sst_dsp *sst, u32 inbox_offset,
size_t inbox_size, u32 outbox_offset, size_t outbox_size);
void sst_dsp_inbox_write(struct sst_dsp *dsp, void *message, size_t bytes);
void sst_dsp_inbox_read(struct sst_dsp *dsp, void *message, size_t bytes);
void sst_dsp_outbox_write(struct sst_dsp *dsp, void *message, size_t bytes);
void sst_dsp_outbox_read(struct sst_dsp *dsp, void *message, size_t bytes);
void sst_dsp_mailbox_dump(struct sst_dsp *dsp, size_t bytes);
int sst_dsp_register_poll(struct sst_dsp *dsp, u32 offset, u32 mask,
u32 expected_value, u32 timeout, char *operation);
void sst_dsp_inbox_write(struct sst_dsp *sst, void *message, size_t bytes);
void sst_dsp_inbox_read(struct sst_dsp *sst, void *message, size_t bytes);
void sst_dsp_outbox_write(struct sst_dsp *sst, void *message, size_t bytes);
void sst_dsp_outbox_read(struct sst_dsp *sst, void *message, size_t bytes);
int sst_dsp_register_poll(struct sst_dsp *ctx, u32 offset, u32 mask,
u32 target, u32 time, char *operation);
/* Debug */
void sst_dsp_dump(struct sst_dsp *sst);
......
......@@ -427,7 +427,7 @@ static void hsw_fw_ready(struct sst_hsw *hsw, u32 header)
u32 offset;
u8 fw_info[IPC_MAX_MAILBOX_BYTES - 5 * sizeof(u32)];
char *tmp[5], *pinfo;
int i = 0;
int i;
offset = (header & 0x1FFFFFFF) << 3;
......@@ -1789,7 +1789,7 @@ int sst_hsw_store_param_line(struct sst_hsw *hsw, u8 *buf)
int sst_hsw_load_param_line(struct sst_hsw *hsw, u8 *buf)
{
u8 id = 0;
u8 id;
/* read the first matching line from param buffer */
while (hsw->param_idx_r < WAVES_PARAM_LINES) {
......
......@@ -414,7 +414,7 @@ int sst_hsw_mixer_get_volume(struct sst_hsw *hsw, u32 stage_id, u32 channel,
/* Stream API */
struct sst_hsw_stream *sst_hsw_stream_new(struct sst_hsw *hsw, int id,
u32 (*get_write_position)(struct sst_hsw_stream *stream, void *data),
u32 (*notify_position)(struct sst_hsw_stream *stream, void *data),
void *data);
int sst_hsw_stream_free(struct sst_hsw *hsw, struct sst_hsw_stream *stream);
......
......@@ -82,8 +82,8 @@ struct sst_generic_ipc;
#define CNL_ADSPCS_CPA_SHIFT 24
#define CNL_ADSPCS_CPA(x) (x << CNL_ADSPCS_CPA_SHIFT)
int cnl_dsp_enable_core(struct sst_dsp *ctx, unsigned int core);
int cnl_dsp_disable_core(struct sst_dsp *ctx, unsigned int core);
int cnl_dsp_enable_core(struct sst_dsp *ctx, unsigned int core_mask);
int cnl_dsp_disable_core(struct sst_dsp *ctx, unsigned int core_mask);
irqreturn_t cnl_dsp_sst_interrupt(int irq, void *dev_id);
void cnl_dsp_free(struct sst_dsp *dsp);
......
......@@ -200,7 +200,7 @@ static void skl_get_ssp_clks(struct skl_dev *skl, struct skl_ssp_clk *ssp_clks,
struct skl_ssp_clk *sclk, *sclkfs;
struct nhlt_fmt_cfg *fmt_cfg;
struct wav_fmt_ext *wav_fmt;
unsigned long rate = 0;
unsigned long rate;
bool present = false;
int rate_index = 0;
u16 channels, bps;
......
......@@ -245,7 +245,7 @@ static int
skl_cldma_copy_to_buf(struct sst_dsp *ctx, const void *bin,
u32 total_size, bool wait)
{
int ret = 0;
int ret;
bool start = true;
unsigned int excess_bytes;
u32 size;
......
......@@ -107,12 +107,12 @@ struct skl_ipc_d0ix_msg {
irqreturn_t skl_dsp_irq_thread_handler(int irq, void *context);
int skl_ipc_create_pipeline(struct sst_generic_ipc *sst_ipc,
int skl_ipc_create_pipeline(struct sst_generic_ipc *ipc,
u16 ppl_mem_size, u8 ppl_type, u8 instance_id, u8 lp_mode);
int skl_ipc_delete_pipeline(struct sst_generic_ipc *sst_ipc, u8 instance_id);
int skl_ipc_delete_pipeline(struct sst_generic_ipc *ipc, u8 instance_id);
int skl_ipc_set_pipeline_state(struct sst_generic_ipc *sst_ipc,
int skl_ipc_set_pipeline_state(struct sst_generic_ipc *ipc,
u8 instance_id, enum skl_ipc_pipeline_state state);
int skl_ipc_save_pipeline(struct sst_generic_ipc *ipc,
......@@ -120,10 +120,10 @@ int skl_ipc_save_pipeline(struct sst_generic_ipc *ipc,
int skl_ipc_restore_pipeline(struct sst_generic_ipc *ipc, u8 instance_id);
int skl_ipc_init_instance(struct sst_generic_ipc *sst_ipc,
int skl_ipc_init_instance(struct sst_generic_ipc *ipc,
struct skl_ipc_init_instance_msg *msg, void *param_data);
int skl_ipc_bind_unbind(struct sst_generic_ipc *sst_ipc,
int skl_ipc_bind_unbind(struct sst_generic_ipc *ipc,
struct skl_ipc_bind_unbind_msg *msg);
int skl_ipc_load_modules(struct sst_generic_ipc *ipc,
......@@ -150,12 +150,12 @@ int skl_ipc_set_d0ix(struct sst_generic_ipc *ipc,
int skl_ipc_check_D0i0(struct sst_dsp *dsp, bool state);
void skl_ipc_int_enable(struct sst_dsp *dsp);
void skl_ipc_int_enable(struct sst_dsp *ctx);
void skl_ipc_op_int_enable(struct sst_dsp *ctx);
void skl_ipc_op_int_disable(struct sst_dsp *ctx);
void skl_ipc_int_disable(struct sst_dsp *dsp);
void skl_ipc_int_disable(struct sst_dsp *ctx);
bool skl_ipc_int_status(struct sst_dsp *dsp);
bool skl_ipc_int_status(struct sst_dsp *ctx);
void skl_ipc_free(struct sst_generic_ipc *ipc);
int skl_ipc_init(struct device *dev, struct skl_dev *skl);
void skl_clear_module_cnt(struct sst_dsp *ctx);
......
......@@ -237,7 +237,7 @@ int snd_skl_parse_uuids(struct sst_dsp *ctx, const struct firmware *fw,
struct uuid_module *module;
struct firmware stripped_fw;
unsigned int safe_file;
int ret = 0;
int ret;
/* Get the FW pointer to derive ADSP header */
stripped_fw.data = fw->data;
......
......@@ -550,8 +550,8 @@ static int skl_tplg_unload_pipe_modules(struct skl_dev *skl,
struct skl_pipe *pipe)
{
int ret = 0;
struct skl_pipe_module *w_module = NULL;
struct skl_module_cfg *mconfig = NULL;
struct skl_pipe_module *w_module;
struct skl_module_cfg *mconfig;
list_for_each_entry(w_module, &pipe->w_list, node) {
guid_t *uuid_mod;
......@@ -1893,7 +1893,7 @@ static int skl_tplg_be_set_src_pipe_params(struct snd_soc_dai *dai,
static int skl_tplg_be_set_sink_pipe_params(struct snd_soc_dai *dai,
struct snd_soc_dapm_widget *w, struct skl_pipe_params *params)
{
struct snd_soc_dapm_path *p = NULL;
struct snd_soc_dapm_path *p;
int ret = -EIO;
snd_soc_dapm_widget_for_each_sink_path(w, p) {
......@@ -2876,7 +2876,7 @@ static int skl_tplg_get_pvt_data(struct snd_soc_tplg_dapm_widget *tplg_w,
struct skl_module_cfg *mconfig)
{
struct snd_soc_tplg_vendor_array *array;
int num_blocks, block_size = 0, block_type, off = 0;
int num_blocks, block_size, block_type, off = 0;
char *data;
int ret;
......
......@@ -453,7 +453,7 @@ int skl_dsp_set_dma_control(struct skl_dev *skl, u32 *caps,
void skl_tplg_set_be_dmic_config(struct snd_soc_dai *dai,
struct skl_pipe_params *params, int stream);
int skl_tplg_init(struct snd_soc_component *component,
struct hdac_bus *ebus);
struct hdac_bus *bus);
void skl_tplg_exit(struct snd_soc_component *component,
struct hdac_bus *bus);
struct skl_module_cfg *skl_tplg_fe_get_cpr_module(
......@@ -476,13 +476,13 @@ int skl_stop_pipe(struct skl_dev *skl, struct skl_pipe *pipe);
int skl_reset_pipe(struct skl_dev *skl, struct skl_pipe *pipe);
int skl_init_module(struct skl_dev *skl, struct skl_module_cfg *module_config);
int skl_init_module(struct skl_dev *skl, struct skl_module_cfg *mconfig);
int skl_bind_modules(struct skl_dev *skl, struct skl_module_cfg
*src_module, struct skl_module_cfg *dst_module);
*src_mcfg, struct skl_module_cfg *dst_mcfg);
int skl_unbind_modules(struct skl_dev *skl, struct skl_module_cfg
*src_module, struct skl_module_cfg *dst_module);
*src_mcfg, struct skl_module_cfg *dst_mcfg);
int skl_set_module_params(struct skl_dev *skl, u32 *params, int size,
u32 param_id, struct skl_module_cfg *mcfg);
......
......@@ -166,7 +166,7 @@ int skl_platform_unregister(struct device *dev);
int skl_platform_register(struct device *dev);
struct nhlt_specific_cfg *skl_get_ep_blob(struct skl_dev *skl, u32 instance,
u8 link_type, u8 s_fmt, u8 no_ch,
u8 link_type, u8 s_fmt, u8 num_ch,
u32 s_rate, u8 dirn, u8 dev_type);
int skl_nhlt_update_topology_bin(struct skl_dev *skl);
......
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