drm/bridge: dw-mipi-dsi: Use kmemdup cf. kmalloc+memcpy
Subsystems (3)
PATCH 1/1 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.
--- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +1 -3
@@ -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],
Signature · 1 line
2.28.0
Quoted 19 lines · Alex Dewar
kmemdup can be used instead of kmalloc+memcpy. Replace an occurrence of this pattern.
Issue identified with Coccinelle.
Signed-off-by Alex Dewar <[email protected]>--- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +0
-0@@ -1049,12 +1049,10 @@ static void debugfs_create_files(void *data) };int i;
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c static void debugfs_create_files(void *data) · line 1058
Quoted 10 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +1
-3- 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],
Thanks,
Neil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 3 lines · Neil Armstrong
Quoted 2 lines · Alex Dewar
kmemdup can be used instead of kmalloc+memcpy. Replace an occurrence of this pattern.
Friendly ping?
Quoted 31 lines
Quoted 17 lines
Issue identified with Coccinelle.
Signed-off-by Alex Dewar <[email protected]>--- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +0
-0@@ -1049,12 +1049,10 @@ static void debugfs_create_files(void *data) };int i;drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c static void debugfs_create_files(void *data) · line 1058
Quoted 10 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +1
-3- 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 <[email protected]>Thanks,
Neil
Quoted 34 lines · Alex Dewar
Quoted 3 lines · Neil Armstrong
Quoted 2 lines · Alex Dewar
kmemdup can be used instead of kmalloc+memcpy. Replace an occurrence of this pattern.
Friendly ping?
Quoted 28 lines
Quoted 17 lines
Issue identified with Coccinelle.
Signed-off-by Alex Dewar <[email protected]>--- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +0
-0@@ -1049,12 +1049,10 @@ static void debugfs_create_files(void *data) };int i;drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c static void debugfs_create_files(void *data) · line 1058
Quoted 10 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +1
-3- 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 <[email protected]>
Neil has commit rights, so I was assuming he'd push this to drm-misc-next. -Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Quoted 36 lines · Daniel Vetter
Quoted 34 lines · Alex Dewar
Quoted 3 lines · Neil Armstrong
Quoted 2 lines · Alex Dewar
kmemdup can be used instead of kmalloc+memcpy. Replace an occurrence of this pattern.
Friendly ping?
Quoted 28 lines
Quoted 17 lines
Issue identified with Coccinelle.
Signed-off-by Alex Dewar <[email protected]>--- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +0
-0@@ -1049,12 +1049,10 @@ static void debugfs_create_files(void *data) };int i;drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c static void debugfs_create_files(void *data) · line 1058
Quoted 10 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +1
-3- 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 <[email protected]>
Quoted 3 lines
Neil has commit rights, so I was assuming he'd push this to drm-misc-next. -Daniel
Applying now,
Neil
Neil Armstrong
Acked-byQuoted 36 lines · Daniel Vetter
Quoted 34 lines · Alex Dewar
Quoted 3 lines · Neil Armstrong
Quoted 2 lines · Alex Dewar
kmemdup can be used instead of kmalloc+memcpy. Replace an occurrence of this pattern.
Friendly ping?
Quoted 28 lines
Quoted 17 lines
Issue identified with Coccinelle.
Signed-off-by Alex Dewar <[email protected]>--- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +0
-0@@ -1049,12 +1049,10 @@ static void debugfs_create_files(void *data) };int i;drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c static void debugfs_create_files(void *data) · line 1058
Quoted 10 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +1
-3- 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 <[email protected]>
Quoted 3 lines
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 <[email protected]> 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.
Neil
Quoted 11 lines
Hmm, I applied this already:
commit33f290811d4c1a09c4e92f5bf0458525835dbcbaAuthor: Alex Dewar <[email protected]> Date: Wed Sep 9 20:02:08 2020 +0100drm/bridge: dw-mipi-dsi: Use kmemdup cf. kmalloc+memcpy
kmemdup can be used instead of kmalloc+memcpy. Replace an occurrence of this pattern.
Quoted 8 lines
Issue identified with Coccinelle.
Signed-off-by Alex Dewar <[email protected]>Acked-by Neil Armstrong <[email protected]>Signed-off-by Neil Armstrong <[email protected]>Neil
Sorry! My bad. Thanks for applying :)
Alex