On Tue, Mar 18, 2025 at 05:51:25PM +0200, Andy Shevchenko wrote: > GCC compiler complains about snprintf() calls that may potentially cut > the output: > > drivers/leds/led-core.c:551:78: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=] > drivers/leds/led-core.c:554:78: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=] > ... > > Fix these by checking for the potential overflow. This requires > to align all the branches to use the same callee, i.e. snprintf(), > otherwise the code will be blown up and return different error codes > for the different branches. ... > - strscpy(led_classdev_name, to_of_node(fwnode)->name, > - LED_MAX_NAME_SIZE); > + n = snprintf(led_classdev_name, LED_MAX_NAME_SIZE, "%pfw", fwnode); Actually this is not an equivalent, should still have that ugly to_of_node()->name... I'll fix it in v2. -- With Best Regards, Andy Shevchenko