Hi, [FYI, it's a private test report for your RFC patch.] [auto build test ERROR on linuxtv-media/master] [also build test ERROR on next-20210701] [cannot apply to sunxi/sunxi/for-next v5.13] [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/daniel-almeida-collabora-com/cedrus-h264-add-support-for-dynamically-allocated-ctrl-arrays/20210702-100300 base: git://linuxtv.org/media_tree.git master config: riscv-randconfig-r011-20210705 (attached as .config) compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 3f9bf9f42a9043e20c6d2a74dd4f47a90a7e2b41) 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 riscv cross compiling tool for clang build # apt-get install binutils-riscv64-linux-gnu # https://github.com/0day-ci/linux/commit/a7e6f08c21b9153ac6bd1b556f389d658a3b8cc8 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review daniel-almeida-collabora-com/cedrus-h264-add-support-for-dynamically-allocated-ctrl-arrays/20210702-100300 git checkout a7e6f08c21b9153ac6bd1b556f389d658a3b8cc8 # save the attached .config to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir ARCH=riscv SHELL=/bin/bash drivers/staging/media/sunxi/cedrus/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): ~~~~~~~~~~ ^ arch/riscv/include/asm/mmio.h:87:48: note: expanded from macro 'readb_cpu' #define readb_cpu(c) ({ u8 __r = __raw_readb(c); __r; }) ^ In file included from drivers/staging/media/sunxi/cedrus/cedrus.c:21: In file included from include/media/v4l2-device.h:13: In file included from include/media/v4l2-subdev.h:15: In file included from include/media/v4l2-common.h:270: In file included from include/linux/spi/spi.h:15: In file included from include/linux/scatterlist.h:9: In file included from arch/riscv/include/asm/io.h:149: include/asm-generic/io.h:564:9: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] return inw(addr); ^~~~~~~~~ arch/riscv/include/asm/io.h:56:76: note: expanded from macro 'inw' #define inw(c) ({ u16 __v; __io_pbr(); __v = readw_cpu((void*)(PCI_IOBASE + (c))); __io_par(__v); __v; }) ~~~~~~~~~~ ^ arch/riscv/include/asm/mmio.h:88:76: note: expanded from macro 'readw_cpu' #define readw_cpu(c) ({ u16 __r = le16_to_cpu((__force __le16)__raw_readw(c)); __r; }) ^ include/uapi/linux/byteorder/little_endian.h:36:51: note: expanded from macro '__le16_to_cpu' #define __le16_to_cpu(x) ((__force __u16)(__le16)(x)) ^ In file included from drivers/staging/media/sunxi/cedrus/cedrus.c:21: In file included from include/media/v4l2-device.h:13: In file included from include/media/v4l2-subdev.h:15: In file included from include/media/v4l2-common.h:270: In file included from include/linux/spi/spi.h:15: In file included from include/linux/scatterlist.h:9: In file included from arch/riscv/include/asm/io.h:149: include/asm-generic/io.h:572:9: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] return inl(addr); ^~~~~~~~~ arch/riscv/include/asm/io.h:57:76: note: expanded from macro 'inl' #define inl(c) ({ u32 __v; __io_pbr(); __v = readl_cpu((void*)(PCI_IOBASE + (c))); __io_par(__v); __v; }) ~~~~~~~~~~ ^ arch/riscv/include/asm/mmio.h:89:76: note: expanded from macro 'readl_cpu' #define readl_cpu(c) ({ u32 __r = le32_to_cpu((__force __le32)__raw_readl(c)); __r; }) ^ include/uapi/linux/byteorder/little_endian.h:34:51: note: expanded from macro '__le32_to_cpu' #define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) ^ In file included from drivers/staging/media/sunxi/cedrus/cedrus.c:21: In file included from include/media/v4l2-device.h:13: In file included from include/media/v4l2-subdev.h:15: In file included from include/media/v4l2-common.h:270: In file included from include/linux/spi/spi.h:15: In file included from include/linux/scatterlist.h:9: In file included from arch/riscv/include/asm/io.h:149: include/asm-generic/io.h:580:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] outb(value, addr); ^~~~~~~~~~~~~~~~~ arch/riscv/include/asm/io.h:59:68: note: expanded from macro 'outb' #define outb(v,c) ({ __io_pbw(); writeb_cpu((v),(void*)(PCI_IOBASE + (c))); __io_paw(); }) ~~~~~~~~~~ ^ arch/riscv/include/asm/mmio.h:91:52: note: expanded from macro 'writeb_cpu' #define writeb_cpu(v, c) ((void)__raw_writeb((v), (c))) ^ In file included from drivers/staging/media/sunxi/cedrus/cedrus.c:21: In file included from include/media/v4l2-device.h:13: In file included from include/media/v4l2-subdev.h:15: In file included from include/media/v4l2-common.h:270: In file included from include/linux/spi/spi.h:15: In file included from include/linux/scatterlist.h:9: In file included from arch/riscv/include/asm/io.h:149: include/asm-generic/io.h:588:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] outw(value, addr); ^~~~~~~~~~~~~~~~~ arch/riscv/include/asm/io.h:60:68: note: expanded from macro 'outw' #define outw(v,c) ({ __io_pbw(); writew_cpu((v),(void*)(PCI_IOBASE + (c))); __io_paw(); }) ~~~~~~~~~~ ^ arch/riscv/include/asm/mmio.h:92:76: note: expanded from macro 'writew_cpu' #define writew_cpu(v, c) ((void)__raw_writew((__force u16)cpu_to_le16(v), (c))) ^ In file included from drivers/staging/media/sunxi/cedrus/cedrus.c:21: In file included from include/media/v4l2-device.h:13: In file included from include/media/v4l2-subdev.h:15: In file included from include/media/v4l2-common.h:270: In file included from include/linux/spi/spi.h:15: In file included from include/linux/scatterlist.h:9: In file included from arch/riscv/include/asm/io.h:149: include/asm-generic/io.h:596:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] outl(value, addr); ^~~~~~~~~~~~~~~~~ arch/riscv/include/asm/io.h:61:68: note: expanded from macro 'outl' #define outl(v,c) ({ __io_pbw(); writel_cpu((v),(void*)(PCI_IOBASE + (c))); __io_paw(); }) ~~~~~~~~~~ ^ arch/riscv/include/asm/mmio.h:93:76: note: expanded from macro 'writel_cpu' #define writel_cpu(v, c) ((void)__raw_writel((__force u32)cpu_to_le32(v), (c))) ^ In file included from drivers/staging/media/sunxi/cedrus/cedrus.c:21: In file included from include/media/v4l2-device.h:13: In file included from include/media/v4l2-subdev.h:15: In file included from include/media/v4l2-common.h:270: In file included from include/linux/spi/spi.h:15: In file included from include/linux/scatterlist.h:9: In file included from arch/riscv/include/asm/io.h:149: include/asm-generic/io.h:1024:55: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] return (port > MMIO_UPPER_LIMIT) ? NULL : PCI_IOBASE + port; ~~~~~~~~~~ ^ >> drivers/staging/media/sunxi/cedrus/cedrus.c:59:14: error: use of undeclared identifier 'V4L2_CTRL_FLAG_DYNAMIC_ARRAY' .flags = V4L2_CTRL_FLAG_DYNAMIC_ARRAY, ^ >> drivers/staging/media/sunxi/cedrus/cedrus.c:216:30: error: invalid application of 'sizeof' to an incomplete type 'const struct cedrus_control []' v4l2_ctrl_handler_init(hdl, CEDRUS_CONTROLS_COUNT); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ drivers/staging/media/sunxi/cedrus/cedrus.c:173:31: note: expanded from macro 'CEDRUS_CONTROLS_COUNT' #define CEDRUS_CONTROLS_COUNT ARRAY_SIZE(cedrus_controls) ^ include/linux/kernel.h:42:32: note: expanded from macro 'ARRAY_SIZE' #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) ^ include/media/v4l2-ctrls.h:513:37: note: expanded from macro 'v4l2_ctrl_handler_init' v4l2_ctrl_handler_init_class(hdl, nr_of_controls_hint, \ ^~~~~~~~~~~~~~~~~~~ drivers/staging/media/sunxi/cedrus/cedrus.c:223:29: error: invalid application of 'sizeof' to an incomplete type 'const struct cedrus_control []' ctrl_size = sizeof(ctrl) * CEDRUS_CONTROLS_COUNT + 1; ^~~~~~~~~~~~~~~~~~~~~ drivers/staging/media/sunxi/cedrus/cedrus.c:173:31: note: expanded from macro 'CEDRUS_CONTROLS_COUNT' #define CEDRUS_CONTROLS_COUNT ARRAY_SIZE(cedrus_controls) ^~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/kernel.h:42:32: note: expanded from macro 'ARRAY_SIZE' #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) ^~~~~ drivers/staging/media/sunxi/cedrus/cedrus.c:229:18: error: invalid application of 'sizeof' to an incomplete type 'const struct cedrus_control []' for (i = 0; i < CEDRUS_CONTROLS_COUNT; i++) { ^~~~~~~~~~~~~~~~~~~~~ drivers/staging/media/sunxi/cedrus/cedrus.c:173:31: note: expanded from macro 'CEDRUS_CONTROLS_COUNT' #define CEDRUS_CONTROLS_COUNT ARRAY_SIZE(cedrus_controls) ^~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/kernel.h:42:32: note: expanded from macro 'ARRAY_SIZE' #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) ^~~~~ 7 warnings and 4 errors generated. Kconfig warnings: (for reference only) WARNING: unmet direct dependencies detected for LOCKDEP Depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT && (FRAME_POINTER || MIPS || PPC || S390 || MICROBLAZE || ARM || ARC || X86) Selected by - PROVE_LOCKING && DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT - DEBUG_LOCK_ALLOC && DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT vim +/V4L2_CTRL_FLAG_DYNAMIC_ARRAY +59 drivers/staging/media/sunxi/cedrus/cedrus.c 30 31 static const struct cedrus_control cedrus_controls[] = { 32 { 33 .cfg = { 34 .id = V4L2_CID_STATELESS_MPEG2_SEQUENCE, 35 }, 36 .codec = CEDRUS_CODEC_MPEG2, 37 }, 38 { 39 .cfg = { 40 .id = V4L2_CID_STATELESS_MPEG2_PICTURE, 41 }, 42 .codec = CEDRUS_CODEC_MPEG2, 43 }, 44 { 45 .cfg = { 46 .id = V4L2_CID_STATELESS_MPEG2_QUANTISATION, 47 }, 48 .codec = CEDRUS_CODEC_MPEG2, 49 }, 50 { 51 .cfg = { 52 .id = V4L2_CID_STATELESS_H264_DECODE_PARAMS, 53 }, 54 .codec = CEDRUS_CODEC_H264, 55 }, 56 { 57 .cfg = { 58 .id = V4L2_CID_STATELESS_H264_SLICE_PARAMS, > 59 .flags = V4L2_CTRL_FLAG_DYNAMIC_ARRAY, 60 .dims = {32}, 61 /* FIXME: I suppose these last two will not be necessary */ 62 .type = V4L2_CTRL_TYPE_H264_SLICE_PARAMS, 63 .name = "H264 Slice Parameters", 64 }, 65 .codec = CEDRUS_CODEC_H264, 66 }, 67 { 68 .cfg = { 69 .id = V4L2_CID_STATELESS_H264_SPS, 70 }, 71 .codec = CEDRUS_CODEC_H264, 72 }, 73 { 74 .cfg = { 75 .id = V4L2_CID_STATELESS_H264_PPS, 76 }, 77 .codec = CEDRUS_CODEC_H264, 78 }, 79 { 80 .cfg = { 81 .id = V4L2_CID_STATELESS_H264_SCALING_MATRIX, 82 }, 83 .codec = CEDRUS_CODEC_H264, 84 }, 85 { 86 .cfg = { 87 .id = V4L2_CID_STATELESS_H264_PRED_WEIGHTS, 88 }, 89 .codec = CEDRUS_CODEC_H264, 90 }, 91 { 92 .cfg = { 93 .id = V4L2_CID_STATELESS_H264_DECODE_MODE, 94 .max = V4L2_STATELESS_H264_DECODE_MODE_SLICE_ARRAY_BASED, 95 .def = V4L2_STATELESS_H264_DECODE_MODE_SLICE_BASED, 96 }, 97 .codec = CEDRUS_CODEC_H264, 98 }, 99 { 100 .cfg = { 101 .id = V4L2_CID_STATELESS_H264_START_CODE, 102 .max = V4L2_STATELESS_H264_START_CODE_NONE, 103 .def = V4L2_STATELESS_H264_START_CODE_NONE, 104 }, 105 .codec = CEDRUS_CODEC_H264, 106 }, 107 /* 108 * We only expose supported profiles information, 109 * and not levels as it's not clear what is supported 110 * for each hardware/core version. 111 * In any case, TRY/S_FMT will clamp the format resolution 112 * to the maximum supported. 113 */ 114 { 115 .cfg = { 116 .id = V4L2_CID_MPEG_VIDEO_H264_PROFILE, 117 .min = V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE, 118 .def = V4L2_MPEG_VIDEO_H264_PROFILE_MAIN, 119 .max = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH, 120 .menu_skip_mask = 121 BIT(V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED), 122 }, 123 .codec = CEDRUS_CODEC_H264, 124 }, 125 { 126 .cfg = { 127 .id = V4L2_CID_MPEG_VIDEO_HEVC_SPS, 128 }, 129 .codec = CEDRUS_CODEC_H265, 130 }, 131 { 132 .cfg = { 133 .id = V4L2_CID_MPEG_VIDEO_HEVC_PPS, 134 }, 135 .codec = CEDRUS_CODEC_H265, 136 }, 137 { 138 .cfg = { 139 .id = V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS, 140 }, 141 .codec = CEDRUS_CODEC_H265, 142 }, 143 { 144 .cfg = { 145 .id = V4L2_CID_MPEG_VIDEO_HEVC_DECODE_MODE, 146 .max = V4L2_MPEG_VIDEO_HEVC_DECODE_MODE_SLICE_BASED, 147 .def = V4L2_MPEG_VIDEO_HEVC_DECODE_MODE_SLICE_BASED, 148 }, 149 .codec = CEDRUS_CODEC_H265, 150 }, 151 { 152 .cfg = { 153 .id = V4L2_CID_MPEG_VIDEO_HEVC_START_CODE, 154 .max = V4L2_MPEG_VIDEO_HEVC_START_CODE_NONE, 155 .def = V4L2_MPEG_VIDEO_HEVC_START_CODE_NONE, 156 }, 157 .codec = CEDRUS_CODEC_H265, 158 }, 159 { 160 .cfg = { 161 .id = V4L2_CID_STATELESS_VP8_FRAME, 162 }, 163 .codec = CEDRUS_CODEC_VP8, 164 }, 165 { 166 .cfg = { 167 .id = V4L2_CID_MPEG_VIDEO_HEVC_DECODE_PARAMS, 168 }, 169 .codec = CEDRUS_CODEC_H265, 170 }, 171 }; 172 173 #define CEDRUS_CONTROLS_COUNT ARRAY_SIZE(cedrus_controls) 174 175 struct v4l2_ctrl *cedrus_find_control(struct cedrus_ctx *ctx, u32 id) 176 { 177 unsigned int i; 178 179 for (i = 0; ctx->ctrls[i]; i++) 180 if (ctx->ctrls[i]->id == id) 181 return ctx->ctrls[i]; 182 183 return NULL; 184 } 185 186 void *cedrus_find_control_data(struct cedrus_ctx *ctx, u32 id) 187 { 188 struct v4l2_ctrl *ctrl; 189 190 ctrl = cedrus_find_control(ctx, id); 191 if (ctrl) 192 return ctrl->p_cur.p; 193 194 return NULL; 195 } 196 197 u32 cedrus_control_num_elems(struct cedrus_ctx *ctx, u32 id) 198 { 199 struct v4l2_ctrl *ctrl; 200 201 ctrl = cedrus_find_control(ctx, id); 202 if (ctrl) { 203 return ctrl->elems; 204 } 205 206 return 0; 207 } 208 209 static int cedrus_init_ctrls(struct cedrus_dev *dev, struct cedrus_ctx *ctx) 210 { 211 struct v4l2_ctrl_handler *hdl = &ctx->hdl; 212 struct v4l2_ctrl *ctrl; 213 unsigned int ctrl_size; 214 unsigned int i; 215 > 216 v4l2_ctrl_handler_init(hdl, CEDRUS_CONTROLS_COUNT); 217 if (hdl->error) { 218 v4l2_err(&dev->v4l2_dev, 219 "Failed to initialize control handler\n"); 220 return hdl->error; 221 } 222 223 ctrl_size = sizeof(ctrl) * CEDRUS_CONTROLS_COUNT + 1; 224 225 ctx->ctrls = kzalloc(ctrl_size, GFP_KERNEL); 226 if (!ctx->ctrls) 227 return -ENOMEM; 228 229 for (i = 0; i < CEDRUS_CONTROLS_COUNT; i++) { 230 ctrl = v4l2_ctrl_new_custom(hdl, &cedrus_controls[i].cfg, 231 NULL); 232 if (hdl->error) { 233 v4l2_err(&dev->v4l2_dev, 234 "Failed to create new custom control\n"); 235 236 v4l2_ctrl_handler_free(hdl); 237 kfree(ctx->ctrls); 238 ctx->ctrls = NULL; 239 return hdl->error; 240 } 241 242 ctx->ctrls[i] = ctrl; 243 } 244 245 ctx->fh.ctrl_handler = hdl; 246 v4l2_ctrl_handler_setup(hdl); 247 248 return 0; 249 } 250 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org