Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* Re: [PATCH leds v4 02/12] leds: turris-omnia: Use command execution functions from the MCU driver
       [not found] <20241029135621.12546-3-kabel@kernel.org>
@ 2024-10-31  9:01 ` kernel test robot
  2024-11-01  9:06   ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2024-10-31  9:01 UTC (permalink / raw)
  To: Marek Behún, Lee Jones
  Cc: llvm, oe-kbuild-all, Pavel Machek, linux-leds, Arnd Bergmann, soc,
	Gregory CLEMENT, arm, Andy Shevchenko, Hans de Goede,
	Ilpo Järvinen, Andrew Lunn, Sebastian Hesselbarth,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, devicetree,
	Marek Behún

Hi Marek,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.12-rc5]
[cannot apply to lee-leds/for-leds-next robh/for-next next-20241030]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Marek-Beh-n/turris-omnia-mcu-interface-h-Move-command-execution-function-to-global-header/20241029-215858
base:   linus/master
patch link:    https://lore.kernel.org/r/20241029135621.12546-3-kabel%40kernel.org
patch subject: [PATCH leds v4 02/12] leds: turris-omnia: Use command execution functions from the MCU driver
config: riscv-allmodconfig (https://download.01.org/0day-ci/archive/20241031/202410311612.0OkxKVgC-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 639a7ac648f1e50ccd2556e17d401c04f9cce625)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241031/202410311612.0OkxKVgC-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410311612.0OkxKVgC-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from drivers/leds/leds-turris-omnia.c:8:
   In file included from include/linux/i2c.h:19:
   In file included from include/linux/regulator/consumer.h:35:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:13:
   In file included from include/linux/cgroup.h:26:
   In file included from include/linux/kernel_stat.h:8:
   In file included from include/linux/interrupt.h:22:
   In file included from arch/riscv/include/asm/sections.h:9:
   In file included from include/linux/mm.h:2213:
   include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     504 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     505 |                            item];
         |                            ~~~~
   include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     511 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     512 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     524 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     525 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
>> drivers/leds/leds-turris-omnia.c:409:12: warning: stack frame size (2064) exceeds limit (2048) in 'omnia_leds_probe' [-Wframe-larger-than]
     409 | static int omnia_leds_probe(struct i2c_client *client)
         |            ^
   5 warnings generated.


vim +/omnia_leds_probe +409 drivers/leds/leds-turris-omnia.c

43e9082fbccc7d Marek Behún         2023-09-18  408  
4934630409cb60 Uwe Kleine-König    2022-11-18 @409  static int omnia_leds_probe(struct i2c_client *client)
089381b27abe28 Marek Behún         2020-07-23  410  {
089381b27abe28 Marek Behún         2020-07-23  411  	struct device *dev = &client->dev;
122d57e2960c81 Krzysztof Kozlowski 2024-08-16  412  	struct device_node *np = dev_of_node(dev);
089381b27abe28 Marek Behún         2020-07-23  413  	struct omnia_leds *leds;
089381b27abe28 Marek Behún         2020-07-23  414  	struct omnia_led *led;
089381b27abe28 Marek Behún         2020-07-23  415  	int ret, count;
089381b27abe28 Marek Behún         2020-07-23  416  
089381b27abe28 Marek Behún         2020-07-23  417  	count = of_get_available_child_count(np);
089381b27abe28 Marek Behún         2020-07-23  418  	if (!count) {
089381b27abe28 Marek Behún         2020-07-23  419  		dev_err(dev, "LEDs are not defined in device tree!\n");
089381b27abe28 Marek Behún         2020-07-23  420  		return -ENODEV;
089381b27abe28 Marek Behún         2020-07-23  421  	} else if (count > OMNIA_BOARD_LEDS) {
089381b27abe28 Marek Behún         2020-07-23  422  		dev_err(dev, "Too many LEDs defined in device tree!\n");
089381b27abe28 Marek Behún         2020-07-23  423  		return -EINVAL;
089381b27abe28 Marek Behún         2020-07-23  424  	}
089381b27abe28 Marek Behún         2020-07-23  425  
089381b27abe28 Marek Behún         2020-07-23  426  	leds = devm_kzalloc(dev, struct_size(leds, leds, count), GFP_KERNEL);
089381b27abe28 Marek Behún         2020-07-23  427  	if (!leds)
089381b27abe28 Marek Behún         2020-07-23  428  		return -ENOMEM;
089381b27abe28 Marek Behún         2020-07-23  429  
089381b27abe28 Marek Behún         2020-07-23  430  	leds->client = client;
089381b27abe28 Marek Behún         2020-07-23  431  	i2c_set_clientdata(client, leds);
089381b27abe28 Marek Behún         2020-07-23  432  
43e9082fbccc7d Marek Behún         2023-09-18  433  	ret = omnia_mcu_get_features(client);
43e9082fbccc7d Marek Behún         2023-09-18  434  	if (ret < 0) {
43e9082fbccc7d Marek Behún         2023-09-18  435  		dev_err(dev, "Cannot determine MCU supported features: %d\n",
43e9082fbccc7d Marek Behún         2023-09-18  436  			ret);
43e9082fbccc7d Marek Behún         2023-09-18  437  		return ret;
43e9082fbccc7d Marek Behún         2023-09-18  438  	}
43e9082fbccc7d Marek Behún         2023-09-18  439  
43e9082fbccc7d Marek Behún         2023-09-18  440  	leds->has_gamma_correction = ret & FEAT_LED_GAMMA_CORRECTION;
43e9082fbccc7d Marek Behún         2023-09-18  441  	if (!leds->has_gamma_correction) {
43e9082fbccc7d Marek Behún         2023-09-18  442  		dev_info(dev,
43e9082fbccc7d Marek Behún         2023-09-18  443  			 "Your board's MCU firmware does not support the LED gamma correction feature.\n");
43e9082fbccc7d Marek Behún         2023-09-18  444  		dev_info(dev,
43e9082fbccc7d Marek Behún         2023-09-18  445  			 "Consider upgrading MCU firmware with the omnia-mcutool utility.\n");
43e9082fbccc7d Marek Behún         2023-09-18  446  	}
43e9082fbccc7d Marek Behún         2023-09-18  447  
089381b27abe28 Marek Behún         2020-07-23  448  	mutex_init(&leds->lock);
089381b27abe28 Marek Behún         2020-07-23  449  
cbd6954fecbeb8 Marek Behún         2023-09-18  450  	ret = devm_led_trigger_register(dev, &omnia_hw_trigger);
cbd6954fecbeb8 Marek Behún         2023-09-18  451  	if (ret < 0) {
cbd6954fecbeb8 Marek Behún         2023-09-18  452  		dev_err(dev, "Cannot register private LED trigger: %d\n", ret);
cbd6954fecbeb8 Marek Behún         2023-09-18  453  		return ret;
cbd6954fecbeb8 Marek Behún         2023-09-18  454  	}
cbd6954fecbeb8 Marek Behún         2023-09-18  455  
089381b27abe28 Marek Behún         2020-07-23  456  	led = &leds->leds[0];
122d57e2960c81 Krzysztof Kozlowski 2024-08-16  457  	for_each_available_child_of_node_scoped(np, child) {
089381b27abe28 Marek Behún         2020-07-23  458  		ret = omnia_led_register(client, led, child);
122d57e2960c81 Krzysztof Kozlowski 2024-08-16  459  		if (ret < 0)
089381b27abe28 Marek Behún         2020-07-23  460  			return ret;
089381b27abe28 Marek Behún         2020-07-23  461  
089381b27abe28 Marek Behún         2020-07-23  462  		led += ret;
089381b27abe28 Marek Behún         2020-07-23  463  	}
089381b27abe28 Marek Behún         2020-07-23  464  
089381b27abe28 Marek Behún         2020-07-23  465  	return 0;
089381b27abe28 Marek Behún         2020-07-23  466  }
089381b27abe28 Marek Behún         2020-07-23  467  

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH leds v4 02/12] leds: turris-omnia: Use command execution functions from the MCU driver
  2024-10-31  9:01 ` [PATCH leds v4 02/12] leds: turris-omnia: Use command execution functions from the MCU driver kernel test robot
@ 2024-11-01  9:06   ` Arnd Bergmann
  2024-11-01 11:06     ` Marek Behún
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2024-11-01  9:06 UTC (permalink / raw)
  To: kernel test robot, Marek Behún, Lee Jones
  Cc: llvm, oe-kbuild-all, Pavel Machek, linux-leds, soc,
	Gregory Clement, arm, Andy Shevchenko, Hans de Goede,
	Ilpo Järvinen, Andrew Lunn, Sebastian Hesselbarth,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, devicetree

On Thu, Oct 31, 2024, at 10:01, kernel test robot wrote:
>
> kernel test robot noticed the following build warnings:

>>> drivers/leds/leds-turris-omnia.c:409:12: warning: stack frame size (2064) exceeds limit (2048) in 'omnia_leds_probe' [-Wframe-larger-than]
>      409 | static int omnia_leds_probe(struct i2c_client *client)
>          |            ^

The problem here is the i2c_client on the stack, you can't
do that:

 static int omnia_mcu_get_features(const struct i2c_client *client)
 {
+	struct i2c_client mcu_client = *client;
 	u16 reply;

I haven't looked at this in detail, but there is usually a
trivial alternative.

     Arnd

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH leds v4 02/12] leds: turris-omnia: Use command execution functions from the MCU driver
  2024-11-01  9:06   ` Arnd Bergmann
@ 2024-11-01 11:06     ` Marek Behún
  0 siblings, 0 replies; 3+ messages in thread
From: Marek Behún @ 2024-11-01 11:06 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: kernel test robot, Marek Behún, Lee Jones, llvm,
	oe-kbuild-all, Pavel Machek, linux-leds, soc, Gregory Clement,
	arm, Andy Shevchenko, Hans de Goede, Ilpo Järvinen,
	Andrew Lunn, Sebastian Hesselbarth, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, devicetree

On Fri, Nov 01, 2024 at 10:06:40AM +0100, Arnd Bergmann wrote:
> On Thu, Oct 31, 2024, at 10:01, kernel test robot wrote:
> >
> > kernel test robot noticed the following build warnings:
> 
> >>> drivers/leds/leds-turris-omnia.c:409:12: warning: stack frame size (2064) exceeds limit (2048) in 'omnia_leds_probe' [-Wframe-larger-than]
> >      409 | static int omnia_leds_probe(struct i2c_client *client)
> >          |            ^
> 
> The problem here is the i2c_client on the stack, you can't
> do that:
> 
>  static int omnia_mcu_get_features(const struct i2c_client *client)
>  {
> +	struct i2c_client mcu_client = *client;
>  	u16 reply;

OMG, I see. struct i2c_client contains struct device.
OK, I will do this correctly by finding the MCU device on the I2C bus.

Marek

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-11-01 11:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20241029135621.12546-3-kabel@kernel.org>
2024-10-31  9:01 ` [PATCH leds v4 02/12] leds: turris-omnia: Use command execution functions from the MCU driver kernel test robot
2024-11-01  9:06   ` Arnd Bergmann
2024-11-01 11:06     ` Marek Behún

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox