Skip to contentSkip to conversation

staging: pi433: Fix string form declaration

PATCH In review Burak Ozdemir 2 participants 3 messages Sep 9, 2022 – Sep 10, 2022 1 message not in the archive Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: pi433: Fix string form declaration

From: Burak Ozdemir <[email protected]>

Use correct string form declaration, prevent extra variable declaration in final assembly output.

---
 drivers/staging/pi433/pi433_if.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/pi433/pi433_if.c +1 -1
index df02335fdbab..70b3709acbb2 100644
@@ -1105,7 +1105,7 @@ static int pi433_debugfs_regs_show(struct seq_file *m, void *p)
 	struct pi433_device *dev;
 	u8 reg_data[114];
 	int i;
-	char *fmt = "0x%02x, 0x%02x\n";
+	static const char fmt[] = "0x%02x, 0x%02x\n";
 	int ret;
 
 	dev = m->private;
Signature · 1 line
2.35.1
#1 lore raw
Quoted 4 lines · Burak Ozdemir

From: Burak Ozdemir <[email protected]>

Use correct string form declaration, prevent extra variable declaration in final assembly output.

I am sorry, but I do not understand this text. How is the original code incorrect?

Please explain this a lot better when you resend a v2.

thanks,

greg k-h

A message that is not in the archive (sent off-list or not yet received): CACAQkfXH4smoY2v28DOZ_0uf_2=e8iEDSFbEbTMhU0JPuteOPw@mail.gmail.com

#3 lore raw
Quoted 5 lines · Burak Ozdemir

I have been analyzing todo tasks from Kernel Janitors Projects and saw the following task

From: Jeff Garzik

Quoted 8 lines

1) The string form

        [const] char *foo = "blah";
creates two variables in the final assembly output, a static string, and a
char pointer to the static string. The alternate string form
        [const] char foo[] = "blah";

is better because it declares a single variable.

That's why I changed that char * to static const[].

I'm sorry, but I have no context here at all for what this is in response to.

Remember, some of us get hundreds of changes each day to review, and we have the short-term memory of a squirrel. Always include proper context in an email message so that we know what is going on.

thanks,

greg k-h