Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752094AbbHGIOA (ORCPT ); Fri, 7 Aug 2015 04:14:00 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:21605 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755608AbbHGIAf (ORCPT ); Fri, 7 Aug 2015 04:00:35 -0400 X-AuditID: cbfec7f4-f79c56d0000012ee-6c-55c465a15845 From: Andrzej Hajda To: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , David Airlie Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH 12/31] drm/amdgpu: use kmemdup rather than duplicating its implementation Date: Fri, 07 Aug 2015 09:59:18 +0200 Message-id: <1438934377-4922-13-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1438934377-4922-1-git-send-email-a.hajda@samsung.com> References: <1438934377-4922-1-git-send-email-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprJLMWRmVeSWpSXmKPExsVy+t/xK7oLU4+EGpz6KGxxa905VovecyeZ LKbd2c1qsXHGelaLt/eBrCtf37NZXN41h81i7ZG77A4cHq2X/rJ5bP/2gNXjfvdxJo++LasY PT5vkgtgjeKySUnNySxLLdK3S+DKOPb0NlPBY/aK899PsDUwXmTrYuTgkBAwkXh6x7OLkRPI FJO4cG89UJiLQ0hgKaPEu1/fWCCcJiaJaTdeMYNUsQloSvzdfBOsSkRgAqPE46UT2UEcZoHz jBKdnV1MIFXCAtESHY82MYKsYBFQlfg5wwQkzCvgLDH30ScmiHVyEiePTWYFsTmB4iu7Z4LZ QgJOEm/6LjBPYORdwMiwilE0tTS5oDgpPddQrzgxt7g0L10vOT93EyMkwL7sYFx8zOoQowAH oxIPb8K/w6FCrIllxZW5hxglOJiVRHgf6gOFeFMSK6tSi/Lji0pzUosPMUpzsCiJ887d9T5E SCA9sSQ1OzW1ILUIJsvEwSnVwJj3yFJF583tk0ybpRkC7sp//JgyUddb6877zfc2mlm6X9/s d1TC8ZrE2YYcSdHAxaWK97RjSpfpH5Pfd3ytxqWD4X/ecd/+8+LI9zyVb+qKrS8NlOOiTqiK NNnZTVk08djtg43fjTvyr5a/1fm0acObA8XJe697pQWqrHf/b6TiZyq0zOhJj48SS3FGoqEW c1FxIgB3ij45LAIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1209 Lines: 36 The patch was generated using fixed coccinelle semantic patch scripts/coccinelle/api/memdup.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2014320 Signed-off-by: Andrzej Hajda --- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index 8da6424..94bd992 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c @@ -549,12 +549,10 @@ int amdgpu_bo_set_metadata (struct amdgpu_bo *bo, void *metadata, if (metadata == NULL) return -EINVAL; - buffer = kzalloc(metadata_size, GFP_KERNEL); + buffer = kmemdup(metadata, metadata_size, GFP_KERNEL); if (buffer == NULL) return -ENOMEM; - memcpy(buffer, metadata, metadata_size); - kfree(bo->metadata); bo->metadata_flags = flags; bo->metadata = buffer; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/