Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3098984imm; Sun, 13 May 2018 04:17:23 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqFZr2hOkGOSTrx+RjK55Qhbc2E3QYlt9Ge1XbCV1WpcJ0N2kgaIPoqJ2ghx07l4wyr50lW X-Received: by 2002:a63:aa07:: with SMTP id e7-v6mr548131pgf.331.1526210243803; Sun, 13 May 2018 04:17:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526210243; cv=none; d=google.com; s=arc-20160816; b=S1PDn+I07W8SMKoc8UcZZf2IwBnDP1erPvBXkN4KuaI+OKGkCDvK4Rw4k1IMdLZzuq cTJnuZ/Lg2JTF7pfb8XPE0zc7V+7QBKn8iKqd37oMbgKi4MAb7SLdLUn5a0p+MMLCT33 hhV2WiPK3wivPi1bYC/YgMe0Ch1ha+d7BBAtfXwJydbf15SRyBHc7g1jZ8hH+wN1Syg5 abAfJ9Bc97+mfIZi6nVcxXUssHVHNF+5x+fn0KyDt7bvJfDHTGoxF1PQyg3Fu6HLhPPK Nx3UOu5l488Owq4WCFZM6obaRLmsEgfsMbYnTEocBJryPqdkEFaFHRfxLBSb6Exh0RDa aHRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=QrVjqbKRWBZQuhy3wSC8zhYclJIWyvjrzgw8IQkw2Nk=; b=ZzuQMvNIO2sOO+BME12QxRacVfRuhxKK76c2mu7MHXKiwV1w7UnjG0lkpq6WVVvUzN enHQK3Z00woa6B+7NQLvfiWpSCSAswWdtpXREdL5VVVR7l1E5FAAp4NmGdHzmUZHnCzM nS/qPalCQA9ZnYVleXEMq+sepcr+yCxLFhcBNdib+LXOD4pu46qlA+j4vyDwQHuwgjOT Y76gDHzQYpE7tCR9ChFaO35Q3cwkMrha2b58MAmezlINuvE5wQz/hk9Euk8piBeBkNds zBwz2t1gRkGHuDE25dP/0NywzKCfN0E0rcr6D8AntgOzhs7Ni6liJVQenECeOdueZ3tV 3loQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p7-v6si6902651plk.293.2018.05.13.04.17.09; Sun, 13 May 2018 04:17:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751313AbeEMLRA (ORCPT + 99 others); Sun, 13 May 2018 07:17:00 -0400 Received: from smtp07.smtpout.orange.fr ([80.12.242.129]:50785 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750941AbeEMLQ6 (ORCPT ); Sun, 13 May 2018 07:16:58 -0400 Received: from ubuntu-CJ.home ([86.244.116.1]) by mwinf5d13 with ME id lnGu1x00901t9Ri03nGv2H; Sun, 13 May 2018 13:16:57 +0200 X-ME-Helo: ubuntu-CJ.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 13 May 2018 13:16:57 +0200 X-ME-IP: 86.244.116.1 From: Christophe JAILLET To: mturquette@baylibre.com, sboyd@kernel.org, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] clk: stm32mp1: Fix a memory leak in 'clk_stm32_register_gate_ops()' Date: Sun, 13 May 2018 13:17:04 +0200 Message-Id: <20180513111704.31842-1-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We allocate some memory which is neither used, nor referenced by anything. So axe it. Signed-off-by: Christophe JAILLET --- This patch as not been compile-tested, I don't have the corresponding arch and have not taken time to cross-compile it. --- drivers/clk/clk-stm32mp1.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/clk/clk-stm32mp1.c b/drivers/clk/clk-stm32mp1.c index edd3cf451401..dfb9cb5bd0c4 100644 --- a/drivers/clk/clk-stm32mp1.c +++ b/drivers/clk/clk-stm32mp1.c @@ -579,14 +579,9 @@ clk_stm32_register_gate_ops(struct device *dev, spinlock_t *lock) { struct clk_init_data init = { NULL }; - struct clk_gate *gate; struct clk_hw *hw; int ret; - gate = kzalloc(sizeof(*gate), GFP_KERNEL); - if (!gate) - return ERR_PTR(-ENOMEM); - init.name = name; init.parent_names = &parent_name; init.num_parents = 1; @@ -604,10 +599,8 @@ clk_stm32_register_gate_ops(struct device *dev, hw->init = &init; ret = clk_hw_register(dev, hw); - if (ret) { - kfree(gate); + if (ret) hw = ERR_PTR(ret); - } return hw; } -- 2.17.0