linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] auxdisplay: ht16k33: Make ht16k33_fb_fix and ht16k33_fb_var constant
@ 2019-08-19  7:51 Nishka Dasgupta
  2019-08-19 16:48 ` Miguel Ojeda
  2019-08-20  6:28 ` Robin van der Gracht
  0 siblings, 2 replies; 3+ messages in thread
From: Nishka Dasgupta @ 2019-08-19  7:51 UTC (permalink / raw)
  To: robin, miguel.ojeda.sandonis, linux-kernel; +Cc: Nishka Dasgupta

The static structures ht16k33_fb_fix and ht16k33_fb_var, of types
fb_fix_screeninfo and fb_var_screeninfo respectively, are not used
except to be copied into other variables. Hence make both of them
constant to prevent unintended modification.
Issue found with
Coccinelle.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
---
 drivers/auxdisplay/ht16k33.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
index 9c0bb771751d..a2fcde582e2a 100644
--- a/drivers/auxdisplay/ht16k33.c
+++ b/drivers/auxdisplay/ht16k33.c
@@ -74,7 +74,7 @@ struct ht16k33_priv {
 	struct ht16k33_fbdev fbdev;
 };
 
-static struct fb_fix_screeninfo ht16k33_fb_fix = {
+static const struct fb_fix_screeninfo ht16k33_fb_fix = {
 	.id		= DRIVER_NAME,
 	.type		= FB_TYPE_PACKED_PIXELS,
 	.visual		= FB_VISUAL_MONO10,
@@ -85,7 +85,7 @@ static struct fb_fix_screeninfo ht16k33_fb_fix = {
 	.accel		= FB_ACCEL_NONE,
 };
 
-static struct fb_var_screeninfo ht16k33_fb_var = {
+static const struct fb_var_screeninfo ht16k33_fb_var = {
 	.xres = HT16K33_MATRIX_LED_MAX_ROWS,
 	.yres = HT16K33_MATRIX_LED_MAX_COLS,
 	.xres_virtual = HT16K33_MATRIX_LED_MAX_ROWS,
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] auxdisplay: ht16k33: Make ht16k33_fb_fix and ht16k33_fb_var constant
  2019-08-19  7:51 [PATCH] auxdisplay: ht16k33: Make ht16k33_fb_fix and ht16k33_fb_var constant Nishka Dasgupta
@ 2019-08-19 16:48 ` Miguel Ojeda
  2019-08-20  6:28 ` Robin van der Gracht
  1 sibling, 0 replies; 3+ messages in thread
From: Miguel Ojeda @ 2019-08-19 16:48 UTC (permalink / raw)
  To: Nishka Dasgupta; +Cc: Robin van der Gracht, linux-kernel

On Mon, Aug 19, 2019 at 9:51 AM Nishka Dasgupta
<nishkadg.linux@gmail.com> wrote:
>
> The static structures ht16k33_fb_fix and ht16k33_fb_var, of types
> fb_fix_screeninfo and fb_var_screeninfo respectively, are not used
> except to be copied into other variables. Hence make both of them
> constant to prevent unintended modification.
> Issue found with
> Coccinelle.

Thanks Nishka, picking it up.

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] auxdisplay: ht16k33: Make ht16k33_fb_fix and ht16k33_fb_var constant
  2019-08-19  7:51 [PATCH] auxdisplay: ht16k33: Make ht16k33_fb_fix and ht16k33_fb_var constant Nishka Dasgupta
  2019-08-19 16:48 ` Miguel Ojeda
@ 2019-08-20  6:28 ` Robin van der Gracht
  1 sibling, 0 replies; 3+ messages in thread
From: Robin van der Gracht @ 2019-08-20  6:28 UTC (permalink / raw)
  To: Nishka Dasgupta; +Cc: miguel.ojeda.sandonis, linux-kernel

On 2019-08-19 09:51, Nishka Dasgupta wrote:
> The static structures ht16k33_fb_fix and ht16k33_fb_var, of types
> fb_fix_screeninfo and fb_var_screeninfo respectively, are not used
> except to be copied into other variables. Hence make both of them
> constant to prevent unintended modification.
> Issue found with
> Coccinelle.
> 
> Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
> ---
>  drivers/auxdisplay/ht16k33.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/auxdisplay/ht16k33.c 
> b/drivers/auxdisplay/ht16k33.c
> index 9c0bb771751d..a2fcde582e2a 100644
> --- a/drivers/auxdisplay/ht16k33.c
> +++ b/drivers/auxdisplay/ht16k33.c
> @@ -74,7 +74,7 @@ struct ht16k33_priv {
>  	struct ht16k33_fbdev fbdev;
>  };
> 
> -static struct fb_fix_screeninfo ht16k33_fb_fix = {
> +static const struct fb_fix_screeninfo ht16k33_fb_fix = {
>  	.id		= DRIVER_NAME,
>  	.type		= FB_TYPE_PACKED_PIXELS,
>  	.visual		= FB_VISUAL_MONO10,
> @@ -85,7 +85,7 @@ static struct fb_fix_screeninfo ht16k33_fb_fix = {
>  	.accel		= FB_ACCEL_NONE,
>  };
> 
> -static struct fb_var_screeninfo ht16k33_fb_var = {
> +static const struct fb_var_screeninfo ht16k33_fb_var = {
>  	.xres = HT16K33_MATRIX_LED_MAX_ROWS,
>  	.yres = HT16K33_MATRIX_LED_MAX_COLS,
>  	.xres_virtual = HT16K33_MATRIX_LED_MAX_ROWS,

ACK

Robin

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-08-20  6:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-19  7:51 [PATCH] auxdisplay: ht16k33: Make ht16k33_fb_fix and ht16k33_fb_var constant Nishka Dasgupta
2019-08-19 16:48 ` Miguel Ojeda
2019-08-20  6:28 ` Robin van der Gracht

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).