From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Julia Lawall <julia.lawall@inria.fr>
Subject: drivers/pwm/pwm-stm32.c:818:14-15: WARNING opportunity for min()
Date: Tue, 9 Dec 2025 08:49:24 +0800 [thread overview]
Message-ID: <202512090822.CIs63625-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
CC: "Uwe Kleine-König" <ukleinek@kernel.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: a110f942672c8995dc1cacb5a44c6730856743aa
commit: fd0b06972a8f92d57358e62267f5925721c73c6e pwm: stm32: add support for stm32mp25
date: 5 months ago
:::::: branch date: 3 hours ago
:::::: commit date: 5 months ago
config: hexagon-randconfig-r061-20251208 (https://download.01.org/0day-ci/archive/20251209/202512090822.CIs63625-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 000e46219ba1ee53fc42d35e00c314c2807e8b14)
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>
| Reported-by: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202512090822.CIs63625-lkp@intel.com/
cocci warnings: (new ones prefixed by >>)
>> drivers/pwm/pwm-stm32.c:818:14-15: WARNING opportunity for min()
vim +818 drivers/pwm/pwm-stm32.c
7edf7369205baa Benjamin Gaignard 2017-01-20 795
fd0b06972a8f92 Fabrice Gasnier 2025-01-10 796 static unsigned int stm32_pwm_detect_channels(struct stm32_timers *ddata,
19f1016ea9600e Philipp Zabel 2023-10-19 797 unsigned int *num_enabled)
7edf7369205baa Benjamin Gaignard 2017-01-20 798 {
fd0b06972a8f92 Fabrice Gasnier 2025-01-10 799 struct regmap *regmap = ddata->regmap;
19f1016ea9600e Philipp Zabel 2023-10-19 800 u32 ccer, ccer_backup;
7edf7369205baa Benjamin Gaignard 2017-01-20 801
fd0b06972a8f92 Fabrice Gasnier 2025-01-10 802 regmap_read(regmap, TIM_CCER, &ccer_backup);
fd0b06972a8f92 Fabrice Gasnier 2025-01-10 803 *num_enabled = hweight32(ccer_backup & TIM_CCER_CCXE);
fd0b06972a8f92 Fabrice Gasnier 2025-01-10 804
fd0b06972a8f92 Fabrice Gasnier 2025-01-10 805 if (ddata->ipidr) {
fd0b06972a8f92 Fabrice Gasnier 2025-01-10 806 u32 hwcfgr;
fd0b06972a8f92 Fabrice Gasnier 2025-01-10 807 unsigned int npwm;
fd0b06972a8f92 Fabrice Gasnier 2025-01-10 808
fd0b06972a8f92 Fabrice Gasnier 2025-01-10 809 /* Deduce from HWCFGR the number of outputs (MP25). */
fd0b06972a8f92 Fabrice Gasnier 2025-01-10 810 regmap_read(regmap, TIM_HWCFGR1, &hwcfgr);
fd0b06972a8f92 Fabrice Gasnier 2025-01-10 811
fd0b06972a8f92 Fabrice Gasnier 2025-01-10 812 /*
fd0b06972a8f92 Fabrice Gasnier 2025-01-10 813 * Timers may have more capture/compare channels than the
fd0b06972a8f92 Fabrice Gasnier 2025-01-10 814 * actual number of PWM channel outputs (e.g. TIM_CH[1..4]).
fd0b06972a8f92 Fabrice Gasnier 2025-01-10 815 */
fd0b06972a8f92 Fabrice Gasnier 2025-01-10 816 npwm = FIELD_GET(TIM_HWCFGR1_NB_OF_CC, hwcfgr);
fd0b06972a8f92 Fabrice Gasnier 2025-01-10 817
fd0b06972a8f92 Fabrice Gasnier 2025-01-10 @818 return npwm < STM32_MAX_PWM_OUTPUT ? npwm : STM32_MAX_PWM_OUTPUT;
fd0b06972a8f92 Fabrice Gasnier 2025-01-10 819 }
fd0b06972a8f92 Fabrice Gasnier 2025-01-10 820
7edf7369205baa Benjamin Gaignard 2017-01-20 821 /*
7edf7369205baa Benjamin Gaignard 2017-01-20 822 * If channels enable bits don't exist writing 1 will have no
7edf7369205baa Benjamin Gaignard 2017-01-20 823 * effect so we can detect and count them.
7edf7369205baa Benjamin Gaignard 2017-01-20 824 */
e315bf700b404c Uwe Kleine-König 2024-02-14 825 regmap_set_bits(regmap, TIM_CCER, TIM_CCER_CCXE);
e315bf700b404c Uwe Kleine-König 2024-02-14 826 regmap_read(regmap, TIM_CCER, &ccer);
e315bf700b404c Uwe Kleine-König 2024-02-14 827 regmap_write(regmap, TIM_CCER, ccer_backup);
19f1016ea9600e Philipp Zabel 2023-10-19 828
41fa8f57c0d269 Philipp Zabel 2023-10-19 829 return hweight32(ccer & TIM_CCER_CCXE);
7edf7369205baa Benjamin Gaignard 2017-01-20 830 }
7edf7369205baa Benjamin Gaignard 2017-01-20 831
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2025-12-09 0:49 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=202512090822.CIs63625-lkp@intel.com \
--to=lkp@intel.com \
--cc=julia.lawall@inria.fr \
--cc=oe-kbuild@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.