Commit 632ca3c9 authored by Chen Haonan's avatar Chen Haonan Committed by Danilo Krummrich

drm/nouveau/disp: switch to use kmemdup() helper

Use kmemdup() helper instead of open-coding to
simplify the code.
Signed-off-by: default avatarChen Haonan <chen.haonan2@zte.com.cn>
Reviewed-by: default avatarYang Guang <yang.guang5@zte.com.cn>
Reviewed-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarDanilo Krummrich <dakr@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/202401091424115185126@zte.com.cn
parent ca077ff8
...@@ -452,13 +452,12 @@ nvif_outp_edid_get(struct nvif_outp *outp, u8 **pedid) ...@@ -452,13 +452,12 @@ nvif_outp_edid_get(struct nvif_outp *outp, u8 **pedid)
if (ret) if (ret)
goto done; goto done;
*pedid = kmalloc(args->size, GFP_KERNEL); *pedid = kmemdup(args->data, args->size, GFP_KERNEL);
if (!*pedid) { if (!*pedid) {
ret = -ENOMEM; ret = -ENOMEM;
goto done; goto done;
} }
memcpy(*pedid, args->data, args->size);
ret = args->size; ret = args->size;
done: done:
kfree(args); kfree(args);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment