linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/bridge: dw-mipi-dsi: Use kmemdup cf. kmalloc+memcpy
@ 2020-09-09 19:02 Alex Dewar
  2020-09-11 12:57 ` Neil Armstrong
  0 siblings, 1 reply; 7+ messages in thread
From: Alex Dewar @ 2020-09-09 19:02 UTC (permalink / raw)
  Cc: Alex Dewar, Andrzej Hajda, Neil Armstrong, Laurent Pinchart,
	Jonas Karlman, Jernej Skrabec, David Airlie, Daniel Vetter,
	Philippe Cornu, Yannick Fertré,
	Antonio Borneo, Heiko Stuebner, Angelo Ribeiro, Markus Elfring,
	dri-devel, linux-kernel

kmemdup can be used instead of kmalloc+memcpy. Replace an occurrence of
this pattern.

Issue identified with Coccinelle.

Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
---
 drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
index 52f5c5a2ed64..7e9a62ad56e8 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
@@ -1049,12 +1049,10 @@ static void debugfs_create_files(void *data)
 	};
 	int i;
 
-	dsi->debugfs_vpg = kmalloc(sizeof(debugfs), GFP_KERNEL);
+	dsi->debugfs_vpg = kmemdup(debugfs, sizeof(debugfs), GFP_KERNEL);
 	if (!dsi->debugfs_vpg)
 		return;
 
-	memcpy(dsi->debugfs_vpg, debugfs, sizeof(debugfs));
-
 	for (i = 0; i < ARRAY_SIZE(debugfs); i++)
 		debugfs_create_file(dsi->debugfs_vpg[i].name, 0644,
 				    dsi->debugfs, &dsi->debugfs_vpg[i],
-- 
2.28.0


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

* Re: [PATCH] drm/bridge: dw-mipi-dsi: Use kmemdup cf. kmalloc+memcpy
  2020-09-09 19:02 [PATCH] drm/bridge: dw-mipi-dsi: Use kmemdup cf. kmalloc+memcpy Alex Dewar
@ 2020-09-11 12:57 ` Neil Armstrong
  2020-09-19 19:31   ` Alex Dewar
  0 siblings, 1 reply; 7+ messages in thread
From: Neil Armstrong @ 2020-09-11 12:57 UTC (permalink / raw)
  To: Alex Dewar
  Cc: Andrzej Hajda, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	David Airlie, Daniel Vetter, Philippe Cornu, Yannick Fertré,
	Antonio Borneo, Heiko Stuebner, Angelo Ribeiro, Markus Elfring,
	dri-devel, linux-kernel

On 09/09/2020 21:02, Alex Dewar wrote:
> kmemdup can be used instead of kmalloc+memcpy. Replace an occurrence of
> this pattern.
> 
> Issue identified with Coccinelle.
> 
> Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
> ---
>  drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> index 52f5c5a2ed64..7e9a62ad56e8 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> @@ -1049,12 +1049,10 @@ static void debugfs_create_files(void *data)
>  	};
>  	int i;
>  
> -	dsi->debugfs_vpg = kmalloc(sizeof(debugfs), GFP_KERNEL);
> +	dsi->debugfs_vpg = kmemdup(debugfs, sizeof(debugfs), GFP_KERNEL);
>  	if (!dsi->debugfs_vpg)
>  		return;
>  
> -	memcpy(dsi->debugfs_vpg, debugfs, sizeof(debugfs));
> -
>  	for (i = 0; i < ARRAY_SIZE(debugfs); i++)
>  		debugfs_create_file(dsi->debugfs_vpg[i].name, 0644,
>  				    dsi->debugfs, &dsi->debugfs_vpg[i],
> 

Acked-by: Neil Armstrong <narmstrong@baylibre.com>

Thanks,
Neil

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

* Re: [PATCH] drm/bridge: dw-mipi-dsi: Use kmemdup cf. kmalloc+memcpy
  2020-09-11 12:57 ` Neil Armstrong
@ 2020-09-19 19:31   ` Alex Dewar
  2020-09-20  8:24     ` Daniel Vetter
  0 siblings, 1 reply; 7+ messages in thread
From: Alex Dewar @ 2020-09-19 19:31 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: Andrzej Hajda, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	David Airlie, Daniel Vetter, Philippe Cornu, Yannick Fertré,
	Antonio Borneo, Heiko Stuebner, Angelo Ribeiro, Markus Elfring,
	dri-devel, linux-kernel

On 2020-09-11 13:57, Neil Armstrong wrote:
> On 09/09/2020 21:02, Alex Dewar wrote:
>> kmemdup can be used instead of kmalloc+memcpy. Replace an occurrence of
>> this pattern.
Friendly ping?
>>
>> Issue identified with Coccinelle.
>>
>> Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
>> ---
>>   drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 4 +---
>>   1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
>> index 52f5c5a2ed64..7e9a62ad56e8 100644
>> --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
>> +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
>> @@ -1049,12 +1049,10 @@ static void debugfs_create_files(void *data)
>>   	};
>>   	int i;
>>   
>> -	dsi->debugfs_vpg = kmalloc(sizeof(debugfs), GFP_KERNEL);
>> +	dsi->debugfs_vpg = kmemdup(debugfs, sizeof(debugfs), GFP_KERNEL);
>>   	if (!dsi->debugfs_vpg)
>>   		return;
>>   
>> -	memcpy(dsi->debugfs_vpg, debugfs, sizeof(debugfs));
>> -
>>   	for (i = 0; i < ARRAY_SIZE(debugfs); i++)
>>   		debugfs_create_file(dsi->debugfs_vpg[i].name, 0644,
>>   				    dsi->debugfs, &dsi->debugfs_vpg[i],
>>
> Acked-by: Neil Armstrong <narmstrong@baylibre.com>
>
> Thanks,
> Neil


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

* Re: [PATCH] drm/bridge: dw-mipi-dsi: Use kmemdup cf. kmalloc+memcpy
  2020-09-19 19:31   ` Alex Dewar
@ 2020-09-20  8:24     ` Daniel Vetter
  2020-09-21  9:55       ` Neil Armstrong
  2020-09-21  9:58       ` Neil Armstrong
  0 siblings, 2 replies; 7+ messages in thread
From: Daniel Vetter @ 2020-09-20  8:24 UTC (permalink / raw)
  To: Alex Dewar
  Cc: Neil Armstrong, Andrzej Hajda, Laurent Pinchart, Jonas Karlman,
	Jernej Skrabec, David Airlie, Philippe Cornu, Yannick Fertré,
	Antonio Borneo, Heiko Stuebner, Angelo Ribeiro, Markus Elfring,
	dri-devel, Linux Kernel Mailing List

On Sat, Sep 19, 2020 at 9:31 PM Alex Dewar <alex.dewar90@gmail.com> wrote:
>
> On 2020-09-11 13:57, Neil Armstrong wrote:
> > On 09/09/2020 21:02, Alex Dewar wrote:
> >> kmemdup can be used instead of kmalloc+memcpy. Replace an occurrence of
> >> this pattern.
> Friendly ping?
> >>
> >> Issue identified with Coccinelle.
> >>
> >> Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
> >> ---
> >>   drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 4 +---
> >>   1 file changed, 1 insertion(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> >> index 52f5c5a2ed64..7e9a62ad56e8 100644
> >> --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> >> +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> >> @@ -1049,12 +1049,10 @@ static void debugfs_create_files(void *data)
> >>      };
> >>      int i;
> >>
> >> -    dsi->debugfs_vpg = kmalloc(sizeof(debugfs), GFP_KERNEL);
> >> +    dsi->debugfs_vpg = kmemdup(debugfs, sizeof(debugfs), GFP_KERNEL);
> >>      if (!dsi->debugfs_vpg)
> >>              return;
> >>
> >> -    memcpy(dsi->debugfs_vpg, debugfs, sizeof(debugfs));
> >> -
> >>      for (i = 0; i < ARRAY_SIZE(debugfs); i++)
> >>              debugfs_create_file(dsi->debugfs_vpg[i].name, 0644,
> >>                                  dsi->debugfs, &dsi->debugfs_vpg[i],
> >>
> > Acked-by: Neil Armstrong <narmstrong@baylibre.com>

Neil has commit rights, so I was assuming he'd push this to drm-misc-next.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

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

* Re: [PATCH] drm/bridge: dw-mipi-dsi: Use kmemdup cf. kmalloc+memcpy
  2020-09-20  8:24     ` Daniel Vetter
@ 2020-09-21  9:55       ` Neil Armstrong
  2020-09-21  9:58       ` Neil Armstrong
  1 sibling, 0 replies; 7+ messages in thread
From: Neil Armstrong @ 2020-09-21  9:55 UTC (permalink / raw)
  To: Daniel Vetter, Alex Dewar
  Cc: Andrzej Hajda, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	David Airlie, Philippe Cornu, Yannick Fertré,
	Antonio Borneo, Heiko Stuebner, Angelo Ribeiro, Markus Elfring,
	dri-devel, Linux Kernel Mailing List

On 20/09/2020 10:24, Daniel Vetter wrote:
> On Sat, Sep 19, 2020 at 9:31 PM Alex Dewar <alex.dewar90@gmail.com> wrote:
>>
>> On 2020-09-11 13:57, Neil Armstrong wrote:
>>> On 09/09/2020 21:02, Alex Dewar wrote:
>>>> kmemdup can be used instead of kmalloc+memcpy. Replace an occurrence of
>>>> this pattern.
>> Friendly ping?
>>>>
>>>> Issue identified with Coccinelle.
>>>>
>>>> Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
>>>> ---
>>>>   drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 4 +---
>>>>   1 file changed, 1 insertion(+), 3 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
>>>> index 52f5c5a2ed64..7e9a62ad56e8 100644
>>>> --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
>>>> +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
>>>> @@ -1049,12 +1049,10 @@ static void debugfs_create_files(void *data)
>>>>      };
>>>>      int i;
>>>>
>>>> -    dsi->debugfs_vpg = kmalloc(sizeof(debugfs), GFP_KERNEL);
>>>> +    dsi->debugfs_vpg = kmemdup(debugfs, sizeof(debugfs), GFP_KERNEL);
>>>>      if (!dsi->debugfs_vpg)
>>>>              return;
>>>>
>>>> -    memcpy(dsi->debugfs_vpg, debugfs, sizeof(debugfs));
>>>> -
>>>>      for (i = 0; i < ARRAY_SIZE(debugfs); i++)
>>>>              debugfs_create_file(dsi->debugfs_vpg[i].name, 0644,
>>>>                                  dsi->debugfs, &dsi->debugfs_vpg[i],
>>>>
>>> Acked-by: Neil Armstrong <narmstrong@baylibre.com>
> 
> Neil has commit rights, so I was assuming he'd push this to drm-misc-next.
> -Daniel
> 

Applying now,
Neil

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

* Re: [PATCH] drm/bridge: dw-mipi-dsi: Use kmemdup cf. kmalloc+memcpy
  2020-09-20  8:24     ` Daniel Vetter
  2020-09-21  9:55       ` Neil Armstrong
@ 2020-09-21  9:58       ` Neil Armstrong
  2020-09-21 10:13         ` Alex Dewar
  1 sibling, 1 reply; 7+ messages in thread
From: Neil Armstrong @ 2020-09-21  9:58 UTC (permalink / raw)
  To: Daniel Vetter, Alex Dewar
  Cc: Andrzej Hajda, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	David Airlie, Philippe Cornu, Yannick Fertré,
	Antonio Borneo, Heiko Stuebner, Angelo Ribeiro, Markus Elfring,
	dri-devel, Linux Kernel Mailing List

On 20/09/2020 10:24, Daniel Vetter wrote:
> On Sat, Sep 19, 2020 at 9:31 PM Alex Dewar <alex.dewar90@gmail.com> wrote:
>>
>> On 2020-09-11 13:57, Neil Armstrong wrote:
>>> On 09/09/2020 21:02, Alex Dewar wrote:
>>>> kmemdup can be used instead of kmalloc+memcpy. Replace an occurrence of
>>>> this pattern.
>> Friendly ping?
>>>>
>>>> Issue identified with Coccinelle.
>>>>
>>>> Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
>>>> ---
>>>>   drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 4 +---
>>>>   1 file changed, 1 insertion(+), 3 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
>>>> index 52f5c5a2ed64..7e9a62ad56e8 100644
>>>> --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
>>>> +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
>>>> @@ -1049,12 +1049,10 @@ static void debugfs_create_files(void *data)
>>>>      };
>>>>      int i;
>>>>
>>>> -    dsi->debugfs_vpg = kmalloc(sizeof(debugfs), GFP_KERNEL);
>>>> +    dsi->debugfs_vpg = kmemdup(debugfs, sizeof(debugfs), GFP_KERNEL);
>>>>      if (!dsi->debugfs_vpg)
>>>>              return;
>>>>
>>>> -    memcpy(dsi->debugfs_vpg, debugfs, sizeof(debugfs));
>>>> -
>>>>      for (i = 0; i < ARRAY_SIZE(debugfs); i++)
>>>>              debugfs_create_file(dsi->debugfs_vpg[i].name, 0644,
>>>>                                  dsi->debugfs, &dsi->debugfs_vpg[i],
>>>>
>>> Acked-by: Neil Armstrong <narmstrong@baylibre.com>
> 
> Neil has commit rights, so I was assuming he'd push this to drm-misc-next.
> -Daniel
> 

Hmm, I applied this already:
commit 33f290811d4c1a09c4e92f5bf0458525835dbcba
Author: Alex Dewar <alex.dewar90@gmail.com>
Date:   Wed Sep 9 20:02:08 2020 +0100

    drm/bridge: dw-mipi-dsi: Use kmemdup cf. kmalloc+memcpy

    kmemdup can be used instead of kmalloc+memcpy. Replace an occurrence of
    this pattern.

    Issue identified with Coccinelle.

    Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
    Acked-by: Neil Armstrong <narmstrong@baylibre.com>
    Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20200909190213.156302-1-alex.dewar90@gmail.com

Neil

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

* Re: [PATCH] drm/bridge: dw-mipi-dsi: Use kmemdup cf. kmalloc+memcpy
  2020-09-21  9:58       ` Neil Armstrong
@ 2020-09-21 10:13         ` Alex Dewar
  0 siblings, 0 replies; 7+ messages in thread
From: Alex Dewar @ 2020-09-21 10:13 UTC (permalink / raw)
  To: Neil Armstrong, Daniel Vetter
  Cc: Andrzej Hajda, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	David Airlie, Philippe Cornu, Yannick Fertré,
	Antonio Borneo, Heiko Stuebner, Angelo Ribeiro, Markus Elfring,
	dri-devel, Linux Kernel Mailing List


> Hmm, I applied this already:
> commit 33f290811d4c1a09c4e92f5bf0458525835dbcba
> Author: Alex Dewar <alex.dewar90@gmail.com>
> Date:   Wed Sep 9 20:02:08 2020 +0100
>
>      drm/bridge: dw-mipi-dsi: Use kmemdup cf. kmalloc+memcpy
>
>      kmemdup can be used instead of kmalloc+memcpy. Replace an occurrence of
>      this pattern.
>
>      Issue identified with Coccinelle.
>
>      Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
>      Acked-by: Neil Armstrong <narmstrong@baylibre.com>
>      Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
>      Link: https://patchwork.freedesktop.org/patch/msgid/20200909190213.156302-1-alex.dewar90@gmail.com
>
> Neil
Sorry! My bad. Thanks for applying :)

Alex

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

end of thread, other threads:[~2020-09-21 10:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-09 19:02 [PATCH] drm/bridge: dw-mipi-dsi: Use kmemdup cf. kmalloc+memcpy Alex Dewar
2020-09-11 12:57 ` Neil Armstrong
2020-09-19 19:31   ` Alex Dewar
2020-09-20  8:24     ` Daniel Vetter
2020-09-21  9:55       ` Neil Armstrong
2020-09-21  9:58       ` Neil Armstrong
2020-09-21 10:13         ` Alex Dewar

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