Skip to content

Commit

Permalink
drm/bridge: dw-mipi-dsi: Use kmemdup cf. kmalloc+memcpy
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Alex Dewar authored and Neil Armstrong committed Sep 11, 2020
1 parent 48e07c2 commit 33f2908
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down

0 comments on commit 33f2908

Please sign in to comment.