All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: drivers/gpu/drm/nouveau/nouveau_display.c:268:15: warning: variable 'width' set but not used
Date: Wed, 28 Apr 2021 06:42:47 +0800	[thread overview]
Message-ID: <202104280642.fG6ExtGH-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 4130 bytes --]

Hi James,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   e359bce39d9085ab24eaa0bb0778bb5f6894144a
commit: 4f5746c863db1a98535964009da19c6f7a842c55 drm/nouveau/kms: Check framebuffer size against bo
date:   11 months ago
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4f5746c863db1a98535964009da19c6f7a842c55
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 4f5746c863db1a98535964009da19c6f7a842c55
        # save the attached .config to linux build tree
        make W=1 W=1 ARCH=x86_64 

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

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/nouveau/nouveau_display.c: In function 'nouveau_framebuffer_new':
>> drivers/gpu/drm/nouveau/nouveau_display.c:268:15: warning: variable 'width' set but not used [-Wunused-but-set-variable]
     268 |  unsigned int width, height, i;
         |               ^~~~~


vim +/width +268 drivers/gpu/drm/nouveau/nouveau_display.c

   257	
   258	int
   259	nouveau_framebuffer_new(struct drm_device *dev,
   260				const struct drm_mode_fb_cmd2 *mode_cmd,
   261				struct drm_gem_object *gem,
   262				struct drm_framebuffer **pfb)
   263	{
   264		struct nouveau_drm *drm = nouveau_drm(dev);
   265		struct nouveau_bo *nvbo = nouveau_gem_object(gem);
   266		struct drm_framebuffer *fb;
   267		const struct drm_format_info *info;
 > 268		unsigned int width, height, i;
   269		int ret;
   270	
   271	        /* YUV overlays have special requirements pre-NV50 */
   272		if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA &&
   273	
   274		    (mode_cmd->pixel_format == DRM_FORMAT_YUYV ||
   275		     mode_cmd->pixel_format == DRM_FORMAT_UYVY ||
   276		     mode_cmd->pixel_format == DRM_FORMAT_NV12 ||
   277		     mode_cmd->pixel_format == DRM_FORMAT_NV21) &&
   278		    (mode_cmd->pitches[0] & 0x3f || /* align 64 */
   279		     mode_cmd->pitches[0] >= 0x10000 || /* at most 64k pitch */
   280		     (mode_cmd->pitches[1] && /* pitches for planes must match */
   281		      mode_cmd->pitches[0] != mode_cmd->pitches[1]))) {
   282			struct drm_format_name_buf format_name;
   283			DRM_DEBUG_KMS("Unsuitable framebuffer: format: %s; pitches: 0x%x\n 0x%x\n",
   284				      drm_get_format_name(mode_cmd->pixel_format,
   285							  &format_name),
   286				      mode_cmd->pitches[0],
   287				      mode_cmd->pitches[1]);
   288			return -EINVAL;
   289		}
   290	
   291		info = drm_get_format_info(dev, mode_cmd);
   292	
   293		for (i = 0; i < info->num_planes; i++) {
   294			width = drm_format_info_plane_width(info,
   295							    mode_cmd->width,
   296							    i);
   297			height = drm_format_info_plane_height(info,
   298							      mode_cmd->height,
   299							      i);
   300	
   301			if (nvbo->kind) {
   302				ret = nouveau_check_bl_size(drm, nvbo,
   303							    mode_cmd->offsets[i],
   304							    mode_cmd->pitches[i],
   305							    height, nvbo->mode);
   306				if (ret)
   307					return ret;
   308			} else {
   309				uint32_t size = mode_cmd->pitches[i] * height;
   310	
   311				if (size + mode_cmd->offsets[i] > nvbo->bo.mem.size)
   312					return -ERANGE;
   313			}
   314		}
   315	
   316		if (!(fb = *pfb = kzalloc(sizeof(*fb), GFP_KERNEL)))
   317			return -ENOMEM;
   318	
   319		drm_helper_mode_fill_fb_struct(dev, fb, mode_cmd);
   320		fb->obj[0] = gem;
   321	
   322		ret = drm_framebuffer_init(dev, fb, &nouveau_framebuffer_funcs);
   323		if (ret)
   324			kfree(fb);
   325		return ret;
   326	}
   327	

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 62355 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: James Jones <jajones@nvidia.com>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	Ben Skeggs <bskeggs@redhat.com>
Subject: drivers/gpu/drm/nouveau/nouveau_display.c:268:15: warning: variable 'width' set but not used
Date: Wed, 28 Apr 2021 06:42:47 +0800	[thread overview]
Message-ID: <202104280642.fG6ExtGH-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 4022 bytes --]

Hi James,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   e359bce39d9085ab24eaa0bb0778bb5f6894144a
commit: 4f5746c863db1a98535964009da19c6f7a842c55 drm/nouveau/kms: Check framebuffer size against bo
date:   11 months ago
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4f5746c863db1a98535964009da19c6f7a842c55
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 4f5746c863db1a98535964009da19c6f7a842c55
        # save the attached .config to linux build tree
        make W=1 W=1 ARCH=x86_64 

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

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/nouveau/nouveau_display.c: In function 'nouveau_framebuffer_new':
>> drivers/gpu/drm/nouveau/nouveau_display.c:268:15: warning: variable 'width' set but not used [-Wunused-but-set-variable]
     268 |  unsigned int width, height, i;
         |               ^~~~~


vim +/width +268 drivers/gpu/drm/nouveau/nouveau_display.c

   257	
   258	int
   259	nouveau_framebuffer_new(struct drm_device *dev,
   260				const struct drm_mode_fb_cmd2 *mode_cmd,
   261				struct drm_gem_object *gem,
   262				struct drm_framebuffer **pfb)
   263	{
   264		struct nouveau_drm *drm = nouveau_drm(dev);
   265		struct nouveau_bo *nvbo = nouveau_gem_object(gem);
   266		struct drm_framebuffer *fb;
   267		const struct drm_format_info *info;
 > 268		unsigned int width, height, i;
   269		int ret;
   270	
   271	        /* YUV overlays have special requirements pre-NV50 */
   272		if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA &&
   273	
   274		    (mode_cmd->pixel_format == DRM_FORMAT_YUYV ||
   275		     mode_cmd->pixel_format == DRM_FORMAT_UYVY ||
   276		     mode_cmd->pixel_format == DRM_FORMAT_NV12 ||
   277		     mode_cmd->pixel_format == DRM_FORMAT_NV21) &&
   278		    (mode_cmd->pitches[0] & 0x3f || /* align 64 */
   279		     mode_cmd->pitches[0] >= 0x10000 || /* at most 64k pitch */
   280		     (mode_cmd->pitches[1] && /* pitches for planes must match */
   281		      mode_cmd->pitches[0] != mode_cmd->pitches[1]))) {
   282			struct drm_format_name_buf format_name;
   283			DRM_DEBUG_KMS("Unsuitable framebuffer: format: %s; pitches: 0x%x\n 0x%x\n",
   284				      drm_get_format_name(mode_cmd->pixel_format,
   285							  &format_name),
   286				      mode_cmd->pitches[0],
   287				      mode_cmd->pitches[1]);
   288			return -EINVAL;
   289		}
   290	
   291		info = drm_get_format_info(dev, mode_cmd);
   292	
   293		for (i = 0; i < info->num_planes; i++) {
   294			width = drm_format_info_plane_width(info,
   295							    mode_cmd->width,
   296							    i);
   297			height = drm_format_info_plane_height(info,
   298							      mode_cmd->height,
   299							      i);
   300	
   301			if (nvbo->kind) {
   302				ret = nouveau_check_bl_size(drm, nvbo,
   303							    mode_cmd->offsets[i],
   304							    mode_cmd->pitches[i],
   305							    height, nvbo->mode);
   306				if (ret)
   307					return ret;
   308			} else {
   309				uint32_t size = mode_cmd->pitches[i] * height;
   310	
   311				if (size + mode_cmd->offsets[i] > nvbo->bo.mem.size)
   312					return -ERANGE;
   313			}
   314		}
   315	
   316		if (!(fb = *pfb = kzalloc(sizeof(*fb), GFP_KERNEL)))
   317			return -ENOMEM;
   318	
   319		drm_helper_mode_fill_fb_struct(dev, fb, mode_cmd);
   320		fb->obj[0] = gem;
   321	
   322		ret = drm_framebuffer_init(dev, fb, &nouveau_framebuffer_funcs);
   323		if (ret)
   324			kfree(fb);
   325		return ret;
   326	}
   327	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 62355 bytes --]

             reply	other threads:[~2021-04-27 22:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-27 22:42 kernel test robot [this message]
2021-04-27 22:42 ` drivers/gpu/drm/nouveau/nouveau_display.c:268:15: warning: variable 'width' set but not used kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202104280642.fG6ExtGH-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.