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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux