[linux-next:master 2799/2998] drivers/leds/leds-max5970.c:48:21: warning: variable 'num_leds' set but not used

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   8c9660f6515396aba78d1168d2e17951d653ebf2
commit: 8171710be2d04fdc263da49212d7b875d3688f58 [2799/2998] leds: max5970: Add support for max5970
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20231124/202311241836.JpSWGIRK-lkp@xxxxxxxxx/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231124/202311241836.JpSWGIRK-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311241836.JpSWGIRK-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/leds/leds-max5970.c:48:21: warning: variable 'num_leds' set but not used [-Wunused-but-set-variable]
           int ret = -ENODEV, num_leds = 0;
                              ^
   1 warning generated.


vim +/num_leds +48 drivers/leds/leds-max5970.c

    40	
    41	static int max5970_led_probe(struct platform_device *pdev)
    42	{
    43		struct device *dev = &pdev->dev;
    44		struct device_node *np = dev_of_node(dev->parent);
    45		struct regmap *regmap;
    46		struct device_node *led_node, *child;
    47		struct max5970_led *ddata;
  > 48		int ret = -ENODEV, num_leds = 0;
    49	
    50		regmap = dev_get_regmap(pdev->dev.parent, NULL);
    51		if (!regmap)
    52			return -ENODEV;
    53	
    54		led_node = of_get_child_by_name(np, "leds");
    55		if (!led_node)
    56			return -ENODEV;
    57	
    58		for_each_available_child_of_node(led_node, child) {
    59			u32 reg;
    60	
    61			if (of_property_read_u32(child, "reg", &reg))
    62				continue;
    63	
    64			if (reg >= MAX5970_NUM_LEDS) {
    65				dev_err(dev, "invalid LED (%u >= %d)\n", reg, MAX5970_NUM_LEDS);
    66				continue;
    67			}
    68	
    69			ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL);
    70			if (!ddata) {
    71				of_node_put(child);
    72				return -ENOMEM;
    73			}
    74	
    75			ddata->index = reg;
    76			ddata->regmap = regmap;
    77			ddata->dev = dev;
    78	
    79			if (of_property_read_string(child, "label", &ddata->cdev.name))
    80				ddata->cdev.name = child->name;
    81	
    82			ddata->cdev.max_brightness = 1;
    83			ddata->cdev.brightness_set_blocking = max5970_led_set_brightness;
    84			ddata->cdev.default_trigger = "none";
    85	
    86			ret = devm_led_classdev_register(dev, &ddata->cdev);
    87			if (ret < 0) {
    88				of_node_put(child);
    89				dev_err(dev, "Failed to initialize LED %u\n", reg);
    90				return ret;
    91			}
    92			num_leds++;
    93		}
    94	
    95		return ret;
    96	}
    97	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux