From: kernel test robot <lkp@intel.com>
To: Shengjiu Wang <shengjiu.wang@nxp.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
Mark Brown <broonie@kernel.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.
Date: Sun, 28 Dec 2025 20:22:45 +0800 [thread overview]
Message-ID: <202512281902.bPsKjjkC-lkp@intel.com> (raw)
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@intel.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
reply other threads:[~2025-12-28 12:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202512281902.bPsKjjkC-lkp@intel.com \
--to=lkp@intel.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=shengjiu.wang@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox