Instead of calling `snprintf()`, generate the method name in the initializer. This way the array size is determined automatically, specifying it explicitly is no longer needed. Signed-off-by: Barnabás Pőcze <pobrn@xxxxxxxxxxxxxx> --- drivers/platform/x86/wmi.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index e6997be206f1..1cde9dd417c4 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -184,15 +184,17 @@ static int get_subobj_info(acpi_handle handle, const char *pathname, static acpi_status wmi_method_enable(struct wmi_block *wblock, bool enable) { - struct guid_block *block; - char method[5]; + acpi_handle handle = wblock->acpi_device->handle; + struct guid_block *block = &wblock->gblock; acpi_status status; - acpi_handle handle; - - block = &wblock->gblock; - handle = wblock->acpi_device->handle; + char method[] = { + 'W', + 'E', + hex_asc_upper_hi(block->notify_id), + hex_asc_upper_lo(block->notify_id), + '\0' + }; - snprintf(method, 5, "WE%02X", block->notify_id); status = acpi_execute_simple_method(handle, method, enable); if (status == AE_NOT_FOUND) return AE_OK; -- 2.33.0