Re: [PATCH] printk.c: remove duplicate const

Previous thread: [PATCH 1/2] Fix 'key f70f4b50 not in .data' in thermal_sys by Wolfram Sang on Thursday, April 1, 2010 - 6:02 pm. (3 messages)

Next thread: [PATCH] fs-writeback.c: bitfields should be unsigned by H Hartley Sweeten on Thursday, April 1, 2010 - 6:36 pm. (1 message)
From: H Hartley Sweeten
Date: Thursday, April 1, 2010 - 6:13 pm

Noticed during a sparse build.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>

---

diff --git a/kernel/printk.c b/kernel/printk.c
index 75077ad..9abc79c 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -1457,7 +1457,7 @@ int kmsg_dump_unregister(struct kmsg_dumper *dumper)
 }
 EXPORT_SYMBOL_GPL(kmsg_dump_unregister);
 
-static const char const *kmsg_reasons[] = {
+static const char *kmsg_reasons[] = {
 	[KMSG_DUMP_OOPS]	= "oops",
 	[KMSG_DUMP_PANIC]	= "panic",
 	[KMSG_DUMP_KEXEC]	= "kexec",
From: David Miller
Date: Thursday, April 1, 2010 - 6:20 pm

From: H Hartley Sweeten <hartleys@visionengravers.com>

Isn't it intentional?  The two consts mark different aspects
of the declaration const, both the pointers as well as the
contents pointed to.
--

From: H Hartley Sweeten
Date: Thursday, April 1, 2010 - 6:28 pm

Isn't that a C++ and not a C feature?

If it is valid in C then I guess the sparse people should be informed.

Regards,
Hartley--

From: David Miller
Date: Thursday, April 1, 2010 - 6:29 pm

From: H Hartley Sweeten <hartleys@visionengravers.com>


Perhaps.
--

From: Andres Salomon
Date: Thursday, April 1, 2010 - 7:02 pm

On Thu, 01 Apr 2010 18:20:04 -0700 (PDT)


I believe that'd be -

static const char *const kmsg_reasons[]

rather than what was originally in the code -

static const char const *kmsg_reasons[]

Read right-to-left, the first is a constant pointer to a char constant;
the second is a pointer to a constant character constant.   I suspect
the first is what was intended.

--

Previous thread: [PATCH 1/2] Fix 'key f70f4b50 not in .data' in thermal_sys by Wolfram Sang on Thursday, April 1, 2010 - 6:02 pm. (3 messages)

Next thread: [PATCH] fs-writeback.c: bitfields should be unsigned by H Hartley Sweeten on Thursday, April 1, 2010 - 6:36 pm. (1 message)