Re: [PATCH v3 5/5] media: platform: Add jpeg dec/enc feature
From: kbuild test robot
Date: Tue Sep 24 2019 - 06:12:15 EST
Hi Xia,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linuxtv-media/master]
[cannot apply to v5.3 next-20190920]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Xia-Jiang/Add-support-for-mt2701-JPEG-ENC-support/20190924-161234
base: git://linuxtv.org/media_tree.git master
config: sparc64-allmodconfig (attached as .config)
compiler: sparc64-linux-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=sparc64
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
drivers/media//platform/mtk-jpeg/mtk_jpeg_core.c: In function 'mtk_jpeg_querycap':
>> drivers/media//platform/mtk-jpeg/mtk_jpeg_core.c:139:2: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
else
^~~~
drivers/media//platform/mtk-jpeg/mtk_jpeg_core.c:141:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
^~~~~~~~
In file included from include/linux/clk.h:13:0,
from drivers/media//platform/mtk-jpeg/mtk_jpeg_core.c:9:
drivers/media//platform/mtk-jpeg/mtk_jpeg_core.c: In function 'mtk_jpeg_try_fmt_mplane':
include/linux/kernel.h:821:29: warning: comparison of distinct pointer types lacks a cast
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
^
include/linux/kernel.h:835:4: note: in expansion of macro '__typecheck'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~
include/linux/kernel.h:845:24: note: in expansion of macro '__safe_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
include/linux/kernel.h:854:19: note: in expansion of macro '__careful_cmp'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:28: note: in expansion of macro 'min'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
include/linux/kernel.h:835:4: note: in expansion of macro '__typecheck'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~
include/linux/kernel.h:845:24: note: in expansion of macro '__safe_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
include/linux/kernel.h:861:19: note: in expansion of macro '__careful_cmp'
#define max(x, y) __careful_cmp(x, y, >)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:45: note: in expansion of macro 'max'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
>> drivers/media//platform/mtk-jpeg/mtk_jpeg_core.c:338:21: note: in expansion of macro 'clamp'
pix_mp->height = clamp(pix_mp->height,
^~~~~
include/linux/kernel.h:821:29: warning: comparison of distinct pointer types lacks a cast
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
^
include/linux/kernel.h:835:4: note: in expansion of macro '__typecheck'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~
include/linux/kernel.h:845:24: note: in expansion of macro '__safe_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
include/linux/kernel.h:854:19: note: in expansion of macro '__careful_cmp'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:28: note: in expansion of macro 'min'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
>> drivers/media//platform/mtk-jpeg/mtk_jpeg_core.c:338:21: note: in expansion of macro 'clamp'
pix_mp->height = clamp(pix_mp->height,
^~~~~
include/linux/kernel.h:821:29: warning: comparison of distinct pointer types lacks a cast
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
^
include/linux/kernel.h:829:48: note: in definition of macro '__is_constexpr'
(sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
^
>> include/linux/kernel.h:835:25: note: in expansion of macro '__no_side_effects'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~~~~~~~
include/linux/kernel.h:845:24: note: in expansion of macro '__safe_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
include/linux/kernel.h:854:19: note: in expansion of macro '__careful_cmp'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:28: note: in expansion of macro 'min'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
include/linux/kernel.h:835:4: note: in expansion of macro '__typecheck'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~
include/linux/kernel.h:845:24: note: in expansion of macro '__safe_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
include/linux/kernel.h:861:19: note: in expansion of macro '__careful_cmp'
#define max(x, y) __careful_cmp(x, y, >)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:45: note: in expansion of macro 'max'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
>> drivers/media//platform/mtk-jpeg/mtk_jpeg_core.c:338:21: note: in expansion of macro 'clamp'
pix_mp->height = clamp(pix_mp->height,
^~~~~
include/linux/kernel.h:821:29: warning: comparison of distinct pointer types lacks a cast
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
^
include/linux/kernel.h:837:27: note: in definition of macro '__cmp'
#define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
^
include/linux/kernel.h:854:19: note: in expansion of macro '__careful_cmp'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:28: note: in expansion of macro 'min'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
include/linux/kernel.h:835:4: note: in expansion of macro '__typecheck'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~
include/linux/kernel.h:845:24: note: in expansion of macro '__safe_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
include/linux/kernel.h:861:19: note: in expansion of macro '__careful_cmp'
#define max(x, y) __careful_cmp(x, y, >)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:45: note: in expansion of macro 'max'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
>> drivers/media//platform/mtk-jpeg/mtk_jpeg_core.c:338:21: note: in expansion of macro 'clamp'
pix_mp->height = clamp(pix_mp->height,
^~~~~
include/linux/kernel.h:821:29: warning: comparison of distinct pointer types lacks a cast
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
^
include/linux/kernel.h:837:40: note: in definition of macro '__cmp'
#define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
^
include/linux/kernel.h:854:19: note: in expansion of macro '__careful_cmp'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:28: note: in expansion of macro 'min'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
include/linux/kernel.h:835:4: note: in expansion of macro '__typecheck'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~
include/linux/kernel.h:845:24: note: in expansion of macro '__safe_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
include/linux/kernel.h:861:19: note: in expansion of macro '__careful_cmp'
#define max(x, y) __careful_cmp(x, y, >)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:45: note: in expansion of macro 'max'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
>> drivers/media//platform/mtk-jpeg/mtk_jpeg_core.c:338:21: note: in expansion of macro 'clamp'
pix_mp->height = clamp(pix_mp->height,
^~~~~
include/linux/kernel.h:821:29: warning: comparison of distinct pointer types lacks a cast
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
^
include/linux/kernel.h:840:10: note: in definition of macro '__cmp_once'
typeof(x) unique_x = (x); \
^
include/linux/kernel.h:854:19: note: in expansion of macro '__careful_cmp'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:28: note: in expansion of macro 'min'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
include/linux/kernel.h:835:4: note: in expansion of macro '__typecheck'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~
include/linux/kernel.h:845:24: note: in expansion of macro '__safe_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
include/linux/kernel.h:861:19: note: in expansion of macro '__careful_cmp'
#define max(x, y) __careful_cmp(x, y, >)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:45: note: in expansion of macro 'max'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
>> drivers/media//platform/mtk-jpeg/mtk_jpeg_core.c:338:21: note: in expansion of macro 'clamp'
pix_mp->height = clamp(pix_mp->height,
^~~~~
include/linux/kernel.h:821:29: warning: comparison of distinct pointer types lacks a cast
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
^
include/linux/kernel.h:840:25: note: in definition of macro '__cmp_once'
typeof(x) unique_x = (x); \
^
include/linux/kernel.h:854:19: note: in expansion of macro '__careful_cmp'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:28: note: in expansion of macro 'min'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
include/linux/kernel.h:835:4: note: in expansion of macro '__typecheck'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~
include/linux/kernel.h:845:24: note: in expansion of macro '__safe_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
include/linux/kernel.h:861:19: note: in expansion of macro '__careful_cmp'
#define max(x, y) __careful_cmp(x, y, >)
^~~~~~~~~~~~~
--
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c: In function 'mtk_jpeg_querycap':
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c:139:2: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
else
^~~~
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c:141:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
^~~~~~~~
In file included from include/linux/clk.h:13:0,
from drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c:9:
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c: In function 'mtk_jpeg_try_fmt_mplane':
include/linux/kernel.h:821:29: warning: comparison of distinct pointer types lacks a cast
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
^
include/linux/kernel.h:835:4: note: in expansion of macro '__typecheck'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~
include/linux/kernel.h:845:24: note: in expansion of macro '__safe_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
include/linux/kernel.h:854:19: note: in expansion of macro '__careful_cmp'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:28: note: in expansion of macro 'min'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
include/linux/kernel.h:835:4: note: in expansion of macro '__typecheck'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~
include/linux/kernel.h:845:24: note: in expansion of macro '__safe_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
include/linux/kernel.h:861:19: note: in expansion of macro '__careful_cmp'
#define max(x, y) __careful_cmp(x, y, >)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:45: note: in expansion of macro 'max'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c:338:21: note: in expansion of macro 'clamp'
pix_mp->height = clamp(pix_mp->height,
^~~~~
include/linux/kernel.h:821:29: warning: comparison of distinct pointer types lacks a cast
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
^
include/linux/kernel.h:835:4: note: in expansion of macro '__typecheck'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~
include/linux/kernel.h:845:24: note: in expansion of macro '__safe_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
include/linux/kernel.h:854:19: note: in expansion of macro '__careful_cmp'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:28: note: in expansion of macro 'min'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c:338:21: note: in expansion of macro 'clamp'
pix_mp->height = clamp(pix_mp->height,
^~~~~
include/linux/kernel.h:821:29: warning: comparison of distinct pointer types lacks a cast
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
^
include/linux/kernel.h:829:48: note: in definition of macro '__is_constexpr'
(sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
^
>> include/linux/kernel.h:835:25: note: in expansion of macro '__no_side_effects'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~~~~~~~
include/linux/kernel.h:845:24: note: in expansion of macro '__safe_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
include/linux/kernel.h:854:19: note: in expansion of macro '__careful_cmp'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:28: note: in expansion of macro 'min'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
include/linux/kernel.h:835:4: note: in expansion of macro '__typecheck'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~
include/linux/kernel.h:845:24: note: in expansion of macro '__safe_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
include/linux/kernel.h:861:19: note: in expansion of macro '__careful_cmp'
#define max(x, y) __careful_cmp(x, y, >)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:45: note: in expansion of macro 'max'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c:338:21: note: in expansion of macro 'clamp'
pix_mp->height = clamp(pix_mp->height,
^~~~~
include/linux/kernel.h:821:29: warning: comparison of distinct pointer types lacks a cast
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
^
include/linux/kernel.h:837:27: note: in definition of macro '__cmp'
#define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
^
include/linux/kernel.h:854:19: note: in expansion of macro '__careful_cmp'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:28: note: in expansion of macro 'min'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
include/linux/kernel.h:835:4: note: in expansion of macro '__typecheck'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~
include/linux/kernel.h:845:24: note: in expansion of macro '__safe_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
include/linux/kernel.h:861:19: note: in expansion of macro '__careful_cmp'
#define max(x, y) __careful_cmp(x, y, >)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:45: note: in expansion of macro 'max'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c:338:21: note: in expansion of macro 'clamp'
pix_mp->height = clamp(pix_mp->height,
^~~~~
include/linux/kernel.h:821:29: warning: comparison of distinct pointer types lacks a cast
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
^
include/linux/kernel.h:837:40: note: in definition of macro '__cmp'
#define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
^
include/linux/kernel.h:854:19: note: in expansion of macro '__careful_cmp'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:28: note: in expansion of macro 'min'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
include/linux/kernel.h:835:4: note: in expansion of macro '__typecheck'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~
include/linux/kernel.h:845:24: note: in expansion of macro '__safe_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
include/linux/kernel.h:861:19: note: in expansion of macro '__careful_cmp'
#define max(x, y) __careful_cmp(x, y, >)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:45: note: in expansion of macro 'max'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c:338:21: note: in expansion of macro 'clamp'
pix_mp->height = clamp(pix_mp->height,
^~~~~
include/linux/kernel.h:821:29: warning: comparison of distinct pointer types lacks a cast
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
^
include/linux/kernel.h:840:10: note: in definition of macro '__cmp_once'
typeof(x) unique_x = (x); \
^
include/linux/kernel.h:854:19: note: in expansion of macro '__careful_cmp'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:28: note: in expansion of macro 'min'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
include/linux/kernel.h:835:4: note: in expansion of macro '__typecheck'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~
include/linux/kernel.h:845:24: note: in expansion of macro '__safe_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
include/linux/kernel.h:861:19: note: in expansion of macro '__careful_cmp'
#define max(x, y) __careful_cmp(x, y, >)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:45: note: in expansion of macro 'max'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c:338:21: note: in expansion of macro 'clamp'
pix_mp->height = clamp(pix_mp->height,
^~~~~
include/linux/kernel.h:821:29: warning: comparison of distinct pointer types lacks a cast
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
^
include/linux/kernel.h:840:25: note: in definition of macro '__cmp_once'
typeof(x) unique_x = (x); \
^
include/linux/kernel.h:854:19: note: in expansion of macro '__careful_cmp'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:28: note: in expansion of macro 'min'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
include/linux/kernel.h:835:4: note: in expansion of macro '__typecheck'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~
include/linux/kernel.h:845:24: note: in expansion of macro '__safe_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
include/linux/kernel.h:861:19: note: in expansion of macro '__careful_cmp'
#define max(x, y) __careful_cmp(x, y, >)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:45: note: in expansion of macro 'max'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c:338:21: note: in expansion of macro 'clamp'
pix_mp->height = clamp(pix_mp->height,
^~~~~
include/linux/kernel.h:821:29: warning: comparison of distinct pointer types lacks a cast
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
^
include/linux/kernel.h:835:4: note: in expansion of macro '__typecheck'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~
include/linux/kernel.h:845:24: note: in expansion of macro '__safe_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
include/linux/kernel.h:854:19: note: in expansion of macro '__careful_cmp'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:28: note: in expansion of macro 'min'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
include/linux/kernel.h:835:4: note: in expansion of macro '__typecheck'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~
include/linux/kernel.h:845:24: note: in expansion of macro '__safe_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
include/linux/kernel.h:861:19: note: in expansion of macro '__careful_cmp'
#define max(x, y) __careful_cmp(x, y, >)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:45: note: in expansion of macro 'max'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c:341:20: note: in expansion of macro 'clamp'
pix_mp->width = clamp(pix_mp->width,
^~~~~
include/linux/kernel.h:821:29: warning: comparison of distinct pointer types lacks a cast
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
^
include/linux/kernel.h:835:4: note: in expansion of macro '__typecheck'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~
include/linux/kernel.h:845:24: note: in expansion of macro '__safe_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
include/linux/kernel.h:854:19: note: in expansion of macro '__careful_cmp'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:28: note: in expansion of macro 'min'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c:341:20: note: in expansion of macro 'clamp'
pix_mp->width = clamp(pix_mp->width,
^~~~~
include/linux/kernel.h:821:29: warning: comparison of distinct pointer types lacks a cast
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
^
include/linux/kernel.h:829:48: note: in definition of macro '__is_constexpr'
(sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
^
>> include/linux/kernel.h:835:25: note: in expansion of macro '__no_side_effects'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~~~~~~~
include/linux/kernel.h:845:24: note: in expansion of macro '__safe_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
include/linux/kernel.h:854:19: note: in expansion of macro '__careful_cmp'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:28: note: in expansion of macro 'min'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
include/linux/kernel.h:835:4: note: in expansion of macro '__typecheck'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~
include/linux/kernel.h:845:24: note: in expansion of macro '__safe_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
include/linux/kernel.h:861:19: note: in expansion of macro '__careful_cmp'
#define max(x, y) __careful_cmp(x, y, >)
^~~~~~~~~~~~~
>> include/linux/kernel.h:898:45: note: in expansion of macro 'max'
#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^~~
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c:341:20: note: in expansion of macro 'clamp'
pix_mp->width = clamp(pix_mp->width,
^~~~~
include/linux/kernel.h:821:29: warning: comparison of distinct pointer types lacks a cast
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
^
include/linux/kernel.h:837:27: note: in definition of macro '__cmp'
#define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
^
include/linux/kernel.h:854:19: note: in expansion of macro '__careful_cmp'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~
vim +/min +898 include/linux/kernel.h
526211bc58c4b3 Ingo Molnar 2009-03-05 807
^1da177e4c3f41 Linus Torvalds 2005-04-16 808 /*
3c8ba0d61d04ce Kees Cook 2018-03-30 809 * min()/max()/clamp() macros must accomplish three things:
3c8ba0d61d04ce Kees Cook 2018-03-30 810 *
3c8ba0d61d04ce Kees Cook 2018-03-30 811 * - avoid multiple evaluations of the arguments (so side-effects like
3c8ba0d61d04ce Kees Cook 2018-03-30 812 * "x++" happen only once) when non-constant.
3c8ba0d61d04ce Kees Cook 2018-03-30 813 * - perform strict type-checking (to generate warnings instead of
3c8ba0d61d04ce Kees Cook 2018-03-30 814 * nasty runtime surprises). See the "unnecessary" pointer comparison
3c8ba0d61d04ce Kees Cook 2018-03-30 815 * in __typecheck().
3c8ba0d61d04ce Kees Cook 2018-03-30 816 * - retain result as a constant expressions when called with only
3c8ba0d61d04ce Kees Cook 2018-03-30 817 * constant expressions (to avoid tripping VLA warnings in stack
3c8ba0d61d04ce Kees Cook 2018-03-30 818 * allocation usage).
3c8ba0d61d04ce Kees Cook 2018-03-30 819 */
3c8ba0d61d04ce Kees Cook 2018-03-30 820 #define __typecheck(x, y) \
3c8ba0d61d04ce Kees Cook 2018-03-30 @821 (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
3c8ba0d61d04ce Kees Cook 2018-03-30 822
3c8ba0d61d04ce Kees Cook 2018-03-30 823 /*
3c8ba0d61d04ce Kees Cook 2018-03-30 824 * This returns a constant expression while determining if an argument is
3c8ba0d61d04ce Kees Cook 2018-03-30 825 * a constant expression, most importantly without evaluating the argument.
3c8ba0d61d04ce Kees Cook 2018-03-30 826 * Glory to Martin Uecker <Martin.Uecker@xxxxxxxxxxxxxxxxxxxxx>
^1da177e4c3f41 Linus Torvalds 2005-04-16 827 */
3c8ba0d61d04ce Kees Cook 2018-03-30 828 #define __is_constexpr(x) \
3c8ba0d61d04ce Kees Cook 2018-03-30 829 (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
3c8ba0d61d04ce Kees Cook 2018-03-30 830
3c8ba0d61d04ce Kees Cook 2018-03-30 831 #define __no_side_effects(x, y) \
3c8ba0d61d04ce Kees Cook 2018-03-30 832 (__is_constexpr(x) && __is_constexpr(y))
3c8ba0d61d04ce Kees Cook 2018-03-30 833
3c8ba0d61d04ce Kees Cook 2018-03-30 834 #define __safe_cmp(x, y) \
3c8ba0d61d04ce Kees Cook 2018-03-30 @835 (__typecheck(x, y) && __no_side_effects(x, y))
3c8ba0d61d04ce Kees Cook 2018-03-30 836
3c8ba0d61d04ce Kees Cook 2018-03-30 837 #define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
3c8ba0d61d04ce Kees Cook 2018-03-30 838
e9092d0d979611 Linus Torvalds 2018-04-09 839 #define __cmp_once(x, y, unique_x, unique_y, op) ({ \
e9092d0d979611 Linus Torvalds 2018-04-09 840 typeof(x) unique_x = (x); \
e9092d0d979611 Linus Torvalds 2018-04-09 841 typeof(y) unique_y = (y); \
e9092d0d979611 Linus Torvalds 2018-04-09 842 __cmp(unique_x, unique_y, op); })
3c8ba0d61d04ce Kees Cook 2018-03-30 843
3c8ba0d61d04ce Kees Cook 2018-03-30 844 #define __careful_cmp(x, y, op) \
3c8ba0d61d04ce Kees Cook 2018-03-30 845 __builtin_choose_expr(__safe_cmp(x, y), \
e9092d0d979611 Linus Torvalds 2018-04-09 846 __cmp(x, y, op), \
e9092d0d979611 Linus Torvalds 2018-04-09 847 __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
e8c97af0c1f23d Randy Dunlap 2017-10-13 848
e8c97af0c1f23d Randy Dunlap 2017-10-13 849 /**
e8c97af0c1f23d Randy Dunlap 2017-10-13 850 * min - return minimum of two values of the same or compatible types
e8c97af0c1f23d Randy Dunlap 2017-10-13 851 * @x: first value
e8c97af0c1f23d Randy Dunlap 2017-10-13 852 * @y: second value
e8c97af0c1f23d Randy Dunlap 2017-10-13 853 */
3c8ba0d61d04ce Kees Cook 2018-03-30 854 #define min(x, y) __careful_cmp(x, y, <)
e8c97af0c1f23d Randy Dunlap 2017-10-13 855
e8c97af0c1f23d Randy Dunlap 2017-10-13 856 /**
e8c97af0c1f23d Randy Dunlap 2017-10-13 857 * max - return maximum of two values of the same or compatible types
e8c97af0c1f23d Randy Dunlap 2017-10-13 858 * @x: first value
e8c97af0c1f23d Randy Dunlap 2017-10-13 859 * @y: second value
e8c97af0c1f23d Randy Dunlap 2017-10-13 860 */
3c8ba0d61d04ce Kees Cook 2018-03-30 861 #define max(x, y) __careful_cmp(x, y, >)
bdf4bbaaee3d4b Harvey Harrison 2008-04-30 862
e8c97af0c1f23d Randy Dunlap 2017-10-13 863 /**
e8c97af0c1f23d Randy Dunlap 2017-10-13 864 * min3 - return minimum of three values
e8c97af0c1f23d Randy Dunlap 2017-10-13 865 * @x: first value
e8c97af0c1f23d Randy Dunlap 2017-10-13 866 * @y: second value
e8c97af0c1f23d Randy Dunlap 2017-10-13 867 * @z: third value
e8c97af0c1f23d Randy Dunlap 2017-10-13 868 */
2e1d06e1c05af9 Michal Nazarewicz 2014-10-09 869 #define min3(x, y, z) min((typeof(x))min(x, y), z)
e8c97af0c1f23d Randy Dunlap 2017-10-13 870
e8c97af0c1f23d Randy Dunlap 2017-10-13 871 /**
e8c97af0c1f23d Randy Dunlap 2017-10-13 872 * max3 - return maximum of three values
e8c97af0c1f23d Randy Dunlap 2017-10-13 873 * @x: first value
e8c97af0c1f23d Randy Dunlap 2017-10-13 874 * @y: second value
e8c97af0c1f23d Randy Dunlap 2017-10-13 875 * @z: third value
e8c97af0c1f23d Randy Dunlap 2017-10-13 876 */
2e1d06e1c05af9 Michal Nazarewicz 2014-10-09 877 #define max3(x, y, z) max((typeof(x))max(x, y), z)
f27c85c56b32c4 Hagen Paul Pfeifer 2010-10-26 878
c8bf1336824ebd Martin K. Petersen 2010-09-10 879 /**
c8bf1336824ebd Martin K. Petersen 2010-09-10 880 * min_not_zero - return the minimum that is _not_ zero, unless both are zero
c8bf1336824ebd Martin K. Petersen 2010-09-10 881 * @x: value1
c8bf1336824ebd Martin K. Petersen 2010-09-10 882 * @y: value2
c8bf1336824ebd Martin K. Petersen 2010-09-10 883 */
c8bf1336824ebd Martin K. Petersen 2010-09-10 884 #define min_not_zero(x, y) ({ \
c8bf1336824ebd Martin K. Petersen 2010-09-10 885 typeof(x) __x = (x); \
c8bf1336824ebd Martin K. Petersen 2010-09-10 886 typeof(y) __y = (y); \
c8bf1336824ebd Martin K. Petersen 2010-09-10 887 __x == 0 ? __y : ((__y == 0) ? __x : min(__x, __y)); })
c8bf1336824ebd Martin K. Petersen 2010-09-10 888
bdf4bbaaee3d4b Harvey Harrison 2008-04-30 889 /**
bdf4bbaaee3d4b Harvey Harrison 2008-04-30 890 * clamp - return a value clamped to a given range with strict typechecking
bdf4bbaaee3d4b Harvey Harrison 2008-04-30 891 * @val: current value
2e1d06e1c05af9 Michal Nazarewicz 2014-10-09 892 * @lo: lowest allowable value
2e1d06e1c05af9 Michal Nazarewicz 2014-10-09 893 * @hi: highest allowable value
bdf4bbaaee3d4b Harvey Harrison 2008-04-30 894 *
e8c97af0c1f23d Randy Dunlap 2017-10-13 895 * This macro does strict typechecking of @lo/@hi to make sure they are of the
e8c97af0c1f23d Randy Dunlap 2017-10-13 896 * same type as @val. See the unnecessary pointer comparisons.
bdf4bbaaee3d4b Harvey Harrison 2008-04-30 897 */
2e1d06e1c05af9 Michal Nazarewicz 2014-10-09 @898 #define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
^1da177e4c3f41 Linus Torvalds 2005-04-16 899
:::::: The code at line 898 was first introduced by commit
:::::: 2e1d06e1c05af9dbe8a3bfddeefbf041ca637fff include/linux/kernel.h: rewrite min3, max3 and clamp using min and max
:::::: TO: Michal Nazarewicz <mina86@xxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip