diff mbox series

drm/vboxvideo: Make structure vbox_fb_helper_funcs constant

Message ID 20190813062548.24770-1-nishkadg.linux@gmail.com (mailing list archive)
State New, archived
Headers show
Series drm/vboxvideo: Make structure vbox_fb_helper_funcs constant | expand

Commit Message

Nishka Dasgupta Aug. 13, 2019, 6:25 a.m. UTC
The static structure vbox_fb_helper_funcs, of type drm_fb_helper_funcs,
is used only when it is passed as the third argument to
drm_fb_helper_fbdev_setup(), which does not modify it. Hence make it
constant to protect it from unintended modifications.
Issue found with Coccinelle.

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

Comments

Hans de Goede Aug. 18, 2019, 10:56 a.m. UTC | #1
Hi all,

On 14-08-19 19:36, Hans de Goede wrote:
> Hi,
> 
> On 14-08-19 19:26, Daniel Vetter wrote:
>> On Tue, Aug 13, 2019 at 09:57:19AM +0200, Hans de Goede wrote:
>>> Hi,
>>>
>>> On 13-08-19 08:25, Nishka Dasgupta wrote:
>>>> The static structure vbox_fb_helper_funcs, of type drm_fb_helper_funcs,
>>>> is used only when it is passed as the third argument to
>>>> drm_fb_helper_fbdev_setup(), which does not modify it. Hence make it
>>>> constant to protect it from unintended modifications.
>>>> Issue found with Coccinelle.
>>>>
>>>> Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
>>>
>>> Thank you for the patch, this looks good to me:
>>>
>>> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
>>
>> I'm assuming you'll apply this to drm-misc-next too? Good to state that,
>> to avoid confusion and coordination issues.
> 
> Actually I'm so used to the workflow in other subsystems I was
> expecting the subsys maintainer to pick it up. But I know that
> is not how it works for the drm subsys and since I'm the vboxvideo
> maintainer I guess it makes sense for me to pick this up and push it.
> 
> So yes I will pick this up and push it to drm-misc-next, sorry
> for the confusion.

I've pushed this to drm-misc-next now.

Regards,

Hans



>>>> ---
>>>>    drivers/gpu/drm/vboxvideo/vbox_drv.c | 2 +-
>>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/vboxvideo/vbox_drv.c b/drivers/gpu/drm/vboxvideo/vbox_drv.c
>>>> index 02537ab9cc08..2b57ea3195f2 100644
>>>> --- a/drivers/gpu/drm/vboxvideo/vbox_drv.c
>>>> +++ b/drivers/gpu/drm/vboxvideo/vbox_drv.c
>>>> @@ -32,7 +32,7 @@ static const struct pci_device_id pciidlist[] = {
>>>>    };
>>>>    MODULE_DEVICE_TABLE(pci, pciidlist);
>>>> -static struct drm_fb_helper_funcs vbox_fb_helper_funcs = {
>>>> +static const struct drm_fb_helper_funcs vbox_fb_helper_funcs = {
>>>>        .fb_probe = vboxfb_create,
>>>>    };
>>>>
>>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/vboxvideo/vbox_drv.c b/drivers/gpu/drm/vboxvideo/vbox_drv.c
index 02537ab9cc08..2b57ea3195f2 100644
--- a/drivers/gpu/drm/vboxvideo/vbox_drv.c
+++ b/drivers/gpu/drm/vboxvideo/vbox_drv.c
@@ -32,7 +32,7 @@  static const struct pci_device_id pciidlist[] = {
 };
 MODULE_DEVICE_TABLE(pci, pciidlist);
 
-static struct drm_fb_helper_funcs vbox_fb_helper_funcs = {
+static const struct drm_fb_helper_funcs vbox_fb_helper_funcs = {
 	.fb_probe = vboxfb_create,
 };