Re: [PATCH v9 2/2] drm: add kms driver for loongson display controller

From: Sui Jingfeng
Date: Thu Mar 30 2023 - 02:47:01 EST



On 2023/3/30 14:28, kernel test robot wrote:
Hi Sui,

I love your patch! Perhaps something to improve:

[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on linus/master v6.3-rc4 next-20230329]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Sui-Jingfeng/MAINTAINERS-add-maintainers-for-DRM-LOONGSON-driver/20230329-235338
base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link: https://lore.kernel.org/r/20230329155033.1303550-3-15330273260%40189.cn
patch subject: [PATCH v9 2/2] drm: add kms driver for loongson display controller
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20230330/202303301403.lRjtbd5K-lkp@xxxxxxxxx/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
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
# https://github.com/intel-lab-lkp/linux/commit/ed6a57085a2dc87999193a71c28399a56e29097b
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Sui-Jingfeng/MAINTAINERS-add-maintainers-for-DRM-LOONGSON-driver/20230329-235338
git checkout ed6a57085a2dc87999193a71c28399a56e29097b
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/fpga/ drivers/gpu/drm/loongson/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202303301403.lRjtbd5K-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

drivers/gpu/drm/loongson/lsdc_drv.c:342:11: warning: variable 'ddev' is uninitialized when used here [-Wuninitialized]
drm_err(ddev, "Not known device, the driver need update!\n");
^~~~
include/drm/drm_print.h:469:16: note: expanded from macro 'drm_err'
__drm_printk((drm), err,, "*ERROR* " fmt, ##__VA_ARGS__)
^~~
include/drm/drm_print.h:456:21: note: expanded from macro '__drm_printk'
dev_##level##type((drm)->dev, "[drm] " fmt, ##__VA_ARGS__)
^~~
include/linux/dev_printk.h:144:44: note: expanded from macro 'dev_err'
dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
^~~
include/linux/dev_printk.h:110:11: note: expanded from macro 'dev_printk_index_wrap'
_p_func(dev, fmt, ##__VA_ARGS__); \
^~~
drivers/gpu/drm/loongson/lsdc_drv.c:326:25: note: initialize the variable 'ddev' to silence this warning
struct drm_device *ddev;
^
= NULL
1 warning generated.


vim +/ddev +342 drivers/gpu/drm/loongson/lsdc_drv.c

321
322 static int lsdc_pci_probe(struct pci_dev *pdev,
323 const struct pci_device_id *ent)
324 {
325 const struct lsdc_desc *descp;
326 struct drm_device *ddev;
327 struct lsdc_device *ldev;
328 int ret;
329
330 ret = pcim_enable_device(pdev);
331 if (ret)
332 return ret;
333
334 pci_set_master(pdev);
335
336 ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(40));
337 if (ret)
338 return ret;
339
340 descp = lsdc_detect_chip(pdev, ent);
341 if (IS_ERR_OR_NULL(descp)) {
> 342 drm_err(ddev, "Not known device, the driver need update!\n");
343 return -ENODEV;
344 }
345

Right, i admit this.


I move  lsdc_detect_chip() function out from lsdc_create_device() to here in v9.

Since i think the chip probe should be run as early as possible.

Remove  line 342 `drm_err(ddev, "Not known device, the driver need update!\n");` would solve the problem.

This time robot win.

I will wait one or two day before send next version, ok?

346 dev_info(&pdev->dev, "%s found, revision: %u",
347 chip_to_str(descp->chip), pdev->revision);
348
349 ldev = lsdc_create_device(pdev, descp, &lsdc_drm_driver);
350 if (IS_ERR(ldev))
351 return PTR_ERR(ldev);
352
353 ddev = &ldev->base;
354
355 pci_set_drvdata(pdev, ddev);
356
357 ret = devm_request_irq(&pdev->dev,
358 pdev->irq,
359 lsdc_get_irq_handler(descp),
360 IRQF_SHARED,
361 dev_name(&pdev->dev),
362 ddev);
363 if (ret) {
364 drm_err(ddev, "Failed to register interrupt: %d\n", ret);
365 return ret;
366 }
367
368 ret = drm_dev_register(ddev, 0);
369 if (ret)
370 return ret;
371
372 drm_fbdev_generic_setup(ddev, 32);
373
374 return 0;
375 }
376