From: kernel test robot <lkp@intel.com>
To: "Théo Lebrun" <theo.lebrun@bootlin.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
Stephen Boyd <sboyd@kernel.org>
Subject: drivers/clk/clk-eyeq.c:131 eqc_pll_downshift_factors() warn: always true condition '(*mult <= (~0)) => (0-u32max <= u32max)'
Date: Mon, 9 Dec 2024 12:30:34 +0800 [thread overview]
Message-ID: <202412080533.Inh1JBwa-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 7503345ac5f5e82fd9a36d6e6b447c016376403a
commit: 25d904946a0baf08b16204d95dc3624096d99c38 clk: eyeq: add driver
date: 6 weeks ago
config: nios2-randconfig-r073-20241206 (https://download.01.org/0day-ci/archive/20241208/202412080533.Inh1JBwa-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 14.2.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/202412080533.Inh1JBwa-lkp@intel.com/
smatch warnings:
drivers/clk/clk-eyeq.c:131 eqc_pll_downshift_factors() warn: always true condition '(*mult <= (~0)) => (0-u32max <= u32max)'
drivers/clk/clk-eyeq.c:131 eqc_pll_downshift_factors() warn: always true condition '(*div <= (~0)) => (0-u32max <= u32max)'
drivers/clk/clk-eyeq.c:374 eqc_probe() warn: 'base' from ioremap() not released on lines: 358.
vim +131 drivers/clk/clk-eyeq.c
112
113 /*
114 * Both factors (mult and div) must fit in 32 bits. When an operation overflows,
115 * this function throws away low bits so that factors still fit in 32 bits.
116 *
117 * Precision loss depends on amplitude of mult and div. Worst theorical
118 * loss is: (UINT_MAX+1) / UINT_MAX - 1 = 2.3e-10.
119 * This is 1Hz every 4.3GHz.
120 */
121 static void eqc_pll_downshift_factors(unsigned long *mult, unsigned long *div)
122 {
123 unsigned long biggest;
124 unsigned int shift;
125
126 /* This function can be removed if mult/div switch to unsigned long. */
127 static_assert(sizeof_field(struct clk_fixed_factor, mult) == sizeof(unsigned int));
128 static_assert(sizeof_field(struct clk_fixed_factor, div) == sizeof(unsigned int));
129
130 /* No overflow, nothing to be done. */
> 131 if (*mult <= UINT_MAX && *div <= UINT_MAX)
132 return;
133
134 /*
135 * Compute the shift required to bring the biggest factor into unsigned
136 * int range. That is, shift its highest set bit to the unsigned int
137 * most significant bit.
138 */
139 biggest = max(*mult, *div);
140 shift = __fls(biggest) - (BITS_PER_BYTE * sizeof(unsigned int)) + 1;
141
142 *mult >>= shift;
143 *div >>= shift;
144 }
145
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2024-12-09 4:31 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=202412080533.Inh1JBwa-lkp@intel.com \
--to=lkp@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=sboyd@kernel.org \
--cc=theo.lebrun@bootlin.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