Skip to contentSkip to conversation

platform/chrome: cros_ec_lightbar: fix const correctness of seqname array

PATCH In review trunix-creator 2 participants 2 messages Feb 8 – Feb 23

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/chrome: cros_ec_lightbar: fix const correctness of seqname array

The seqname array was declared as 'char const *seqname[]',
And since the array is intended to be fully immutable, It is now corrected
to 'const char * const seqname[]' to mark both the strings and the pointer array as read-only.

This improves const correctness and matches the intended usage of the sequence name table.

---
 drivers/platform/chrome/cros_ec_lightbar.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/chrome/cros_ec_lightbar.c +1 -1
index 8352e9732791..922758c2cec1 100644
@@ -283,7 +283,7 @@ static ssize_t led_rgb_store(struct device *dev, struct device_attribute *attr,
 	return (ok && i == 0) ? count : -EINVAL;
 }
 
-static char const *seqname[] = {
+static const char * const seqname[] = {
 	"ERROR", "S5", "S3", "S0", "S5S3", "S3S0",
 	"S0S3", "S3S5", "STOP", "RUN", "KONAMI",
 	"TAP", "PROGRAM",
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 8 lines · trunix-creator

The seqname array was declared as 'char const *seqname[]',
And since the array is intended to be fully immutable, It is now corrected
to 'const char * const seqname[]' to mark both the strings and the pointer array as read-only.

This improves const correctness and matches the intended usage of the sequence name table.

Thanks for the patch.

Before this can be considered for merging, you'll need to update the Signed-off-by line. The kernel community requires the use of your real name (legal name) rather than a handle (see also "Developer's Certificate of Origin" in Documentation/process/submitting-patches.rst).