Skip to contentSkip to conversation

ACPI: GED: fix -Wformat

PATCH Superseded Nick Desaulniers 3 participants 4 messages Nov 7, 2020 – Nov 9, 2020 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI: GED: fix -Wformat

Clang is more aggressive about -Wformat warnings when the format flag specifies a type smaller than the parameter. It turns out that gsi is an int. Fixes:

drivers/acpi/evged.c:105:48: warning: format specifies type 'unsigned char' but the argument has type 'unsigned int' [-Wformat]

trigger == ACPI_EDGE_SENSITIVE ? 'E' : 'L', gsi);
                                            ^~~
Fixes commit ea6f3af4c5e6 ("ACPI: GED: add support for _Exx / _Lxx handler methods")
---
 drivers/acpi/evged.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/evged.c +1 -1
index b1a7f8d6965e..fe6b6792c8bb 100644
@@ -101,7 +101,7 @@ static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares,
 
 	switch (gsi) {
 	case 0 ... 255:
-		sprintf(ev_name, "_%c%02hhX",
+		sprintf(ev_name, "_%c%02X",
 			trigger == ACPI_EDGE_SENSITIVE ? 'E' : 'L', gsi);
 
 		if (ACPI_SUCCESS(acpi_get_handle(handle, ev_name, &evt_handle)))
Signature · 1 line
2.29.2.222.g5d2a92d10f8-goog
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Nick Desaulniers

Clang is more aggressive about -Wformat warnings when the format flag specifies a type smaller than the parameter. It turns out that gsi is an int. Fixes:

Quoted 7 lines

drivers/acpi/evged.c:105:48: warning: format specifies type 'unsigned char' but the argument has type 'unsigned int' [-Wformat]

trigger == ACPI_EDGE_SENSITIVE ? 'E' : 'L', gsi);
                                            ^~~
Fixes commit ea6f3af4c5e6 ("ACPI: GED: add support for _Exx / _Lxx handler methods")

Please drop the word 'commit' here

Quoted 1 line
Quoted 20 lines
---
 drivers/acpi/evged.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/evged.c +1 -2
index b1a7f8d6965e..fe6b6792c8bb 100644
@@ -101,7 +101,7 @@ static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares,
 
        switch (gsi) {
        case 0 ... 255:
-               sprintf(ev_name, "_%c%02hhX",
+               sprintf(ev_name, "_%c%02X",
                        trigger == ACPI_EDGE_SENSITIVE ? 'E' : 'L', gsi);
 
                if (ACPI_SUCCESS(acpi_get_handle(handle, ev_name, &evt_handle)))
--

2.29.2.222.g5d2a92d10f8-goog

#2 lore raw

PATCH v2 1/1 ACPI: GED: fix -Wformat

Clang is more aggressive about -Wformat warnings when the format flag specifies a type smaller than the parameter. It turns out that gsi is an int. Fixes:

drivers/acpi/evged.c:105:48: warning: format specifies type 'unsigned char' but the argument has type 'unsigned int' [-Wformat]

trigger == ACPI_EDGE_SENSITIVE ? 'E' : 'L', gsi);
                                            ^~~
Fixes ea6f3af4c5e6 ("ACPI: GED: add support for _Exx / _Lxx handler methods")
---
 drivers/acpi/evged.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/evged.c +1 -1
index b1a7f8d6965e..fe6b6792c8bb 100644
@@ -101,7 +101,7 @@ static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares,
 
 	switch (gsi) {
 	case 0 ... 255:
-		sprintf(ev_name, "_%c%02hhX",
+		sprintf(ev_name, "_%c%02X",
 			trigger == ACPI_EDGE_SENSITIVE ? 'E' : 'L', gsi);
 
 		if (ACPI_SUCCESS(acpi_get_handle(handle, ev_name, &evt_handle)))
Signature · 1 line
2.29.2.222.g5d2a92d10f8-goog
maintainer Applied
#3 lore raw
Quoted 23 lines · Nick Desaulniers

Clang is more aggressive about -Wformat warnings when the format flag specifies a type smaller than the parameter. It turns out that gsi is an int. Fixes:

drivers/acpi/evged.c:105:48: warning: format specifies type 'unsigned char' but the argument has type 'unsigned int' [-Wformat]

trigger == ACPI_EDGE_SENSITIVE ? 'E' : 'L', gsi);
                                            ^~~
Fixes ea6f3af4c5e6 ("ACPI: GED: add support for _Exx / _Lxx handler methods")
---
 drivers/acpi/evged.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/evged.c +0 -0
index b1a7f8d6965e..fe6b6792c8bb 100644

drivers/acpi/evged.c static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares,

Quoted 9 lines
drivers/acpi/evged.c +1 -2
@@ -101,7 +101,7 @@ static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares,
 
        switch (gsi) {
        case 0 ... 255:
-               sprintf(ev_name, "_%c%02hhX",
+               sprintf(ev_name, "_%c%02X",
                        trigger == ACPI_EDGE_SENSITIVE ? 'E' : 'L', gsi);
 
                if (ACPI_SUCCESS(acpi_get_handle(handle, ev_name, &evt_handle)))
--

Applied as 5.10-rc material, thanks!