[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20190601072208.193673-1-yuehaibing@huawei.com>
Date: Sat, 1 Jun 2019 07:22:08 +0000
From: YueHaibing <yuehaibing@...wei.com>
To: <harry.wentland@....com>, <sunpeng.li@....com>,
<alexander.deucher@....com>, <christian.koenig@....com>,
<David1.Zhou@....com>, <airlied@...ux.ie>, <daniel@...ll.ch>,
<hanghong.ma@....com>, <Jun.Lei@....com>, <Wenjing.Liu@....com>,
<Krunoslav.Kovac@....com>, <nicholas.kazlauskas@....com>,
<David.Francis@....com>, <Bhawanpreet.Lakha@....com>
CC: YueHaibing <yuehaibing@...wei.com>,
<amd-gfx@...ts.freedesktop.org>, <dri-devel@...ts.freedesktop.org>,
<linux-kernel@...r.kernel.org>, <kernel-janitors@...r.kernel.org>
Subject: [PATCH -next] drm/amd/display: Use kmemdup in dc_copy_stream()
Use kmemdup rather than duplicating its implementation.
Detected by coccinelle.
Signed-off-by: YueHaibing <yuehaibing@...wei.com>
---
drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
index a002e690814f..b166c732b532 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
@@ -167,12 +167,11 @@ struct dc_stream_state *dc_copy_stream(const struct dc_stream_state *stream)
{
struct dc_stream_state *new_stream;
- new_stream = kzalloc(sizeof(struct dc_stream_state), GFP_KERNEL);
+ new_stream = kmemdup(stream, sizeof(struct dc_stream_state),
+ GFP_KERNEL);
if (!new_stream)
return NULL;
- memcpy(new_stream, stream, sizeof(struct dc_stream_state));
-
if (new_stream->sink)
dc_sink_retain(new_stream->sink);
Powered by blists - more mailing lists