Re: [PATCH] leds: led-core: Get rid of enum led_brightness

From: kernel test robot
Date: Thu Dec 10 2020 - 15:05:27 EST


Hi Abanoub,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on pavel-linux-leds/for-next]
[also build test WARNING on linux/master linus/master j.anaszewski-leds/for-next v5.10-rc7 next-20201210]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Abanoub-Sameh/leds-led-core-Get-rid-of-enum-led_brightness/20201210-215536
base: git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds.git for-next
config: x86_64-randconfig-a004-20201209 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 1968804ac726e7674d5de22bc2204b45857da344)
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 x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/172073778888c1b26342cb54099eb1f54a482c1b
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Abanoub-Sameh/leds-led-core-Get-rid-of-enum-led_brightness/20201210-215536
git checkout 172073778888c1b26342cb54099eb1f54a482c1b
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

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

All warnings (new ones prefixed by >>):

>> drivers/leds/led-core.c:282:25: warning: comparison of distinct pointer types ('typeof (value) *' (aka 'int *') and 'typeof (led_cdev->max_brightness) *' (aka 'enum led_brightness *')) [-Wcompare-distinct-pointer-types]
led_cdev->brightness = min(value, led_cdev->max_brightness);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:51:19: note: expanded from macro 'min'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:42:24: note: expanded from macro '__careful_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~~~~~~~
include/linux/minmax.h:32:4: note: expanded from macro '__safe_cmp'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~~~~~~~
include/linux/minmax.h:18:28: note: expanded from macro '__typecheck'
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
drivers/leds/led-core.c:296:25: warning: comparison of distinct pointer types ('typeof (value) *' (aka 'int *') and 'typeof (led_cdev->max_brightness) *' (aka 'enum led_brightness *')) [-Wcompare-distinct-pointer-types]
led_cdev->brightness = min(value, led_cdev->max_brightness);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:51:19: note: expanded from macro 'min'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:42:24: note: expanded from macro '__careful_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~~~~~~~
include/linux/minmax.h:32:4: note: expanded from macro '__safe_cmp'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~~~~~~~
include/linux/minmax.h:18:28: note: expanded from macro '__typecheck'
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
2 warnings generated.

vim +282 drivers/leds/led-core.c

81fe8e5b73e3f4 Jacek Anaszewski 2015-10-07 279
172073778888c1 Abanoub Sameh 2020-12-10 280 void led_set_brightness_nosleep(struct led_classdev *led_cdev, int value)
81fe8e5b73e3f4 Jacek Anaszewski 2015-10-07 281 {
81fe8e5b73e3f4 Jacek Anaszewski 2015-10-07 @282 led_cdev->brightness = min(value, led_cdev->max_brightness);
81fe8e5b73e3f4 Jacek Anaszewski 2015-10-07 283
81fe8e5b73e3f4 Jacek Anaszewski 2015-10-07 284 if (led_cdev->flags & LED_SUSPENDED)
81fe8e5b73e3f4 Jacek Anaszewski 2015-10-07 285 return;
81fe8e5b73e3f4 Jacek Anaszewski 2015-10-07 286
81fe8e5b73e3f4 Jacek Anaszewski 2015-10-07 287 led_set_brightness_nopm(led_cdev, led_cdev->brightness);
81fe8e5b73e3f4 Jacek Anaszewski 2015-10-07 288 }
81fe8e5b73e3f4 Jacek Anaszewski 2015-10-07 289 EXPORT_SYMBOL_GPL(led_set_brightness_nosleep);
81fe8e5b73e3f4 Jacek Anaszewski 2015-10-07 290

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

Attachment: .config.gz
Description: application/gzip