Re: [PATCH] drm: log errors in drm_gem_fb_init_with_funcs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Simon,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on drm-tip/drm-tip drm-exynos/exynos-drm-next tegra-drm/drm/tegra/for-next linus/master v5.12 next-20210430]
[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/Simon-Ser/drm-log-errors-in-drm_gem_fb_init_with_funcs/20210430-224208
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: riscv-randconfig-r012-20210430 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8f5a2a5836cc8e4c1def2bdeb022e7b496623439)
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/9a5b8d668b957989ae026f9f91da5ed59d831ef5
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Simon-Ser/drm-log-errors-in-drm_gem_fb_init_with_funcs/20210430-224208
        git checkout 9a5b8d668b957989ae026f9f91da5ed59d831ef5
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=riscv 

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/gpu/drm/drm_gem_framebuffer_helper.c:176:9: warning: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
                                       objs[i]->size, min_size, i);
                                       ^~~~~~~~~~~~~
   include/drm/drm_print.h:450:45: note: expanded from macro 'drm_dbg_kms'
           drm_dev_dbg((drm)->dev, DRM_UT_KMS, fmt, ##__VA_ARGS__)
                                               ~~~    ^~~~~~~~~~~
   1 warning generated.


vim +176 drivers/gpu/drm/drm_gem_framebuffer_helper.c

   118	
   119	/**
   120	 * drm_gem_fb_init_with_funcs() - Helper function for implementing
   121	 *				  &drm_mode_config_funcs.fb_create
   122	 *				  callback in cases when the driver
   123	 *				  allocates a subclass of
   124	 *				  struct drm_framebuffer
   125	 * @dev: DRM device
   126	 * @fb: framebuffer object
   127	 * @file: DRM file that holds the GEM handle(s) backing the framebuffer
   128	 * @mode_cmd: Metadata from the userspace framebuffer creation request
   129	 * @funcs: vtable to be used for the new framebuffer object
   130	 *
   131	 * This function can be used to set &drm_framebuffer_funcs for drivers that need
   132	 * custom framebuffer callbacks. Use drm_gem_fb_create() if you don't need to
   133	 * change &drm_framebuffer_funcs. The function does buffer size validation.
   134	 * The buffer size validation is for a general case, though, so users should
   135	 * pay attention to the checks being appropriate for them or, at least,
   136	 * non-conflicting.
   137	 *
   138	 * Returns:
   139	 * Zero or a negative error code.
   140	 */
   141	int drm_gem_fb_init_with_funcs(struct drm_device *dev,
   142				       struct drm_framebuffer *fb,
   143				       struct drm_file *file,
   144				       const struct drm_mode_fb_cmd2 *mode_cmd,
   145				       const struct drm_framebuffer_funcs *funcs)
   146	{
   147		const struct drm_format_info *info;
   148		struct drm_gem_object *objs[4];
   149		int ret, i;
   150	
   151		info = drm_get_format_info(dev, mode_cmd);
   152		if (!info) {
   153			drm_dbg_kms(dev, "Failed to get FB format info\n");
   154			return -EINVAL;
   155		}
   156	
   157		for (i = 0; i < info->num_planes; i++) {
   158			unsigned int width = mode_cmd->width / (i ? info->hsub : 1);
   159			unsigned int height = mode_cmd->height / (i ? info->vsub : 1);
   160			unsigned int min_size;
   161	
   162			objs[i] = drm_gem_object_lookup(file, mode_cmd->handles[i]);
   163			if (!objs[i]) {
   164				drm_dbg_kms(dev, "Failed to lookup GEM object\n");
   165				ret = -ENOENT;
   166				goto err_gem_object_put;
   167			}
   168	
   169			min_size = (height - 1) * mode_cmd->pitches[i]
   170				 + drm_format_info_min_pitch(info, i, width)
   171				 + mode_cmd->offsets[i];
   172	
   173			if (objs[i]->size < min_size) {
   174				drm_dbg_kms(dev,
   175					    "GEM object size (%u) smaller than minimum size (%u) for plane %d\n",
 > 176					    objs[i]->size, min_size, i);
   177				drm_gem_object_put(objs[i]);
   178				ret = -EINVAL;
   179				goto err_gem_object_put;
   180			}
   181		}
   182	
   183		ret = drm_gem_fb_init(dev, fb, mode_cmd, objs, i, funcs);
   184		if (ret)
   185			goto err_gem_object_put;
   186	
   187		return 0;
   188	
   189	err_gem_object_put:
   190		for (i--; i >= 0; i--)
   191			drm_gem_object_put(objs[i]);
   192	
   193		return ret;
   194	}
   195	EXPORT_SYMBOL_GPL(drm_gem_fb_init_with_funcs);
   196	

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

Attachment: .config.gz
Description: application/gzip

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux