Xen-Devel Archive on lore.kernel.org
 help / color / Atom feed
* [Xen-devel] [PATCH] drm/xen-front: Make structure fb_funcs constant
@ 2019-08-13  6:27 Nishka Dasgupta
  2019-08-13  7:32 ` Oleksandr Andrushchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Nishka Dasgupta @ 2019-08-13  6:27 UTC (permalink / raw)
  To: oleksandr_andrushchenko, airlied, daniel, dri-devel, xen-devel
  Cc: Nishka Dasgupta

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.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
---
 drivers/gpu/drm/xen/xen_drm_front_kms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xen/xen_drm_front_kms.c b/drivers/gpu/drm/xen/xen_drm_front_kms.c
index c2955d375394..4a984f45555e 100644
--- a/drivers/gpu/drm/xen/xen_drm_front_kms.c
+++ b/drivers/gpu/drm/xen/xen_drm_front_kms.c
@@ -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,
 };
 
-- 
2.19.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH] drm/xen-front: Make structure fb_funcs constant
  2019-08-13  6:27 [Xen-devel] [PATCH] drm/xen-front: Make structure fb_funcs constant Nishka Dasgupta
@ 2019-08-13  7:32 ` Oleksandr Andrushchenko
  2019-08-14 17:26   ` Daniel Vetter
  0 siblings, 1 reply; 4+ messages in thread
From: Oleksandr Andrushchenko @ 2019-08-13  7:32 UTC (permalink / raw)
  To: Nishka Dasgupta, oleksandr_andrushchenko, airlied, daniel,
	dri-devel, xen-devel


On 8/13/19 9:27 AM, Nishka Dasgupta wrote:
> 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.
>
> Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
> ---
>   drivers/gpu/drm/xen/xen_drm_front_kms.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xen/xen_drm_front_kms.c b/drivers/gpu/drm/xen/xen_drm_front_kms.c
> index c2955d375394..4a984f45555e 100644
> --- a/drivers/gpu/drm/xen/xen_drm_front_kms.c
> +++ b/drivers/gpu/drm/xen/xen_drm_front_kms.c
> @@ -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,
>   };
>   


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH] drm/xen-front: Make structure fb_funcs constant
  2019-08-13  7:32 ` Oleksandr Andrushchenko
@ 2019-08-14 17:26   ` Daniel Vetter
  2019-08-19  5:47     ` Oleksandr Andrushchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Vetter @ 2019-08-14 17:26 UTC (permalink / raw)
  To: Oleksandr Andrushchenko
  Cc: Nishka Dasgupta, oleksandr_andrushchenko, airlied, dri-devel,
	daniel, xen-devel

On Tue, Aug 13, 2019 at 10:32:00AM +0300, Oleksandr Andrushchenko wrote:
> 
> On 8/13/19 9:27 AM, Nishka Dasgupta wrote:
> > 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.
> > 
> > Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
> Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

I'm assuming you'll apply this to drm-misc-next too? Good to state that,
to avoid confusion and coordination issues.
-Daniel

> > ---
> >   drivers/gpu/drm/xen/xen_drm_front_kms.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/xen/xen_drm_front_kms.c b/drivers/gpu/drm/xen/xen_drm_front_kms.c
> > index c2955d375394..4a984f45555e 100644
> > --- a/drivers/gpu/drm/xen/xen_drm_front_kms.c
> > +++ b/drivers/gpu/drm/xen/xen_drm_front_kms.c
> > @@ -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,
> >   };
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH] drm/xen-front: Make structure fb_funcs constant
  2019-08-14 17:26   ` Daniel Vetter
@ 2019-08-19  5:47     ` Oleksandr Andrushchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Oleksandr Andrushchenko @ 2019-08-19  5:47 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: airlied, xen-devel, dri-devel, Nishka Dasgupta, oleksandr_andrushchenko

On 8/14/19 8:26 PM, Daniel Vetter wrote:
> On Tue, Aug 13, 2019 at 10:32:00AM +0300, Oleksandr Andrushchenko wrote:
>> On 8/13/19 9:27 AM, Nishka Dasgupta wrote:
>>> 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.
>>>
>>> Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
>> Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
> 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
>>> ---
>>>    drivers/gpu/drm/xen/xen_drm_front_kms.c | 2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/xen/xen_drm_front_kms.c b/drivers/gpu/drm/xen/xen_drm_front_kms.c
>>> index c2955d375394..4a984f45555e 100644
>>> --- a/drivers/gpu/drm/xen/xen_drm_front_kms.c
>>> +++ b/drivers/gpu/drm/xen/xen_drm_front_kms.c
>>> @@ -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,
>>>    };


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-13  6:27 [Xen-devel] [PATCH] drm/xen-front: Make structure fb_funcs constant Nishka Dasgupta
2019-08-13  7:32 ` Oleksandr Andrushchenko
2019-08-14 17:26   ` Daniel Vetter
2019-08-19  5:47     ` Oleksandr Andrushchenko

Xen-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/xen-devel/0 xen-devel/git/0.git
	git clone --mirror https://lore.kernel.org/xen-devel/1 xen-devel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 xen-devel xen-devel/ https://lore.kernel.org/xen-devel \
		xen-devel@lists.xenproject.org xen-devel@archiver.kernel.org
	public-inbox-index xen-devel


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.xenproject.lists.xen-devel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox