[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202512281902.bPsKjjkC-lkp@intel.com>
Date: Sun, 28 Dec 2025 20:22:45 +0800
From: kernel test robot <lkp@...el.com>
To: Shengjiu Wang <shengjiu.wang@....com>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
Mark Brown <broonie@...nel.org>
Subject: sound/soc/fsl/fsl_easrc.c:1999:2-8: WARNING: do_div() does a
64-by-32 division, please consider using div64_u64 instead.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: d26143bb38e2546fe6f8c9860c13a88146ce5dd6
commit: 27147695aaf7ccb0edc3f21454b5405c9037b4ba ASoC: fsl_easrc: define functions for memory to memory usage
date: 1 year ago
config: xtensa-randconfig-r052-20251228 (https://download.01.org/0day-ci/archive/20251228/202512281902.bPsKjjkC-lkp@intel.com/config)
compiler: xtensa-linux-gcc (GCC) 11.5.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512281902.bPsKjjkC-lkp@intel.com/
cocci warnings: (new ones prefixed by >>)
>> sound/soc/fsl/fsl_easrc.c:1999:2-8: WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead.
vim +1999 sound/soc/fsl/fsl_easrc.c
1949
1950 /* calculate capture data length according to output data length and sample rate */
1951 static int fsl_easrc_m2m_calc_out_len(struct fsl_asrc_pair *pair, int input_buffer_length)
1952 {
1953 struct fsl_asrc *easrc = pair->asrc;
1954 struct fsl_easrc_priv *easrc_priv = easrc->private;
1955 struct fsl_easrc_ctx_priv *ctx_priv = pair->private;
1956 unsigned int in_rate = ctx_priv->in_params.norm_rate;
1957 unsigned int out_rate = ctx_priv->out_params.norm_rate;
1958 unsigned int channels = pair->channels;
1959 unsigned int in_samples, out_samples;
1960 unsigned int in_width, out_width;
1961 unsigned int out_length;
1962 unsigned int frac_bits;
1963 u64 val1, val2;
1964
1965 switch (easrc_priv->rs_num_taps) {
1966 case EASRC_RS_32_TAPS:
1967 /* integer bits = 5; */
1968 frac_bits = 39;
1969 break;
1970 case EASRC_RS_64_TAPS:
1971 /* integer bits = 6; */
1972 frac_bits = 38;
1973 break;
1974 case EASRC_RS_128_TAPS:
1975 /* integer bits = 7; */
1976 frac_bits = 37;
1977 break;
1978 default:
1979 return -EINVAL;
1980 }
1981
1982 val1 = (u64)in_rate << frac_bits;
1983 do_div(val1, out_rate);
1984 val1 += (s64)ctx_priv->ratio_mod << (frac_bits - 31);
1985
1986 in_width = snd_pcm_format_physical_width(ctx_priv->in_params.sample_format) / 8;
1987 out_width = snd_pcm_format_physical_width(ctx_priv->out_params.sample_format) / 8;
1988
1989 ctx_priv->in_filled_len += input_buffer_length;
1990 if (ctx_priv->in_filled_len <= ctx_priv->in_filled_sample * in_width * channels) {
1991 out_length = 0;
1992 } else {
1993 in_samples = ctx_priv->in_filled_len / (in_width * channels) -
1994 ctx_priv->in_filled_sample;
1995
1996 /* right shift 12 bit to make ratio in 32bit space */
1997 val2 = (u64)in_samples << (frac_bits - 12);
1998 val1 = val1 >> 12;
> 1999 do_div(val2, val1);
2000 out_samples = val2;
2001
2002 out_length = out_samples * out_width * channels;
2003 ctx_priv->in_filled_len = ctx_priv->in_filled_sample * in_width * channels;
2004 }
2005
2006 return out_length;
2007 }
2008
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists