Skip to contentSkip to conversation

platform/x86: Corrects warning: missing braces around initializer

PATCH In review [email protected] 2 participants 4 messages Oct 30, 2020 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

PATCH v2 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.

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 4 lines · On Fri, Oct 30, 2020 at 08:55:01AM -0700, [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.

I don't get the subject. IS it backport of existing change to v4.14, or you are trying to fix v4.14? If the latter is the case, it's not correct order. Try latest vanilla first (v5.10-rc1 as of today) and if there is still an issue, submit a patch.

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

Should not be blank line in between.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw
Quoted 7 lines · Andy Shevchenko
Quoted 2 lines · On Fri, Oct 30, 2020 at 08:55:01AM -0700, [email protected] wrote:

From: John Donnelly <[email protected]>

Quoted 7 lines
Quoted 2 lines

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

I don't get the subject. IS it backport of existing change to v4.14, or you are trying to fix v4.14? If the latter is the case, it's not correct order. Try latest vanilla first (v5.10-rc1 as of today) and if there is still an issue, submit a patch.

Hi,

It is only intended for 4.14. Why would you back port a commit to a stable tree that emits warnings ?

Quoted 12 lines
Quoted 4 lines
Fixes 515ded02bc4b ("platform/x86: thinkpad_acpi: initialize tp_nvram_state variable")

Should not be blank line in between.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw
Quoted 8 lines · John Donnelly
Quoted 8 lines · Andy Shevchenko
Quoted 4 lines · On Fri, Oct 30, 2020 at 08:55:01AM -0700, [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.

Quoted 8 lines
Quoted 4 lines

I don't get the subject. IS it backport of existing change to v4.14, or you are trying to fix v4.14? If the latter is the case, it's not correct order. Try latest vanilla first (v5.10-rc1 as of today) and if there is still an issue, submit a patch.

Hi,

It is only intended for 4.14. Why would you back port a commit to a stable tree that emits warnings ?

So, if this is for stable, what is the current commit in the kernel of this?

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Fixes 515ded02bc4b ("platform/x86: thinkpad_acpi: initialize tp_nvram_state variable")

Should not be blank line in between.

Signature · 2 lines
With Best Regards,
Andy Shevchenko