Skip to contentSkip to conversation

drivers/leds/leds-pca955x.c:562:32: warning: returning 'void *' from a function with return type 'int' makes integer from pointer without a cast

PATCH kernel test robot 1 participant 1 message Nov 5 LED

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/leds.git for-leds-next
head:   a379f4e0adf2de7b11aa3ef87eeb7d9c838069b3
commit: abeb74220fefe28ab68789659f554f49e3b4a51e [18/34] leds: pca955x: Take a reference on the child firmware node
config: sh-randconfig-1000-20261105 (https://download.01.org/0day-ci/archive/20261106/[email protected]/config)
compiler: sh4-linux-gcc (GCC) 12.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261106/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from include/linux/of.h:20,

                    from include/linux/irqdomain.h:14,
                    from include/linux/gpio/driver.h:9,
                    from drivers/leds/leds-pca955x.c:44:
   drivers/leds/leds-pca955x.c: In function 'pca955x_parse_fwnode':
   drivers/leds/leds-pca955x.c:544:44: error: 'client' undeclared (first use in this function)
     544 |         device_for_each_child_node_scoped(&client->dev, child) {
         |                                            ^~~~~~
   include/linux/property.h:202:44: note: in definition of macro 'device_for_each_child_node_scoped'
     202 |                 device_get_next_child_node(dev, NULL);                  \
         |                                            ^~~
   drivers/leds/leds-pca955x.c:544:44: note: each undeclared identifier is reported only once for each function it appears in
     544 |         device_for_each_child_node_scoped(&client->dev, child) {
         |                                            ^~~~~~
   include/linux/property.h:202:44: note: in definition of macro 'device_for_each_child_node_scoped'
     202 |                 device_get_next_child_node(dev, NULL);                  \
         |                                            ^~~
>> drivers/leds/leds-pca955x.c:562:32: warning: returning 'void *' from a function with return type 'int' makes integer from pointer without a cast [-Wint-conversion]
     562 |                         return ERR_PTR(res);
         |                                ^~~~~~~~~~~~

vim +562 drivers/leds/leds-pca955x.c

532
533 static int pca955x_parse_fwnode(struct pca955x *pca955x)
534 {
535 struct device *dev = &pca955x->client->dev;
536 u8 bits = pca955x->chipdef->bits;
537 struct pca955x_led *led;
538 int count;
539
540 count = device_get_child_node_count(dev);
541 if (count > bits)
542 return -ENODEV;
543
544 device_for_each_child_node_scoped(&client->dev, child) {
545 u32 reg;
546 int res;
547
548 res = fwnode_property_read_u32(child, "reg", &reg);
549 if ((res != 0) || (reg >= bits))
550 continue;
551
552 led = &pca955x->leds[reg];
553 if (led->fwnode)
554 devm_release_action(&client->dev, pca955x_fwnode_put,
555 led->fwnode);
556 led->type = PCA955X_TYPE_LED;
557 led->fwnode = fwnode_handle_get(child);
558
559 res = devm_add_action_or_reset(&client->dev,
560 pca955x_fwnode_put, led->fwnode);
561 if (res)

 > 562				return ERR_PTR(res);

563
564 led->default_state = led_init_default_state_get(child);
565
566 fwnode_property_read_u32(child, "type", &led->type);
567 }
568
569 return 0;
570 }
571

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