tree:
git://git.kernel.org/pub/scm/linux/kernel/git/lkundrak/linux-mmp.git lr/gud2
head: 84d9081acc7185e369834b2b0808d197d7a79d2c
commit: 88fd2c63d9552fa82e7e300a3be86d503b159311 [5/7] drm: Add Generic USB Display
driver
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 9.3.0
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
git checkout 88fd2c63d9552fa82e7e300a3be86d503b159311
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
drivers/gpu/drm/gud/gud_drm_drv.c: In function
'gud_drm_free_buffers_and_mutex':
> drivers/gpu/drm/gud/gud_drm_drv.c:377:2: error: implicit
declaration of function 'vfree'; did you mean 'kfree'?
[-Werror=implicit-function-declaration]
377 | vfree(gdrm->compress_buf);
| ^~~~~
| kfree
drivers/gpu/drm/gud/gud_drm_drv.c: In function 'gud_drm_probe':
> drivers/gpu/drm/gud/gud_drm_drv.c:489:24: error: implicit
declaration of function 'vmalloc'; did you mean 'kmalloc'?
[-Werror=implicit-function-declaration]
489 | gdrm->compress_buf =
vmalloc(gdrm->bulk_len);
| ^~~~~~~
| kmalloc
drivers/gpu/drm/gud/gud_drm_drv.c:489:22: warning: assignment to 'void *' from
'int' makes pointer from integer without a cast [-Wint-conversion]
489 | gdrm->compress_buf = vmalloc(gdrm->bulk_len);
| ^
cc1: some warnings being treated as errors
vim +377 drivers/gpu/drm/gud/gud_drm_drv.c
369
370 static void gud_drm_free_buffers_and_mutex(void *data)
371 {
372 struct gud_drm_device *gdrm = data;
373
374 /* Access to these are protected by drm_dev_enter/exit */
375
376 kfree(gdrm->properties);
377 vfree(gdrm->compress_buf);
378 kfree(gdrm->bulk_buf);
379 kfree(gdrm->ctrl_msg_buf);
380 gdrm->properties = NULL;
381 gdrm->compress_buf = NULL;
382 gdrm->bulk_buf = NULL;
383 gdrm->ctrl_msg_buf = NULL;
384
385 mutex_destroy(&gdrm->ctrl_lock);
386 mutex_destroy(&gdrm->damage_lock);
387 }
388
389 static int gud_drm_probe(struct usb_interface *interface,
390 const struct usb_device_id *id)
391 {
392 u8 ifnum = interface->cur_altsetting->desc.bInterfaceNumber;
393 struct usb_device *usb = interface_to_usbdev(interface);
394 struct device *dev = &interface->dev;
395 const struct drm_format_info *xrgb8888_emulation_format = NULL;
396 u32 *formats, *formats_dev, num_connectors, num_formats = 0;
397 bool rgb565_supported = false, rgb8888_supported = false;
398 struct usb_endpoint_descriptor *bulk_out;
399 struct gud_drm_display_descriptor desc;
400 struct gud_drm_device *gdrm;
401 struct drm_device *drm;
402 size_t max_buffer_size;
403 int ret, i;
404
405 ret = usb_find_bulk_out_endpoint(interface->cur_altsetting, &bulk_out);
406 if (ret)
407 return ret;
408
409 ret = gud_get_vendor_descriptor(interface, &desc);
410 if (ret) {
411 DRM_DEV_DEBUG_DRIVER(dev, "Not a display interface: ret=%d\n", ret);
412 return -ENODEV;
413 }
414
415 if (desc.bVersion > 1) {
416 u8 *version = kmalloc(sizeof(*version), GFP_KERNEL);
417
418 if (!version)
419 return -ENOMEM;
420
421 /* Check if the device can support us */
422 *version = 1;
423 ret = gud_drm_usb_control_msg(usb, ifnum, false, GUD_DRM_USB_REQ_SET_VERSION,
424 0, version, sizeof(*version), true);
425 if (!ret)
426 ret = gud_usb_get_status(usb, ifnum);
427 kfree(version);
428 if (ret) {
429 dev_err(dev, "Protocol version %u is not supported\n",
desc.bVersion);
430 return -EPROTONOSUPPORT;
431 }
432
433 desc.bVersion = 1;
434 }
435
436 num_connectors = desc.bNumConnectors;
437 max_buffer_size = 1 << desc.bMaxBufferSizeOrder;
438
439 gdrm = devm_drm_dev_alloc(dev, &gud_drm_driver, struct gud_drm_device, drm);
440 if (IS_ERR(gdrm))
441 return PTR_ERR(gdrm);
442
443 drm = &gdrm->drm;
444 drm->mode_config.funcs = &gud_drm_mode_config_funcs;
445 ret = drmm_mode_config_init(drm);
446 if (ret)
447 return ret;
448
449 gdrm->usb = usb;
450 gdrm->ifnum = ifnum;
451 gdrm->compression = desc.bCompression & GUD_DRM_COMPRESSION_LZ4;
452
453 mutex_init(&gdrm->ctrl_lock);
454 mutex_init(&gdrm->damage_lock);
455 INIT_WORK(&gdrm->work, gud_drm_work);
456 gud_drm_clear_damage(gdrm);
457
458 /*
459 * devm_kmalloc() places struct devres at the beginning of the buffer it
460 * allocates. This can waste a lot of memory when allocating
461 * power-of-two sized buffers. Asking for 4k would actually allocate 8k.
462 */
463
464 ret = devm_add_action_or_reset(dev, gud_drm_free_buffers_and_mutex, gdrm);
465 if (ret)
466 return ret;
467
468 gdrm->ctrl_msg_buf = kmalloc(GUD_DRM_MAX_TRANSFER_SIZE, GFP_KERNEL);
469 if (!gdrm->ctrl_msg_buf)
470 return -ENOMEM;
471 retry:
472 gdrm->bulk_buf = kmalloc(max_buffer_size, GFP_KERNEL);
473 if (!gdrm->bulk_buf) {
474 max_buffer_size /= 2;
475 if (max_buffer_size < SZ_2M) { /* Give up if we can't do 1024x768 RGB565
*/
476 return -ENOMEM;
477 }
478 goto retry;
479 }
480
481 gdrm->bulk_pipe = usb_sndbulkpipe(gdrm->usb, usb_endpoint_num(bulk_out));
482 gdrm->bulk_len = max_buffer_size;
483
484 if (gdrm->compression & GUD_DRM_COMPRESSION_LZ4) {
485 gdrm->lz4_comp_mem = devm_kmalloc(dev, LZ4_MEM_COMPRESS, GFP_KERNEL);
486 if (!gdrm->lz4_comp_mem)
487 return -ENOMEM;
488
489 gdrm->compress_buf = vmalloc(gdrm->bulk_len);
490 if (!gdrm->compress_buf)
491 return -ENOMEM;
492 }
493
494 drm->mode_config.min_width = le32_to_cpu(desc.dwMinWidth);
495 drm->mode_config.max_width = le32_to_cpu(desc.dwMaxWidth);
496 drm->mode_config.min_height = le32_to_cpu(desc.dwMinHeight);
497 drm->mode_config.max_height = le32_to_cpu(desc.dwMaxHeight);
498
499 formats_dev = devm_kmalloc_array(dev, desc.bNumFormats, sizeof(u32), GFP_KERNEL);
500 /* Add room for emulated XRGB8888 */
501 formats = devm_kmalloc_array(dev, desc.bNumFormats + 1, sizeof(u32), GFP_KERNEL);
502 if (!formats_dev || !formats)
503 return -ENOMEM;
504
505 ret = gud_drm_usb_read32(gdrm, GUD_DRM_USB_REQ_GET_FORMATS, formats_dev,
desc.bNumFormats);
506 if (ret)
507 return ret;
508
509 for (i = 0; i < desc.bNumFormats; i++) {
510 const struct drm_format_info *fmt_info;
511 u32 format = formats_dev[i];
512
513 if (format == GUD_DRM_FORMAT_R1) {
514 fmt_info = &gud_drm_format_r1;
515 } else {
516 /* This will trigger a WARN for unknown formats... */
517 fmt_info = drm_format_info(format);
518 if (!fmt_info) {
519 drm_dbg(drm, "Unknown format: 0x%x\n", format);
520 continue;
521 }
522 }
523
524 switch (format) {
525 case DRM_FORMAT_XRGB8888:
526 fallthrough;
527 case DRM_FORMAT_ARGB8888:
528 rgb8888_supported = true;
529 break;
530 case DRM_FORMAT_RGB888:
531 fallthrough;
532 case DRM_FORMAT_BGR888:
533 drm_dbg(drm, "24-bit formats are not supported.\n");
534 continue;
535 case DRM_FORMAT_RGB565:
536 rgb565_supported = true;
537 if (!xrgb8888_emulation_format)
538 xrgb8888_emulation_format = fmt_info;
539 break;
540 case GUD_DRM_FORMAT_R1:
541 if (!xrgb8888_emulation_format)
542 xrgb8888_emulation_format = fmt_info;
543 /* Internal, not for userspace */
544 continue;
545 }
546
547 formats[num_formats++] = format;
548 }
549
550 if (!num_formats && !xrgb8888_emulation_format) {
551 dev_err(dev, "No supported formats found\n");
552 return -ENOENT;
553 }
554
555 /* Prefer speed over color depth */
556 if (rgb565_supported)
557 drm->mode_config.preferred_depth = 16;
558
559 if (!rgb8888_supported && xrgb8888_emulation_format) {
560 gdrm->xrgb8888_emulation_format = xrgb8888_emulation_format;
561 formats[num_formats++] = DRM_FORMAT_XRGB8888;
562 }
563
564 ret = drm_simple_display_pipe_init(drm, &gdrm->pipe,
&gud_drm_pipe_funcs,
565 formats, num_formats,
566 gud_drm_pipe_modifiers, NULL);
567 if (ret)
568 return ret;
569
570 devm_kfree(dev, formats);
571 devm_kfree(dev, formats_dev);
572
573 ret = gud_drm_get_properties(gdrm, desc.bNumProperties);
574 if (ret)
575 return ret;
576
577 drm_plane_enable_fb_damage_clips(&gdrm->pipe.plane);
578
579 for (i = 0; i < num_connectors; i++) {
580 ret = gud_drm_connector_create(gdrm, i);
581 if (ret)
582 return ret;
583 }
584
585 drm_mode_config_reset(drm);
586
587 usb_set_intfdata(interface, gdrm);
588
589 ret = drm_dev_register(drm, 0);
590 if (ret)
591 return ret;
592
593 drm_kms_helper_poll_init(drm);
594
595 drm_fbdev_generic_setup(drm, 0);
596
597 return 0;
598 }
599
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org