mirror of
https://github.com/torvalds/linux.git
synced 2024-11-30 16:11:38 +00:00
ASoC/SOF/Intel/AMD: cleanups for GCC11 -fanalyzer
Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>: GCC11 provides an '-fanalyzer' static analysis option which does not provide too many false-positives. This patch cleans-up known problematic code paths to help enable this capability in CI. We've used this for about a month already.
This commit is contained in:
commit
d09fd7eb07
@ -37,17 +37,11 @@ struct imx_dsp_ipc {
|
||||
|
||||
static inline void imx_dsp_set_data(struct imx_dsp_ipc *ipc, void *data)
|
||||
{
|
||||
if (!ipc)
|
||||
return;
|
||||
|
||||
ipc->private_data = data;
|
||||
}
|
||||
|
||||
static inline void *imx_dsp_get_data(struct imx_dsp_ipc *ipc)
|
||||
{
|
||||
if (!ipc)
|
||||
return NULL;
|
||||
|
||||
return ipc->private_data;
|
||||
}
|
||||
|
||||
|
@ -46,17 +46,11 @@ struct mtk_adsp_ipc {
|
||||
|
||||
static inline void mtk_adsp_ipc_set_data(struct mtk_adsp_ipc *ipc, void *data)
|
||||
{
|
||||
if (!ipc)
|
||||
return;
|
||||
|
||||
ipc->private_data = data;
|
||||
}
|
||||
|
||||
static inline void *mtk_adsp_ipc_get_data(struct mtk_adsp_ipc *ipc)
|
||||
{
|
||||
if (!ipc)
|
||||
return NULL;
|
||||
|
||||
return ipc->private_data;
|
||||
}
|
||||
|
||||
|
@ -170,6 +170,9 @@ static int acp5x_nau8821_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai = snd_soc_card_get_codec_dai(card, ACP5X_NAU8821_DAI_NAME);
|
||||
int ret, bclk;
|
||||
|
||||
if (!dai)
|
||||
return -EINVAL;
|
||||
|
||||
ret = snd_soc_dai_set_sysclk(dai, NAU8821_CLK_FLL_BLK, 0, SND_SOC_CLOCK_IN);
|
||||
if (ret < 0)
|
||||
dev_err(card->dev, "can't set FS clock %d\n", ret);
|
||||
|
@ -173,10 +173,11 @@ int sst_send_byte_stream_mrfld(struct intel_sst_drv *sst_drv_ctx,
|
||||
u32 length;
|
||||
int pvt_id, ret = 0;
|
||||
struct sst_block *block = NULL;
|
||||
u8 bytes_block = bytes->block;
|
||||
|
||||
dev_dbg(sst_drv_ctx->dev,
|
||||
"type:%u ipc_msg:%u block:%u task_id:%u pipe: %#x length:%#x\n",
|
||||
bytes->type, bytes->ipc_msg, bytes->block, bytes->task_id,
|
||||
bytes->type, bytes->ipc_msg, bytes_block, bytes->task_id,
|
||||
bytes->pipe_id, bytes->len);
|
||||
|
||||
if (sst_create_ipc_msg(&msg, true))
|
||||
@ -185,12 +186,12 @@ int sst_send_byte_stream_mrfld(struct intel_sst_drv *sst_drv_ctx,
|
||||
pvt_id = sst_assign_pvt_id(sst_drv_ctx);
|
||||
sst_fill_header_mrfld(&msg->mrfld_header, bytes->ipc_msg,
|
||||
bytes->task_id, 1, pvt_id);
|
||||
msg->mrfld_header.p.header_high.part.res_rqd = bytes->block;
|
||||
msg->mrfld_header.p.header_high.part.res_rqd = bytes_block;
|
||||
length = bytes->len;
|
||||
msg->mrfld_header.p.header_low_payload = length;
|
||||
dev_dbg(sst_drv_ctx->dev, "length is %d\n", length);
|
||||
memcpy(msg->mailbox_data, &bytes->bytes, bytes->len);
|
||||
if (bytes->block) {
|
||||
if (bytes_block) {
|
||||
block = sst_create_block(sst_drv_ctx, bytes->ipc_msg, pvt_id);
|
||||
if (block == NULL) {
|
||||
kfree(msg);
|
||||
@ -203,7 +204,7 @@ int sst_send_byte_stream_mrfld(struct intel_sst_drv *sst_drv_ctx,
|
||||
dev_dbg(sst_drv_ctx->dev, "msg->mrfld_header.p.header_low_payload:%d",
|
||||
msg->mrfld_header.p.header_low_payload);
|
||||
|
||||
if (bytes->block) {
|
||||
if (bytes_block) {
|
||||
ret = sst_wait_timeout(sst_drv_ctx, block);
|
||||
if (ret) {
|
||||
dev_err(sst_drv_ctx->dev, "fw returned err %d\n", ret);
|
||||
@ -216,7 +217,7 @@ int sst_send_byte_stream_mrfld(struct intel_sst_drv *sst_drv_ctx,
|
||||
* copy the reply and send back
|
||||
* we need to update only sz and payload
|
||||
*/
|
||||
if (bytes->block) {
|
||||
if (bytes_block) {
|
||||
unsigned char *r = block->data;
|
||||
|
||||
dev_dbg(sst_drv_ctx->dev, "read back %d bytes",
|
||||
@ -224,7 +225,7 @@ int sst_send_byte_stream_mrfld(struct intel_sst_drv *sst_drv_ctx,
|
||||
memcpy(bytes->bytes, r, bytes->len);
|
||||
}
|
||||
}
|
||||
if (bytes->block)
|
||||
if (bytes_block)
|
||||
sst_free_block(sst_drv_ctx, block);
|
||||
out:
|
||||
test_and_clear_bit(pvt_id, &sst_drv_ctx->pvt_id);
|
||||
|
@ -187,6 +187,9 @@ static int card_suspend_pre(struct snd_soc_card *card)
|
||||
{
|
||||
struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, "rt286-aif1");
|
||||
|
||||
if (!codec_dai)
|
||||
return 0;
|
||||
|
||||
return snd_soc_component_set_jack(codec_dai->component, NULL, NULL);
|
||||
}
|
||||
|
||||
@ -194,6 +197,9 @@ static int card_resume_post(struct snd_soc_card *card)
|
||||
{
|
||||
struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, "rt286-aif1");
|
||||
|
||||
if (!codec_dai)
|
||||
return 0;
|
||||
|
||||
return snd_soc_component_set_jack(codec_dai->component, &card_headset, NULL);
|
||||
}
|
||||
|
||||
|
@ -312,7 +312,7 @@ static int ipc3_wait_tx_done(struct snd_sof_ipc *ipc, void *reply_data)
|
||||
} else {
|
||||
if (sof_debug_check_flag(SOF_DBG_PRINT_IPC_SUCCESS_LOGS))
|
||||
ipc3_log_header(sdev->dev, "ipc tx succeeded", hdr->cmd);
|
||||
if (msg->reply_size)
|
||||
if (reply_data && msg->reply_size)
|
||||
/* copy the data returned from DSP */
|
||||
memcpy(reply_data, msg->reply_data,
|
||||
msg->reply_size);
|
||||
|
@ -146,6 +146,9 @@ static int ipc4_probes_deinit(struct sof_client_dev *cdev)
|
||||
struct sof_man4_module *mentry = sof_ipc4_probe_get_module_info(cdev);
|
||||
struct sof_ipc4_msg msg;
|
||||
|
||||
if (!mentry)
|
||||
return -ENODEV;
|
||||
|
||||
msg.primary = mentry->id;
|
||||
msg.primary |= SOF_IPC4_MSG_TYPE_SET(SOF_IPC4_MOD_DELETE_INSTANCE);
|
||||
msg.primary |= SOF_IPC4_MSG_DIR(SOF_IPC4_MSG_REQUEST);
|
||||
@ -197,6 +200,9 @@ static int ipc4_probes_points_add(struct sof_client_dev *cdev,
|
||||
struct sof_ipc4_msg msg;
|
||||
int i, ret;
|
||||
|
||||
if (!mentry)
|
||||
return -ENODEV;
|
||||
|
||||
/* The sof_probe_point_desc and sof_ipc4_probe_point structs
|
||||
* are of same size and even the integers are the same in the
|
||||
* same order, and similar meaning, but since there is no
|
||||
@ -247,6 +253,9 @@ static int ipc4_probes_points_remove(struct sof_client_dev *cdev,
|
||||
u32 *probe_point_ids;
|
||||
int i, ret;
|
||||
|
||||
if (!mentry)
|
||||
return -ENODEV;
|
||||
|
||||
probe_point_ids = kcalloc(num_buffer_id, sizeof(*probe_point_ids),
|
||||
GFP_KERNEL);
|
||||
if (!probe_point_ids)
|
||||
|
@ -1117,10 +1117,11 @@ static void sof_disconnect_dai_widget(struct snd_soc_component *scomp,
|
||||
{
|
||||
struct snd_soc_card *card = scomp->card;
|
||||
struct snd_soc_pcm_runtime *rtd;
|
||||
const char *sname = w->sname;
|
||||
struct snd_soc_dai *cpu_dai;
|
||||
int i, stream;
|
||||
|
||||
if (!w->sname)
|
||||
if (!sname)
|
||||
return;
|
||||
|
||||
if (w->id == snd_soc_dapm_dai_out)
|
||||
@ -1133,7 +1134,7 @@ static void sof_disconnect_dai_widget(struct snd_soc_component *scomp,
|
||||
list_for_each_entry(rtd, &card->rtd_list, list) {
|
||||
/* does stream match DAI link ? */
|
||||
if (!rtd->dai_link->stream_name ||
|
||||
strcmp(w->sname, rtd->dai_link->stream_name))
|
||||
strcmp(sname, rtd->dai_link->stream_name))
|
||||
continue;
|
||||
|
||||
for_each_rtd_cpu_dais(rtd, i, cpu_dai)
|
||||
|
Loading…
Reference in New Issue
Block a user