CC: [email protected] CC: [email protected] CC: [email protected] TO: Jani Nikula <[email protected]> CC: Lyude Paul <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 6b75d88fa81b122cce37ebf17428a849ccd3d0f1 commit: 6cc42fbeb150ff33b17cbf108713ca4be23994d8 drm/i915/backlight: extract backlight code to a separate file date: 2 months ago :::::: branch date: 5 hours ago :::::: commit date: 2 months ago config: i386-randconfig-c001-20210927 (attached as .config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498) 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 # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6cc42fbeb150ff33b17cbf108713ca4be23994d8 git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout 6cc42fbeb150ff33b17cbf108713ca4be23994d8 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 clang-analyzer If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <[email protected]> clang-analyzer warnings: (new ones prefixed by >>) ^ drivers/base/regmap/regmap-debugfs.c:72:7: note: Loop condition is false. Exiting loop c = list_first_entry(&map->debugfs_off_cache, ^ include/linux/list.h:522:2: note: expanded from macro 'list_first_entry' list_entry((ptr)->next, type, member) ^ include/linux/list.h:511:2: note: expanded from macro 'list_entry' container_of(ptr, type, member) ^ include/linux/kernel.h:495:2: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:306:2: note: expanded from macro '__compiletime_assert' do { \ ^ drivers/base/regmap/regmap-debugfs.c:76:3: note: Memory is released kfree(c); ^~~~~~~~ drivers/base/regmap/regmap-debugfs.c:71:2: note: Loop condition is true. Entering loop body while (!list_empty(&map->debugfs_off_cache)) { ^ drivers/base/regmap/regmap-debugfs.c:72:7: note: Left side of '&&' is false c = list_first_entry(&map->debugfs_off_cache, ^ include/linux/list.h:522:2: note: expanded from macro 'list_first_entry' list_entry((ptr)->next, type, member) ^ include/linux/list.h:511:2: note: expanded from macro 'list_entry' container_of(ptr, type, member) ^ include/linux/kernel.h:495:61: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ drivers/base/regmap/regmap-debugfs.c:72:7: note: Taking false branch c = list_first_entry(&map->debugfs_off_cache, ^ include/linux/list.h:522:2: note: expanded from macro 'list_first_entry' list_entry((ptr)->next, type, member) ^ include/linux/list.h:511:2: note: expanded from macro 'list_entry' container_of(ptr, type, member) ^ include/linux/kernel.h:495:2: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:308:3: note: expanded from macro '__compiletime_assert' if (!(condition)) \ ^ drivers/base/regmap/regmap-debugfs.c:72:7: note: Loop condition is false. Exiting loop c = list_first_entry(&map->debugfs_off_cache, ^ include/linux/list.h:522:2: note: expanded from macro 'list_first_entry' list_entry((ptr)->next, type, member) ^ include/linux/list.h:511:2: note: expanded from macro 'list_entry' container_of(ptr, type, member) ^ include/linux/kernel.h:495:2: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:306:2: note: expanded from macro '__compiletime_assert' do { \ ^ drivers/base/regmap/regmap-debugfs.c:75:3: note: Calling 'list_del' list_del(&c->list); ^~~~~~~~~~~~~~~~~~ include/linux/list.h:146:2: note: Calling '__list_del_entry' __list_del_entry(entry); ^~~~~~~~~~~~~~~~~~~~~~~ include/linux/list.h:132:2: note: Taking false branch if (!__list_del_entry_valid(entry)) ^ include/linux/list.h:135:13: note: Use of memory after it is freed __list_del(entry->prev, entry->next); ^~~~~~~~~~~ Suppressed 6 warnings (6 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 8 warnings generated. >> drivers/gpu/drm/i915/display/intel_backlight.c:43:15: warning: Division by >> zero [clang-analyzer-core.DivideZero] target_val = DIV_ROUND_CLOSEST_ULL(target_val, source_max - source_min); ^ include/linux/math.h:104:2: note: expanded from macro 'DIV_ROUND_CLOSEST_ULL' do_div(_tmp, __d); \ ^ arch/x86/include/asm/div64.h:33:21: note: expanded from macro 'do_div' __upper = __high % (__base); \ ^ drivers/gpu/drm/i915/display/intel_backlight.c:1581:38: note: Left side of '&&' is false struct intel_connector *connector = to_intel_connector(conn_state->connector); ^ drivers/gpu/drm/i915/display/intel_display_types.h:1400:31: note: expanded from macro 'to_intel_connector' #define to_intel_connector(x) container_of(x, struct intel_connector, base) ^ include/linux/kernel.h:495:61: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ drivers/gpu/drm/i915/display/intel_backlight.c:1581:38: note: Taking false branch struct intel_connector *connector = to_intel_connector(conn_state->connector); ^ drivers/gpu/drm/i915/display/intel_display_types.h:1400:31: note: expanded from macro 'to_intel_connector' #define to_intel_connector(x) container_of(x, struct intel_connector, base) ^ include/linux/kernel.h:495:2: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG' #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^ include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:308:3: note: expanded from macro '__compiletime_assert' if (!(condition)) \ ^ drivers/gpu/drm/i915/display/intel_backlight.c:1581:38: note: Loop condition is false. Exiting loop struct intel_connector *connector = to_intel_connector(conn_state->connector); ^ drivers/gpu/drm/i915/display/intel_display_types.h:1400:31: note: expanded from macro 'to_intel_connector' #define to_intel_connector(x) container_of(x, struct intel_connector, base) ^ include/linux/kernel.h:495:2: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG' #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^ include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:306:2: note: expanded from macro '__compiletime_assert' do { \ ^ drivers/gpu/drm/i915/display/intel_backlight.c:1585:6: note: Assuming field 'present' is true if (!panel->backlight.present) ^~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/i915/display/intel_backlight.c:1585:2: note: Taking false branch if (!panel->backlight.present) ^ drivers/gpu/drm/i915/display/intel_backlight.c:1589:6: note: Assuming field 'enabled' is false if (!panel->backlight.enabled) ^~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/i915/display/intel_backlight.c:1589:2: note: Taking true branch if (!panel->backlight.enabled) ^ drivers/gpu/drm/i915/display/intel_backlight.c:1590:3: note: Calling '__intel_panel_enable_backlight' __intel_panel_enable_backlight(crtc_state, conn_state); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/i915/display/intel_backlight.c:778:38: note: Left side of '&&' is false struct intel_connector *connector = to_intel_connector(conn_state->connector); ^ drivers/gpu/drm/i915/display/intel_display_types.h:1400:31: note: expanded from macro 'to_intel_connector' #define to_intel_connector(x) container_of(x, struct intel_connector, base) ^ include/linux/kernel.h:495:61: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ drivers/gpu/drm/i915/display/intel_backlight.c:778:38: note: Taking false branch struct intel_connector *connector = to_intel_connector(conn_state->connector); ^ drivers/gpu/drm/i915/display/intel_display_types.h:1400:31: note: expanded from macro 'to_intel_connector' #define to_intel_connector(x) container_of(x, struct intel_connector, base) ^ include/linux/kernel.h:495:2: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG' #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^ include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) vim +43 drivers/gpu/drm/i915/display/intel_backlight.c 6cc42fbeb150ff Jani Nikula 2021-08-25 16 6cc42fbeb150ff Jani Nikula 2021-08-25 17 /** 6cc42fbeb150ff Jani Nikula 2021-08-25 18 * scale - scale values from one range to another 6cc42fbeb150ff Jani Nikula 2021-08-25 19 * @source_val: value in range [@source_min..@source_max] 6cc42fbeb150ff Jani Nikula 2021-08-25 20 * @source_min: minimum legal value for @source_val 6cc42fbeb150ff Jani Nikula 2021-08-25 21 * @source_max: maximum legal value for @source_val 6cc42fbeb150ff Jani Nikula 2021-08-25 22 * @target_min: corresponding target value for @source_min 6cc42fbeb150ff Jani Nikula 2021-08-25 23 * @target_max: corresponding target value for @source_max 6cc42fbeb150ff Jani Nikula 2021-08-25 24 * 6cc42fbeb150ff Jani Nikula 2021-08-25 25 * Return @source_val in range [@source_min..@source_max] scaled to range 6cc42fbeb150ff Jani Nikula 2021-08-25 26 * [@target_min..@target_max]. 6cc42fbeb150ff Jani Nikula 2021-08-25 27 */ 6cc42fbeb150ff Jani Nikula 2021-08-25 28 static u32 scale(u32 source_val, 6cc42fbeb150ff Jani Nikula 2021-08-25 29 u32 source_min, u32 source_max, 6cc42fbeb150ff Jani Nikula 2021-08-25 30 u32 target_min, u32 target_max) 6cc42fbeb150ff Jani Nikula 2021-08-25 31 { 6cc42fbeb150ff Jani Nikula 2021-08-25 32 u64 target_val; 6cc42fbeb150ff Jani Nikula 2021-08-25 33 6cc42fbeb150ff Jani Nikula 2021-08-25 34 WARN_ON(source_min > source_max); 6cc42fbeb150ff Jani Nikula 2021-08-25 35 WARN_ON(target_min > target_max); 6cc42fbeb150ff Jani Nikula 2021-08-25 36 6cc42fbeb150ff Jani Nikula 2021-08-25 37 /* defensive */ 6cc42fbeb150ff Jani Nikula 2021-08-25 38 source_val = clamp(source_val, source_min, source_max); 6cc42fbeb150ff Jani Nikula 2021-08-25 39 6cc42fbeb150ff Jani Nikula 2021-08-25 40 /* avoid overflows */ 6cc42fbeb150ff Jani Nikula 2021-08-25 41 target_val = mul_u32_u32(source_val - source_min, 6cc42fbeb150ff Jani Nikula 2021-08-25 42 target_max - target_min); 6cc42fbeb150ff Jani Nikula 2021-08-25 @43 target_val = DIV_ROUND_CLOSEST_ULL(target_val, source_max - source_min); 6cc42fbeb150ff Jani Nikula 2021-08-25 44 target_val += target_min; 6cc42fbeb150ff Jani Nikula 2021-08-25 45 6cc42fbeb150ff Jani Nikula 2021-08-25 46 return target_val; 6cc42fbeb150ff Jani Nikula 2021-08-25 47 } 6cc42fbeb150ff Jani Nikula 2021-08-25 48 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected]
.config.gz
Description: application/gzip
_______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
