* [PATCH] staging: sm750fb: make g_fbmode[] a read-only pointer array
@ 2025-06-27 17:31 Manish Kumar
2025-06-27 17:35 ` Dan Carpenter
0 siblings, 1 reply; 4+ messages in thread
From: Manish Kumar @ 2025-06-27 17:31 UTC (permalink / raw)
To: sudipm.mukherjee, teddy.wang, gregkh
Cc: linux-fbdev, linux-staging, linux-kernel, Manish Kumar
This fixes a checkpatch warning by changing the declaration of g_fbmode[]
from 'static const char *' to 'static const char * const', making both the
string contents and the array elements read-only.
Signed-off-by: Manish Kumar <manish1588@gmail.com>
---
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 1d929aca399c..e77ad73f0db1 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -33,7 +33,7 @@
static int g_hwcursor = 1;
static int g_noaccel;
static int g_nomtrr;
-static const char *g_fbmode[] = {NULL, NULL};
+static const char * const g_fbmode[] = {NULL, NULL};
static const char *g_def_fbmode = "1024x768-32@60";
static char *g_settings;
static int g_dualview;
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: sm750fb: make g_fbmode[] a read-only pointer array
2025-06-27 17:31 [PATCH] staging: sm750fb: make g_fbmode[] a read-only pointer array Manish Kumar
@ 2025-06-27 17:35 ` Dan Carpenter
2025-06-27 18:15 ` Manish Kumar
[not found] ` <CAAoxDjcYwV9JhRLGJ+opJLEU5j4RHYUt4XZ8E4R9DgF2VqZD8Q@mail.gmail.com>
0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2025-06-27 17:35 UTC (permalink / raw)
To: Manish Kumar
Cc: sudipm.mukherjee, teddy.wang, gregkh, linux-fbdev, linux-staging,
linux-kernel
On Fri, Jun 27, 2025 at 11:01:20PM +0530, Manish Kumar wrote:
> This fixes a checkpatch warning by changing the declaration of g_fbmode[]
> from 'static const char *' to 'static const char * const', making both the
> string contents and the array elements read-only.
>
> Signed-off-by: Manish Kumar <manish1588@gmail.com>
This breaks the build. Now we can't change the pointer to anythine else
except NULL.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: sm750fb: make g_fbmode[] a read-only pointer array
2025-06-27 17:35 ` Dan Carpenter
@ 2025-06-27 18:15 ` Manish Kumar
[not found] ` <CAAoxDjcYwV9JhRLGJ+opJLEU5j4RHYUt4XZ8E4R9DgF2VqZD8Q@mail.gmail.com>
1 sibling, 0 replies; 4+ messages in thread
From: Manish Kumar @ 2025-06-27 18:15 UTC (permalink / raw)
To: dan.carpenter
Cc: gregkh, linux-fbdev, linux-kernel, linux-staging, manish1588,
sudipm.mukherjee, teddy.wang
Hi Dan,
Thank you for the review. You're absolutely right — changing the array to `const` breaks the assignments that follow.
I've reverted this and will send a new cleanup patch later.
Regards,
Manish
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: sm750fb: make g_fbmode[] a read-only pointer array
[not found] ` <CAAoxDjcYwV9JhRLGJ+opJLEU5j4RHYUt4XZ8E4R9DgF2VqZD8Q@mail.gmail.com>
@ 2025-06-27 18:18 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2025-06-27 18:18 UTC (permalink / raw)
To: Manish Kumar
Cc: sudipm.mukherjee, teddy.wang, gregkh, linux-fbdev, linux-staging,
linux-kernel
On Fri, Jun 27, 2025 at 11:16:06PM +0530, Manish Kumar wrote:
> Hi Dan,
>
> Thank you for the review and pointing out the issue. You're right —
> changing the array to `const` makes it unmodifiable, which breaks the
> assignment logic in the driver.
>
> I've reverted the change and will look for another checkpatch warning to
> address for the next version of the patch.
>
Awesome. Thanks.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-06-27 18:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-27 17:31 [PATCH] staging: sm750fb: make g_fbmode[] a read-only pointer array Manish Kumar
2025-06-27 17:35 ` Dan Carpenter
2025-06-27 18:15 ` Manish Kumar
[not found] ` <CAAoxDjcYwV9JhRLGJ+opJLEU5j4RHYUt4XZ8E4R9DgF2VqZD8Q@mail.gmail.com>
2025-06-27 18:18 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).