From patchwork Sun Mar 11 23:19:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 10274969 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DC09860233 for ; Sun, 11 Mar 2018 23:20:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA4E12889D for ; Sun, 11 Mar 2018 23:20:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B911728C5D; Sun, 11 Mar 2018 23:20:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2F9CC2889D for ; Sun, 11 Mar 2018 23:20:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=796Qze4RTdP7BE6F2Jy7WhOIPs0Slfy9PaVbojkrKoQ=; b=Y/z OsK65AEtoKmdeJsfY2ZZvb17mWiF2puMCT8Dk4oTY+edZtEZNcyKKEiVs3suPqcV+oa8A2M7otorn 4eYxfATFeERFglAJBvTsli3r501nv9VUyPYaqtUnGulEf9XG5F9cDbTZhNSpP2qQ6gK8B/+q+wyj+ rItHfieEg+WXSdNBIQYyXMhpI5ryz6y6me6QPhNDsGJ4TZu976QmuMxm5Nb2PU0CH222pjA56MdXe vTPhhB7xm6oe9SKExDym8Izd3LRq3U15mAZlsUazelsYwu+uf+A51Ikh9NDzcdwEaJoZc/Q/IdXVu pD4CMN1R6b38e6Kytw4+M24GZs4VMbQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1evAG9-0005pZ-M5; Sun, 11 Mar 2018 23:20:09 +0000 Received: from mail-qk0-x242.google.com ([2607:f8b0:400d:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1evAG5-0005Mm-0t for linux-arm-kernel@lists.infradead.org; Sun, 11 Mar 2018 23:20:06 +0000 Received: by mail-qk0-x242.google.com with SMTP id o184so4483629qkd.13 for ; Sun, 11 Mar 2018 16:19:53 -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; bh=uaeLcqvOyuygkAKuoCzZv92E3Z/CdzAVGkHYKUYWHVk=; b=RVpDJiaNPmH1kwXODFMJ4cY4EviT7pnkvgzrO19r112n+bSKbWZloMf77ShhzdqqQE vx61JPZGffS0ReyqcbmNLrkNoU0maG96QCMROAyfO/IxAMsPpaF3WA/uVzDVtuvGjgLk Sf8SVjMlfhIuu9J9v6XLdvmksfzwitMPAQxhQ6B1v9kBYh3FPHyWDuoBCYB5vuxE3lfg IWe3gyXvpry03oKMoTwOeDev46GMwqwAVzyHR4psUxa3HtF9W3QUgK15LcAFHd1uIKbv LIgiQ3rq+hTaDKgavIO58sZKgjGuCtUEjG6s8j74Ypr0WRj8XQIoSZykfvCJTPoFf4Ka CEMA== 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; bh=uaeLcqvOyuygkAKuoCzZv92E3Z/CdzAVGkHYKUYWHVk=; b=DG7eHRgi7ZXjDorPZ5uQRJtIgHZGeSnSt+uE3b8WoFSEhqQk851WFF/9Ph+5A+md0O ZrmdTML7pmg6rLSYzfKXBPh9fOyHHtpThFczZaw/HV5aqypzAP0hFKCjxh9T57yT2fyE Tit2xYhrScKhLi8ee/m5Zl10MoYYOlBGhWBn4JbO16wYvy3cXnZKXpyZTLTbBAwf5kTK JGbifUG2ThZRU+/8EQ0nJdxFSo8J/zZ/FR7m5jA3aL32uFw3TzFp0/N6mGsK6PXrIErf uISJmatDZ9jQsZj/8s8n7zcEiFKHViTluVEkM/rMGJ4wIHGRjAkZK6PmaXYIFwzDB8WB n3Bg== X-Gm-Message-State: AElRT7HQjNcjJ1Rj2JcITAFK0WxGqspkd3HChX/pEzstJMPolQlDK+jp AqR6UCh2AJGBT9muCtWyzMdy6g== X-Google-Smtp-Source: AG47ELubNdfPsWd3j8bZKA7ZRcVfsKG+edrv0cWMD8BF8iUCNMqT+czQJXEs9TFNjZXEF/ABEznrRQ== X-Received: by 10.55.149.129 with SMTP id x123mr8483345qkd.254.1520810392872; Sun, 11 Mar 2018 16:19:52 -0700 (PDT) Received: from localhost.localdomain ([187.180.182.20]) by smtp.gmail.com with ESMTPSA id q10sm4611012qtk.25.2018.03.11.16.19.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 11 Mar 2018 16:19:52 -0700 (PDT) From: Fabio Estevam To: shawnguo@kernel.org Subject: [PATCH] soc: imx: gpc: Use kemdup() function Date: Sun, 11 Mar 2018 20:19:42 -0300 Message-Id: <1520810382-13341-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180311_162005_149805_D6761EBA X-CRM114-Status: GOOD ( 10.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fabio Estevam , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Fabio Estevam Use kmemdup() rather than duplicating its implementation. Detected with Coccinelle script. Signed-off-by: Fabio Estevam --- drivers/soc/imx/gpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/soc/imx/gpc.c b/drivers/soc/imx/gpc.c index 196f17b..cc3bad8 100644 --- a/drivers/soc/imx/gpc.c +++ b/drivers/soc/imx/gpc.c @@ -444,12 +444,12 @@ static int imx_gpc_probe(struct platform_device *pdev) if (domain_index >= of_id_data->num_domains) continue; - domain = kmalloc(sizeof(*domain), GFP_KERNEL); + domain = kmemdup(&imx_gpc_domains[domain_index], + sizeof(*domain), GFP_KERNEL); if (!domain) { of_node_put(np); return -ENOMEM; } - memcpy(domain, &imx_gpc_domains[domain_index], sizeof(*domain)); domain->regmap = regmap; domain->ipg_rate_mhz = ipg_rate_mhz;