drm/xen-front: Make structure fb_funcs constant
Subsystems (3)
PATCH 1/1 drm/xen-front: Make structure fb_funcs constant
Static structure fb_funcs, of type drm_framebuffer_funcs, is used only when it is passed to drm_gem_fb_create_with_funcs() as its last argument. drm_gem_fb_create_with_funcs does not modify its lst argument (fb_funcs) and hence fb_funcs is never modified. Therefore make fb_funcs constant to protect it from further modification.
Issue found with Coccinelle.
--- drivers/gpu/drm/xen/xen_drm_front_kms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/xen/xen_drm_front_kms.c +1 -1
@@ -45,7 +45,7 @@ static void fb_destroy(struct drm_framebuffer *fb)drm_gem_fb_destroy (fb); } -static struct drm_framebuffer_funcs fb_funcs = { +static const struct drm_framebuffer_funcs fb_funcs = { .destroy = fb_destroy, };
Signature · 7 lines
2.19.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 8 lines · Nishka Dasgupta
Static structure
fb_funcs, of typedrm_framebuffer_funcs, is used only when it is passed todrm_gem_fb_create_with_funcs()as its last argument.drm_gem_fb_create_with_funcsdoes not modify its lst argument (fb_funcs) and hencefb_funcsis never modified. Therefore makefb_funcsconstant to protect it from further modification.
Issue found with Coccinelle.Signed-off-by Nishka Dasgupta <[email protected]>
Quoted 9 lines
--- drivers/gpu/drm/xen/xen_drm_front_kms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/xen/xen_drm_front_kms.c +0
-0
drivers/gpu/drm/xen/xen_drm_front_kms.c static void fb_destroy(struct drm_framebuffer *fb) · line 51
Quoted 8 lines
drivers/gpu/drm/xen/xen_drm_front_kms.c +1
-1@@ -45,7 +45,7 @@ static void fb_destroy(struct drm_framebuffer *fb)drm_gem_fb_destroy (fb); } -static struct drm_framebuffer_funcs fb_funcs = { +static const struct drm_framebuffer_funcs fb_funcs = { .destroy = fb_destroy, };
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 11 lines · Oleksandr Andrushchenko
Quoted 8 lines · Nishka Dasgupta
Static structure
fb_funcs, of typedrm_framebuffer_funcs, is used only when it is passed todrm_gem_fb_create_with_funcs()as its last argument.drm_gem_fb_create_with_funcsdoes not modify its lst argument (fb_funcs) and hencefb_funcsis never modified. Therefore makefb_funcsconstant to protect it from further modification.
Issue found with Coccinelle.Signed-off-by Nishka Dasgupta <[email protected]>Reviewed-by Oleksandr Andrushchenko <[email protected]>
I'm assuming you'll apply this to drm-misc-next too? Good to state that, to avoid confusion and coordination issues.
-Daniel
Quoted 16 lines
Quoted 15 lines
--- drivers/gpu/drm/xen/xen_drm_front_kms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/xen/xen_drm_front_kms.c +1
-1@@ -45,7 +45,7 @@ static void fb_destroy(struct drm_framebuffer *fb)drm_gem_fb_destroy (fb); } -static struct drm_framebuffer_funcs fb_funcs = { +static const struct drm_framebuffer_funcs fb_funcs = { .destroy = fb_destroy, };
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 9 lines · Daniel Vetter
Quoted 8 lines · Oleksandr Andrushchenko
Quoted 7 lines · Nishka Dasgupta
Static structure
fb_funcs, of typedrm_framebuffer_funcs, is used only when it is passed todrm_gem_fb_create_with_funcs()as its last argument.drm_gem_fb_create_with_funcsdoes not modify its lst argument (fb_funcs) and hencefb_funcsis never modified. Therefore makefb_funcsconstant to protect it from further modification.
Issue found with Coccinelle.
Quoted 6 lines
Quoted 2 lines
Quoted 1 line
Signed-off-by Nishka Dasgupta <[email protected]>Reviewed-by Oleksandr Andrushchenko <[email protected]>I'm assuming you'll apply this to drm-misc-next too? Good to state that, to avoid confusion and coordination issues.
-Daniel
Sorry for the delay and confusion.
Applied to drm-misc-next
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
--- drivers/gpu/drm/xen/xen_drm_front_kms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/xen/xen_drm_front_kms.c static void fb_destroy(struct drm_framebuffer *fb) · line 49
Quoted 11 lines
drivers/gpu/drm/xen/xen_drm_front_kms.c +1
-1@@ -45,7 +45,7 @@ static void fb_destroy(struct drm_framebuffer *fb)drm_gem_fb_destroy (fb); } -static struct drm_framebuffer_funcs fb_funcs = { +static const struct drm_framebuffer_funcs fb_funcs = { .destroy = fb_destroy, };
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel