Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp547216pxk; Wed, 9 Sep 2020 12:04:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzotqGbX5/6L9xUjHuE7w92kaITkycEoS+VNo0N+x9zAYGH9R8jhQnCUOT9gm59BQoUQ27X X-Received: by 2002:a17:907:648:: with SMTP id wq8mr5330878ejb.291.1599678251746; Wed, 09 Sep 2020 12:04:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599678251; cv=none; d=google.com; s=arc-20160816; b=zR2O5cTw/of7clr9DTqHEOzNtnjEmf7mfPCdCO9i5rTLE9k0RaSroV9XCyfvQrLb+l XnRwvfqIkA/T0hO0r5jZYGoOpiYZiC5ds9FQLhHEPC3bI/R69LeoeuVDLS8Q/U8oLw6h oTjhZ9y+9De6X195fOz515mAoHn8VDB0xdsIxmM1pSlSNZHJcpAuAfjHTEjmfUdadld1 x4JhJBQO9aTAM7PwzOB7gZO3L4iekBJINJ38+AUsEXBvfAA4IMmhH5qQy2bhC6Wf3qFM qKSKlv/DrDQyxfxeCreu2cfmBEDZUs9EJzuaTqw2Yfbs6H1wGW9oXnJCOhrH+1uSrPxq Q8cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=C5BanKhi0v3vlOO/CZA+lZIZgxy5a1H/JGqfzet+ZBg=; b=hrCWriGKbrsBrz7h4lVe07vlKJO/e4KjhaaT83TDKFCy7cxBRpN9EExLqwRBvk+Q2l nUGTS6psXMfAxzTvwByUkqG8PR3QXbAwDbJwj24A3t/OTgbG6wnN8S0r5hTedJ1y+uGA u4NsyERLODsk++If8U8/IyRJgkX97kSx/VTBxGxOcjczZcAyHEISMfHdUYMHNwYgpT6v sCoo2O/oefL1eFlc0a+oKHhWlEGwL7+e5G8ThgNZ6r2UPGUjF87446hsptSci9vM9n7P auK2jWX5IE1cLB2wmq0WlYlc9IEI9NitW0Eh2Tn0D+3ARBjgJ9mtOcTEOheN1z56SmCT K19w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="tUgY/1fY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g17si1892175eji.729.2020.09.09.12.03.48; Wed, 09 Sep 2020 12:04:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="tUgY/1fY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726605AbgIITCV (ORCPT + 99 others); Wed, 9 Sep 2020 15:02:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725772AbgIITCU (ORCPT ); Wed, 9 Sep 2020 15:02:20 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6950EC061573 for ; Wed, 9 Sep 2020 12:02:20 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id l9so3456231wme.3 for ; Wed, 09 Sep 2020 12:02:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=C5BanKhi0v3vlOO/CZA+lZIZgxy5a1H/JGqfzet+ZBg=; b=tUgY/1fYk5Kq+fvcwA0lHtkxZI0KcXPOUUiv4CLIsFYUhCg36sr+Nu8GRq1dChywgY QBMR7qdX/I7qDOmqr8bCf4B9leYrX1WtA2xyeWik/zA4Us606HG9fnd6hfalnKmI5oci 5nRh8wK64RyBxLekIAcJAgErFVGD5flo5WayxD/DttKWoOWg+fDFV8aR0eNnuL0cvsUz 2g2wZv6SB7E+4or2hdOgLwXymUHPSaRNeTk5BYHNGpSAIQVJ5F/5YdUaXaFhZAXPmII3 BPx4ZO1KfaR9PIfDIcoYu95JjFt9lcJj8cUjkvJ5cM8RH9E3quhwUpaHtNPjDmy93/m9 5rHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=C5BanKhi0v3vlOO/CZA+lZIZgxy5a1H/JGqfzet+ZBg=; b=qhfke4C1ty/HElynt0BF4lrnnt1/fkA9g6dUjswc0ZC7ZtWGV9HXvmuVFEiHiQqolO dvDoANjLVT7r2jATDCqqre+rhifOzG96wl8f63HSvvv1W8Hxp+4YHxj/ebbrYDnN7S7r XwbzDhgBDzcHHqV3mD3bi4mU6QsvaYrjKc574ji8Q1NaK5PS3VZF2s4jdr8Xm2uYBTsA WLZYm/eH+mStqa3eP1GYI7S7J9MptGDcyzsp6wE20PrK6tm2eZnBSUKXIk12N9NZ9e9r i/pkcEADzJ3lXvitLBv8ID1ikhRhbjKt+P6iNIqah50xKXkUkwyxWbITAwlvgtybX1EX DeDA== X-Gm-Message-State: AOAM53158p2Qp7hd3vCi82bfdqG9KQLSbnNduVnpM+mBaqPyETizlvx7 XTS5er/P0/UipQJciKelWJM= X-Received: by 2002:a1c:5641:: with SMTP id k62mr5238839wmb.13.1599678139157; Wed, 09 Sep 2020 12:02:19 -0700 (PDT) Received: from localhost.localdomain (cpc83661-brig20-2-0-cust443.3-3.cable.virginm.net. [82.28.105.188]) by smtp.gmail.com with ESMTPSA id f23sm593788wmc.3.2020.09.09.12.02.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Sep 2020 12:02:18 -0700 (PDT) From: Alex Dewar Cc: Alex Dewar , Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , Philippe Cornu , =?UTF-8?q?Yannick=20Fertr=C3=A9?= , Antonio Borneo , Heiko Stuebner , Angelo Ribeiro , Markus Elfring , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/bridge: dw-mipi-dsi: Use kmemdup cf. kmalloc+memcpy Date: Wed, 9 Sep 2020 20:02:08 +0100 Message-Id: <20200909190213.156302-1-alex.dewar90@gmail.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org kmemdup can be used instead of kmalloc+memcpy. Replace an occurrence of this pattern. Issue identified with Coccinelle. Signed-off-by: Alex Dewar --- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index 52f5c5a2ed64..7e9a62ad56e8 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -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], -- 2.28.0