drivers/gpu/drm/nouveau/nouveau_display.c:268:15: warning: variable 'width' set but not used
From: kernel test robot
Date: Tue Apr 27 2021 - 18:43:33 EST
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@xxxxxxxxx>
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@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip