Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.

+29 -21
-6
include/linux/firmware/imx/dsp.h
··· 37 37 38 38 static inline void imx_dsp_set_data(struct imx_dsp_ipc *ipc, void *data) 39 39 { 40 - if (!ipc) 41 - return; 42 - 43 40 ipc->private_data = data; 44 41 } 45 42 46 43 static inline void *imx_dsp_get_data(struct imx_dsp_ipc *ipc) 47 44 { 48 - if (!ipc) 49 - return NULL; 50 - 51 45 return ipc->private_data; 52 46 } 53 47
-6
include/linux/firmware/mediatek/mtk-adsp-ipc.h
··· 46 46 47 47 static inline void mtk_adsp_ipc_set_data(struct mtk_adsp_ipc *ipc, void *data) 48 48 { 49 - if (!ipc) 50 - return; 51 - 52 49 ipc->private_data = data; 53 50 } 54 51 55 52 static inline void *mtk_adsp_ipc_get_data(struct mtk_adsp_ipc *ipc) 56 53 { 57 - if (!ipc) 58 - return NULL; 59 - 60 54 return ipc->private_data; 61 55 } 62 56
+3
sound/soc/amd/vangogh/acp5x-mach.c
··· 170 170 struct snd_soc_dai *dai = snd_soc_card_get_codec_dai(card, ACP5X_NAU8821_DAI_NAME); 171 171 int ret, bclk; 172 172 173 + if (!dai) 174 + return -EINVAL; 175 + 173 176 ret = snd_soc_dai_set_sysclk(dai, NAU8821_CLK_FLL_BLK, 0, SND_SOC_CLOCK_IN); 174 177 if (ret < 0) 175 178 dev_err(card->dev, "can't set FS clock %d\n", ret);
+7 -6
sound/soc/intel/atom/sst/sst_stream.c
··· 173 173 u32 length; 174 174 int pvt_id, ret = 0; 175 175 struct sst_block *block = NULL; 176 + u8 bytes_block = bytes->block; 176 177 177 178 dev_dbg(sst_drv_ctx->dev, 178 179 "type:%u ipc_msg:%u block:%u task_id:%u pipe: %#x length:%#x\n", 179 - bytes->type, bytes->ipc_msg, bytes->block, bytes->task_id, 180 + bytes->type, bytes->ipc_msg, bytes_block, bytes->task_id, 180 181 bytes->pipe_id, bytes->len); 181 182 182 183 if (sst_create_ipc_msg(&msg, true)) ··· 186 185 pvt_id = sst_assign_pvt_id(sst_drv_ctx); 187 186 sst_fill_header_mrfld(&msg->mrfld_header, bytes->ipc_msg, 188 187 bytes->task_id, 1, pvt_id); 189 - msg->mrfld_header.p.header_high.part.res_rqd = bytes->block; 188 + msg->mrfld_header.p.header_high.part.res_rqd = bytes_block; 190 189 length = bytes->len; 191 190 msg->mrfld_header.p.header_low_payload = length; 192 191 dev_dbg(sst_drv_ctx->dev, "length is %d\n", length); 193 192 memcpy(msg->mailbox_data, &bytes->bytes, bytes->len); 194 - if (bytes->block) { 193 + if (bytes_block) { 195 194 block = sst_create_block(sst_drv_ctx, bytes->ipc_msg, pvt_id); 196 195 if (block == NULL) { 197 196 kfree(msg); ··· 204 203 dev_dbg(sst_drv_ctx->dev, "msg->mrfld_header.p.header_low_payload:%d", 205 204 msg->mrfld_header.p.header_low_payload); 206 205 207 - if (bytes->block) { 206 + if (bytes_block) { 208 207 ret = sst_wait_timeout(sst_drv_ctx, block); 209 208 if (ret) { 210 209 dev_err(sst_drv_ctx->dev, "fw returned err %d\n", ret); ··· 217 216 * copy the reply and send back 218 217 * we need to update only sz and payload 219 218 */ 220 - if (bytes->block) { 219 + if (bytes_block) { 221 220 unsigned char *r = block->data; 222 221 223 222 dev_dbg(sst_drv_ctx->dev, "read back %d bytes", ··· 225 224 memcpy(bytes->bytes, r, bytes->len); 226 225 } 227 226 } 228 - if (bytes->block) 227 + if (bytes_block) 229 228 sst_free_block(sst_drv_ctx, block); 230 229 out: 231 230 test_and_clear_bit(pvt_id, &sst_drv_ctx->pvt_id);
+6
sound/soc/intel/boards/bdw_rt286.c
··· 187 187 { 188 188 struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, "rt286-aif1"); 189 189 190 + if (!codec_dai) 191 + return 0; 192 + 190 193 return snd_soc_component_set_jack(codec_dai->component, NULL, NULL); 191 194 } 192 195 193 196 static int card_resume_post(struct snd_soc_card *card) 194 197 { 195 198 struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, "rt286-aif1"); 199 + 200 + if (!codec_dai) 201 + return 0; 196 202 197 203 return snd_soc_component_set_jack(codec_dai->component, &card_headset, NULL); 198 204 }
+1 -1
sound/soc/sof/ipc3.c
··· 312 312 } else { 313 313 if (sof_debug_check_flag(SOF_DBG_PRINT_IPC_SUCCESS_LOGS)) 314 314 ipc3_log_header(sdev->dev, "ipc tx succeeded", hdr->cmd); 315 - if (msg->reply_size) 315 + if (reply_data && msg->reply_size) 316 316 /* copy the data returned from DSP */ 317 317 memcpy(reply_data, msg->reply_data, 318 318 msg->reply_size);
+9
sound/soc/sof/sof-client-probes-ipc4.c
··· 146 146 struct sof_man4_module *mentry = sof_ipc4_probe_get_module_info(cdev); 147 147 struct sof_ipc4_msg msg; 148 148 149 + if (!mentry) 150 + return -ENODEV; 151 + 149 152 msg.primary = mentry->id; 150 153 msg.primary |= SOF_IPC4_MSG_TYPE_SET(SOF_IPC4_MOD_DELETE_INSTANCE); 151 154 msg.primary |= SOF_IPC4_MSG_DIR(SOF_IPC4_MSG_REQUEST); ··· 200 197 struct sof_ipc4_msg msg; 201 198 int i, ret; 202 199 200 + if (!mentry) 201 + return -ENODEV; 202 + 203 203 /* The sof_probe_point_desc and sof_ipc4_probe_point structs 204 204 * are of same size and even the integers are the same in the 205 205 * same order, and similar meaning, but since there is no ··· 252 246 struct sof_ipc4_msg msg; 253 247 u32 *probe_point_ids; 254 248 int i, ret; 249 + 250 + if (!mentry) 251 + return -ENODEV; 255 252 256 253 probe_point_ids = kcalloc(num_buffer_id, sizeof(*probe_point_ids), 257 254 GFP_KERNEL);
+3 -2
sound/soc/sof/topology.c
··· 1117 1117 { 1118 1118 struct snd_soc_card *card = scomp->card; 1119 1119 struct snd_soc_pcm_runtime *rtd; 1120 + const char *sname = w->sname; 1120 1121 struct snd_soc_dai *cpu_dai; 1121 1122 int i, stream; 1122 1123 1123 - if (!w->sname) 1124 + if (!sname) 1124 1125 return; 1125 1126 1126 1127 if (w->id == snd_soc_dapm_dai_out) ··· 1134 1133 list_for_each_entry(rtd, &card->rtd_list, list) { 1135 1134 /* does stream match DAI link ? */ 1136 1135 if (!rtd->dai_link->stream_name || 1137 - strcmp(w->sname, rtd->dai_link->stream_name)) 1136 + strcmp(sname, rtd->dai_link->stream_name)) 1138 1137 continue; 1139 1138 1140 1139 for_each_rtd_cpu_dais(rtd, i, cpu_dai)