Skip to contentSkip to conversation

platform/x86: Corrects warning: missing braces around initializer

PATCH Superseded [email protected] 1 participant 2 messages Oct 30, 2020 x86 platform drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86: Corrects warning: missing braces around initializer

From: John Donnelly <[email protected]>

The assignment statement of a local variable "struct tp_nvram_state s[2] = {0}; " is not valid for all versions of compilers (UEK6 on OL7).

Fixes 515ded02bc4b ("platform/x86: thinkpad_acpi: initialize tp_nvram_state variable")
---
 drivers/platform/x86/thinkpad_acpi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/platform/x86/thinkpad_acpi.c +3 -1
index ffaaccded34e..c41ac0385304 100644
@@ -2477,7 +2477,7 @@ static void hotkey_compare_and_issue_event(struct tp_nvram_state *oldn,
  */
 static int hotkey_kthread(void *data)
 {
-	struct tp_nvram_state s[2] = { 0 };
+	struct tp_nvram_state s[2];
 	u32 poll_mask, event_mask;
 	unsigned int si, so;
 	unsigned long t;
@@ -2488,6 +2488,8 @@ static int hotkey_kthread(void *data)
 	if (tpacpi_lifecycle == TPACPI_LIFE_EXITING)
 		goto exit;
 
+	memset(&s, 0, sizeof(s));
+
 	set_freezable();
 
 	so = 0;
Signature · 1 line
2.27.0
#1 lore raw
Quoted 41 lines · On Oct 30, 2020, at 10:52 AM, [email protected] wrote:

From: John Donnelly <[email protected]>

The assignment statement of a local variable "struct tp_nvram_state s[2] = {0}; " is not valid for all versions of compilers (UEK6 on OL7).

Fixes 515ded02bc4b ("platform/x86: thinkpad_acpi: initialize tp_nvram_state variable")

---
drivers/platform/x86/thinkpad_acpi.c | 4 +++-

1 file changed, 3 insertions(+), 1 deletion(-)
drivers/platform/x86/thinkpad_acpi.c +3 -1
index ffaaccded34e..c41ac0385304 100644
@@ -2477,7 +2477,7 @@ static void hotkey_compare_and_issue_event(struct tp_nvram_state *oldn,
 */
 static int hotkey_kthread(void *data)
 {
-	struct tp_nvram_state s[2] = { 0 };
+	struct tp_nvram_state s[2];
 	u32 poll_mask, event_mask;
 	unsigned int si, so;
 	unsigned long t;
@@ -2488,6 +2488,8 @@ static int hotkey_kthread(void *data)
 	if (tpacpi_lifecycle == TPACPI_LIFE_EXITING)
 		goto exit;
 
+	memset(&s, 0, sizeof(s));
+
 	set_freezable();
 
 	so = 0;
Signature · 1 line
2.27.0

Please ignore and use :

PATCH 4.14 v2 ] platform/x86: Corrects warning: missing braces around initializer