lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20201124011914.GY3723@shao2-debian>
Date:   Tue, 24 Nov 2020 09:19:14 +0800
From:   kernel test robot <rong.a.chen@...el.com>
To:     Dan Murphy <dmurphy@...com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Pavel Machek <pavel@....cz>
Subject: drivers/leds/leds-lp55xx-common.c:204:4: warning: Variable 'j' is
 modified but its new value is never used.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   418baf2c28f3473039f2f7377760bd8f6897ae18
commit: 92a81562e695628086acb92f95090ab09d9b9ec0 leds: lp55xx: Add multicolor framework support to lp55xx
compiler: c6x-elf-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <rong.a.chen@...el.com>


cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> drivers/leds/leds-lp55xx-common.c:204:4: warning: Variable 'j' is modified but its new value is never used. [unreadVariable]
      j++;
      ^

vim +/j +204 drivers/leds/leds-lp55xx-common.c

0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  158) 
9e9b3db1b2f725b Milo(Woogyom  Kim 2013-02-05  159) static int lp55xx_init_led(struct lp55xx_led *led,
9e9b3db1b2f725b Milo(Woogyom  Kim 2013-02-05  160) 			struct lp55xx_chip *chip, int chan)
9e9b3db1b2f725b Milo(Woogyom  Kim 2013-02-05  161) {
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  162) 	struct lp55xx_platform_data *pdata = chip->pdata;
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  163) 	struct lp55xx_device_config *cfg = chip->cfg;
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  164) 	struct device *dev = &chip->cl->dev;
92a81562e695628 Dan Murphy        2020-07-16  165  	int max_channel = cfg->max_channel;
92a81562e695628 Dan Murphy        2020-07-16  166  	struct mc_subled *mc_led_info;
92a81562e695628 Dan Murphy        2020-07-16  167  	struct led_classdev *led_cdev;
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  168) 	char name[32];
92a81562e695628 Dan Murphy        2020-07-16  169  	int i, j = 0;
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  170) 	int ret;
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  171) 
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  172) 	if (chan >= max_channel) {
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  173) 		dev_err(dev, "invalid channel: %d / %d\n", chan, max_channel);
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  174) 		return -EINVAL;
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  175) 	}
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  176) 
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  177) 	if (pdata->led_config[chan].led_current == 0)
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  178) 		return 0;
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  179) 
92a81562e695628 Dan Murphy        2020-07-16  180  	if (pdata->led_config[chan].name) {
92a81562e695628 Dan Murphy        2020-07-16  181  		led->cdev.name = pdata->led_config[chan].name;
92a81562e695628 Dan Murphy        2020-07-16  182  	} else {
92a81562e695628 Dan Murphy        2020-07-16  183  		snprintf(name, sizeof(name), "%s:channel%d",
92a81562e695628 Dan Murphy        2020-07-16  184  			pdata->label ? : chip->cl->name, chan);
92a81562e695628 Dan Murphy        2020-07-16  185  		led->cdev.name = name;
92a81562e695628 Dan Murphy        2020-07-16  186  	}
92a81562e695628 Dan Murphy        2020-07-16  187  
92a81562e695628 Dan Murphy        2020-07-16  188  	if (pdata->led_config[chan].num_colors > 1) {
92a81562e695628 Dan Murphy        2020-07-16  189  		mc_led_info = devm_kcalloc(dev,
92a81562e695628 Dan Murphy        2020-07-16  190  					   pdata->led_config[chan].num_colors,
92a81562e695628 Dan Murphy        2020-07-16  191  					   sizeof(*mc_led_info), GFP_KERNEL);
92a81562e695628 Dan Murphy        2020-07-16  192  		if (!mc_led_info)
92a81562e695628 Dan Murphy        2020-07-16  193  			return -ENOMEM;
92a81562e695628 Dan Murphy        2020-07-16  194  
92a81562e695628 Dan Murphy        2020-07-16  195  		led_cdev = &led->mc_cdev.led_cdev;
92a81562e695628 Dan Murphy        2020-07-16  196  		led_cdev->name = led->cdev.name;
92a81562e695628 Dan Murphy        2020-07-16  197  		led_cdev->brightness_set_blocking = lp55xx_set_mc_brightness;
92a81562e695628 Dan Murphy        2020-07-16  198  		led->mc_cdev.num_colors = pdata->led_config[chan].num_colors;
92a81562e695628 Dan Murphy        2020-07-16  199  		for (i = 0; i < led->mc_cdev.num_colors; i++) {
92a81562e695628 Dan Murphy        2020-07-16  200  			mc_led_info[i].color_index =
92a81562e695628 Dan Murphy        2020-07-16  201  				pdata->led_config[chan].color_id[i];
92a81562e695628 Dan Murphy        2020-07-16  202  			mc_led_info[i].channel =
92a81562e695628 Dan Murphy        2020-07-16  203  					pdata->led_config[chan].output_num[i];
92a81562e695628 Dan Murphy        2020-07-16 @204  			j++;
92a81562e695628 Dan Murphy        2020-07-16  205  		}
92a81562e695628 Dan Murphy        2020-07-16  206  
92a81562e695628 Dan Murphy        2020-07-16  207  		led->mc_cdev.subled_info = mc_led_info;
92a81562e695628 Dan Murphy        2020-07-16  208  	} else {
92a81562e695628 Dan Murphy        2020-07-16  209  		led->cdev.brightness_set_blocking = lp55xx_set_brightness;
92a81562e695628 Dan Murphy        2020-07-16  210  	}
92a81562e695628 Dan Murphy        2020-07-16  211  
92a81562e695628 Dan Murphy        2020-07-16  212  	led->cdev.groups = lp55xx_led_groups;
92a81562e695628 Dan Murphy        2020-07-16  213  	led->cdev.default_trigger = pdata->led_config[chan].default_trigger;
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  214) 	led->led_current = pdata->led_config[chan].led_current;
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  215) 	led->max_current = pdata->led_config[chan].max_current;
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  216) 	led->chan_nr = pdata->led_config[chan].chan_nr;
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  217) 
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  218) 	if (led->chan_nr >= max_channel) {
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  219) 		dev_err(dev, "Use channel numbers between 0 and %d\n",
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  220) 			max_channel - 1);
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  221) 		return -EINVAL;
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  222) 	}
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  223) 
92a81562e695628 Dan Murphy        2020-07-16  224  	if (pdata->led_config[chan].num_colors > 1)
92a81562e695628 Dan Murphy        2020-07-16  225  		ret = devm_led_classdev_multicolor_register(dev, &led->mc_cdev);
92a81562e695628 Dan Murphy        2020-07-16  226  	else
c732eaf01f9c213 Dan Murphy        2020-07-16  227  		ret = devm_led_classdev_register(dev, &led->cdev);
92a81562e695628 Dan Murphy        2020-07-16  228  
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  229) 	if (ret) {
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  230) 		dev_err(dev, "led register err: %d\n", ret);
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  231) 		return ret;
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  232) 	}
0e2023463a3c941 Milo(Woogyom  Kim 2013-02-05  233) 
9e9b3db1b2f725b Milo(Woogyom  Kim 2013-02-05  234) 	return 0;
9e9b3db1b2f725b Milo(Woogyom  Kim 2013-02-05  235) }
9e9b3db1b2f725b Milo(Woogyom  Kim 2013-02-05  236) 

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ