public inbox for linux-fbdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4] staging: sm750fb: constify fix_id array
@ 2026-04-01 11:50 Hungyu Lin
  0 siblings, 0 replies; only message in thread
From: Hungyu Lin @ 2026-04-01 11:50 UTC (permalink / raw)
  To: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman
  Cc: linux-fbdev, linux-staging, linux-kernel, Hungyu Lin

Add the missing 'const' qualifier to the static fix_id array to ensure
the pointer array itself is immutable.

Originally:
    static const char *fix_id[2];
The strings are constant, but the pointer array itself is writable.

With the change:
    static const char * const fix_id[2];
Both the strings and the pointer array are immutable, allowing the
compiler to treat the object as read-only.

Verified by inspecting the generated object file with 'nm':

    00000000000002b8 0000000000000010 r fix_id.3

The 'r' flag indicates the symbol is placed in a read-only section.

This does not change runtime behavior as fix_id is never modified.

Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>

---
Changes in v4:
- Clarify const semantics of fix_id.
- Add compiler output showing symbol is read-only.
---
 drivers/staging/sm750fb/sm750.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 9a42a08c8..f7b5b22f1 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -728,7 +728,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
 		lynx750_ext, NULL, vesa_modes,
 	};
 	int cdb[] = {ARRAY_SIZE(lynx750_ext), 0, VESA_MODEDB_SIZE};
-	static const char *fix_id[2] = {
+	static const char * const fix_id[2] = {
 		"sm750_fb1", "sm750_fb2",
 	};
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-04-01 11:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-01 11:50 [PATCH v4] staging: sm750fb: constify fix_id array Hungyu Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox