Re: [PATCH v11 5/5] leds: mt6360: Add LED driver for MT6360

From: kernel test robot
Date: Wed Dec 02 2020 - 13:29:17 EST


Hi Gene,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on pavel-linux-leds/for-next]
[also build test WARNING on robh/for-next linus/master v5.10-rc6 next-20201201]
[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/Gene-Chen/leds-mt6360-Add-LED-driver-for-MT6360/20201202-185224
base: git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds.git for-next
config: arm-randconfig-r035-20201202 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 2671fccf0381769276ca8246ec0499adcb9b0355)
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 arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/0day-ci/linux/commit/594faa6d4c2cea720cd53d19375000ab042bb5cb
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Gene-Chen/leds-mt6360-Add-LED-driver-for-MT6360/20201202-185224
git checkout 594faa6d4c2cea720cd53d19375000ab042bb5cb
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm

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/leds/leds-mt6360.c:724:80: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
dev_err(&pdev->dev, "No child node or node count over max led number %lu\n", count);
~~~ ^~~~~
%u
include/linux/dev_printk.h:112:32: note: expanded from macro 'dev_err'
_dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
~~~ ^~~~~~~~~~~
1 warning generated.

vim +724 drivers/leds/leds-mt6360.c

714
715 static int mt6360_led_probe(struct platform_device *pdev)
716 {
717 struct mt6360_priv *priv;
718 struct fwnode_handle *child;
719 size_t count;
720 int i = 0, ret;
721
722 count = device_get_child_node_count(&pdev->dev);
723 if (!count || count > MT6360_MAX_LEDS) {
> 724 dev_err(&pdev->dev, "No child node or node count over max led number %lu\n", count);
725 return -EINVAL;
726 }
727
728 priv = devm_kzalloc(&pdev->dev, struct_size(priv, leds, count), GFP_KERNEL);
729 if (!priv)
730 return -ENOMEM;
731
732 priv->leds_count = count;
733 priv->dev = &pdev->dev;
734 mutex_init(&priv->lock);
735
736 priv->regmap = dev_get_regmap(pdev->dev.parent, NULL);
737 if (!priv->regmap) {
738 dev_err(&pdev->dev, "Failed to get parent regmap\n");
739 return -ENODEV;
740 }
741
742 device_for_each_child_node(&pdev->dev, child) {
743 struct mt6360_led *led = priv->leds + i;
744 struct led_init_data init_data = { .fwnode = child, };
745 u32 reg, led_color;
746
747 ret = fwnode_property_read_u32(child, "color", &led_color);
748 if (ret)
749 goto out_flash_release;
750
751 if (led_color == LED_COLOR_ID_RGB || led_color == LED_COLOR_ID_MULTI)
752 reg = MT6360_VIRTUAL_MULTICOLOR;
753 else {
754 ret = fwnode_property_read_u32(child, "reg", &reg);
755 if (ret)
756 goto out_flash_release;
757
758 if (reg >= MT6360_MAX_LEDS) {
759 ret = -EINVAL;
760 goto out_flash_release;
761 }
762 }
763
764 if (priv->leds_active & BIT(reg)) {
765 ret = -EINVAL;
766 goto out_flash_release;
767 }
768 priv->leds_active |= BIT(reg);
769
770 led->led_no = reg;
771 led->priv = priv;
772
773 ret = mt6360_init_common_properties(led, &init_data);
774 if (ret)
775 goto out_flash_release;
776
777 if (reg == MT6360_VIRTUAL_MULTICOLOR ||
778 (reg >= MT6360_LED_ISNK1 && reg <= MT6360_LED_ISNKML))
779 ret = mt6360_init_isnk_properties(led, &init_data);
780 else
781 ret = mt6360_init_flash_properties(led, &init_data);
782
783 if (ret)
784 goto out_flash_release;
785
786 ret = mt6360_led_register(&pdev->dev, led, &init_data);
787 if (ret)
788 goto out_flash_release;
789
790 i++;
791 }
792
793 platform_set_drvdata(pdev, priv);
794 return 0;
795
796 out_flash_release:
797 mt6360_v4l2_flash_release(priv);
798 return ret;
799 }
800

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

Attachment: .config.gz
Description: application/gzip