Skip to content

Commit

Permalink
drm/nouveau/disp: switch to use kmemdup() helper
Browse files Browse the repository at this point in the history
Use kmemdup() helper instead of open-coding to
simplify the code.

Signed-off-by: Chen Haonan <chen.haonan2@zte.com.cn>
Reviewed-by: Yang Guang <yang.guang5@zte.com.cn>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/202401091424115185126@zte.com.cn
  • Loading branch information
Chen Haonan authored and Danilo Krummrich committed Jan 9, 2024
1 parent ca077ff commit 632ca3c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/gpu/drm/nouveau/nvif/outp.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,13 +452,12 @@ nvif_outp_edid_get(struct nvif_outp *outp, u8 **pedid)
if (ret)
goto done;

*pedid = kmalloc(args->size, GFP_KERNEL);
*pedid = kmemdup(args->data, args->size, GFP_KERNEL);
if (!*pedid) {
ret = -ENOMEM;
goto done;
}

memcpy(*pedid, args->data, args->size);
ret = args->size;
done:
kfree(args);
Expand Down

0 comments on commit 632ca3c

Please sign in to comment.