[PATCH v12 5/5] leds: mt6360: Add LED driver for MT6360
kernel test robot
lkp at intel.com
Wed Dec 16 00:52:36 EST 2020
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 next-20201215]
[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/20201210-140617
base: git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds.git for-next
config: x86_64-randconfig-m001-20201215 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>
smatch warnings:
drivers/leds/leds-mt6360.c:778 mt6360_led_probe() warn: always true condition '(reg >= 0) => (0-u32max >= 0)'
vim +778 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", ®);
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@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 38512 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-mediatek/attachments/20201216/e5e09230/attachment-0001.gz>
More information about the Linux-mediatek
mailing list