sound/soc/fsl/fsl_easrc.c:345:19: warning: taking address of packed member 'center_tap' of class or structure 'interp_params' may result in an unaligned pointer value

From: kernel test robot
Date: Sun Feb 07 2021 - 11:00:01 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 61556703b610a104de324e4f061dc6cf7b218b46
commit: 955ac624058f91172b3b8820280556e699e1e0ff ASoC: fsl_easrc: Add EASRC ASoC CPU DAI drivers
date: 10 months ago
config: mips-randconfig-r032-20210207 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project c9439ca36342fb6013187d0a69aef92736951476)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=955ac624058f91172b3b8820280556e699e1e0ff
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 955ac624058f91172b3b8820280556e699e1e0ff
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> sound/soc/fsl/fsl_easrc.c:345:19: warning: taking address of packed member 'center_tap' of class or structure 'interp_params' may result in an unaligned pointer value [-Waddress-of-packed-member]
r = (uint32_t *)&selected_interp->center_tap;
^~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/fsl/fsl_easrc.c:967:5: warning: no previous prototype for function 'fsl_easrc_config_context' [-Wmissing-prototypes]
int fsl_easrc_config_context(struct fsl_asrc *easrc, unsigned int ctx_id)
^
sound/soc/fsl/fsl_easrc.c:967:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int fsl_easrc_config_context(struct fsl_asrc *easrc, unsigned int ctx_id)
^
static
sound/soc/fsl/fsl_easrc.c:1128:5: warning: no previous prototype for function 'fsl_easrc_set_ctx_format' [-Wmissing-prototypes]
int fsl_easrc_set_ctx_format(struct fsl_asrc_pair *ctx,
^
sound/soc/fsl/fsl_easrc.c:1128:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int fsl_easrc_set_ctx_format(struct fsl_asrc_pair *ctx,
^
static
sound/soc/fsl/fsl_easrc.c:1201:5: warning: no previous prototype for function 'fsl_easrc_set_ctx_organziation' [-Wmissing-prototypes]
int fsl_easrc_set_ctx_organziation(struct fsl_asrc_pair *ctx)
^
sound/soc/fsl/fsl_easrc.c:1201:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int fsl_easrc_set_ctx_organziation(struct fsl_asrc_pair *ctx)
^
static
sound/soc/fsl/fsl_easrc.c:1245:5: warning: no previous prototype for function 'fsl_easrc_request_context' [-Wmissing-prototypes]
int fsl_easrc_request_context(int channels, struct fsl_asrc_pair *ctx)
^
sound/soc/fsl/fsl_easrc.c:1245:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int fsl_easrc_request_context(int channels, struct fsl_asrc_pair *ctx)
^
static
sound/soc/fsl/fsl_easrc.c:1290:6: warning: no previous prototype for function 'fsl_easrc_release_context' [-Wmissing-prototypes]
void fsl_easrc_release_context(struct fsl_asrc_pair *ctx)
^
sound/soc/fsl/fsl_easrc.c:1290:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void fsl_easrc_release_context(struct fsl_asrc_pair *ctx)
^
static
sound/soc/fsl/fsl_easrc.c:1317:5: warning: no previous prototype for function 'fsl_easrc_start_context' [-Wmissing-prototypes]
int fsl_easrc_start_context(struct fsl_asrc_pair *ctx)
^
sound/soc/fsl/fsl_easrc.c:1317:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int fsl_easrc_start_context(struct fsl_asrc_pair *ctx)
^
static
sound/soc/fsl/fsl_easrc.c:1335:5: warning: no previous prototype for function 'fsl_easrc_stop_context' [-Wmissing-prototypes]
int fsl_easrc_stop_context(struct fsl_asrc_pair *ctx)
^
sound/soc/fsl/fsl_easrc.c:1335:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int fsl_easrc_stop_context(struct fsl_asrc_pair *ctx)
^
static
sound/soc/fsl/fsl_easrc.c:1382:18: warning: no previous prototype for function 'fsl_easrc_get_dma_channel' [-Wmissing-prototypes]
struct dma_chan *fsl_easrc_get_dma_channel(struct fsl_asrc_pair *ctx,
^
sound/soc/fsl/fsl_easrc.c:1382:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
struct dma_chan *fsl_easrc_get_dma_channel(struct fsl_asrc_pair *ctx,
^
static
9 warnings generated.
Assembler messages:
Fatal error: invalid -march= option: `mips64r2'
clang-12: error: assembler command failed with exit code 1 (use -v to see invocation)


vim +345 sound/soc/fsl/fsl_easrc.c

302
303 static int fsl_easrc_resampler_config(struct fsl_asrc *easrc)
304 {
305 struct device *dev = &easrc->pdev->dev;
306 struct fsl_easrc_priv *easrc_priv = easrc->private;
307 struct asrc_firmware_hdr *hdr = easrc_priv->firmware_hdr;
308 struct interp_params *interp = easrc_priv->interp;
309 struct interp_params *selected_interp = NULL;
310 unsigned int num_coeff;
311 unsigned int i;
312 u64 *coef;
313 u32 *r;
314 int ret;
315
316 if (!hdr) {
317 dev_err(dev, "firmware not loaded!\n");
318 return -ENODEV;
319 }
320
321 for (i = 0; i < hdr->interp_scen; i++) {
322 if ((interp[i].num_taps - 1) !=
323 bits_taps_to_val(easrc_priv->rs_num_taps))
324 continue;
325
326 coef = interp[i].coeff;
327 selected_interp = &interp[i];
328 dev_dbg(dev, "Selected interp_filter: %u taps - %u phases\n",
329 selected_interp->num_taps,
330 selected_interp->num_phases);
331 break;
332 }
333
334 if (!selected_interp) {
335 dev_err(dev, "failed to get interpreter configuration\n");
336 return -EINVAL;
337 }
338
339 /*
340 * RS_LOW - first half of center tap of the sinc function
341 * RS_HIGH - second half of center tap of the sinc function
342 * This is due to the fact the resampling function must be
343 * symetrical - i.e. odd number of taps
344 */
> 345 r = (uint32_t *)&selected_interp->center_tap;
346 regmap_write(easrc->regmap, REG_EASRC_RCTCL, EASRC_RCTCL_RS_CL(r[0]));
347 regmap_write(easrc->regmap, REG_EASRC_RCTCH, EASRC_RCTCH_RS_CH(r[1]));
348
349 /*
350 * Write Number of Resampling Coefficient Taps
351 * 00b - 32-Tap Resampling Filter
352 * 01b - 64-Tap Resampling Filter
353 * 10b - 128-Tap Resampling Filter
354 * 11b - N/A
355 */
356 regmap_update_bits(easrc->regmap, REG_EASRC_CRCC,
357 EASRC_CRCC_RS_TAPS_MASK,
358 EASRC_CRCC_RS_TAPS(easrc_priv->rs_num_taps));
359
360 /* Reset prefilter coefficient pointer back to 0 */
361 ret = fsl_easrc_coeff_mem_ptr_reset(easrc, 0, EASRC_RS_COEFF_MEM);
362 if (ret)
363 return ret;
364
365 /*
366 * When the filter is programmed to run in:
367 * 32-tap mode, 16-taps, 128-phases 4-coefficients per phase
368 * 64-tap mode, 32-taps, 64-phases 4-coefficients per phase
369 * 128-tap mode, 64-taps, 32-phases 4-coefficients per phase
370 * This means the number of writes is constant no matter
371 * the mode we are using
372 */
373 num_coeff = 16 * 128 * 4;
374
375 for (i = 0; i < num_coeff; i++) {
376 r = (uint32_t *)&coef[i];
377 regmap_write(easrc->regmap, REG_EASRC_CRCM,
378 EASRC_CRCM_RS_CWD(r[0]));
379 regmap_write(easrc->regmap, REG_EASRC_CRCM,
380 EASRC_CRCM_RS_CWD(r[1]));
381 }
382
383 return 0;
384 }
385

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip