From patchwork Thu Dec 23 15:42:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Conor Dooley X-Patchwork-Id: 12698453 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C5E9DC433F5 for ; Thu, 23 Dec 2021 15:42:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :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=f2kg7xk3F0o4G9In//fExESKyFbfZsT+Xfj5gvmabP0=; b=ANOTF6pQ0o8uXi LtOybh9y6La5789ZxAp7kKSnRdyA1oFbkaye0Pfqbkn5mpQ7y4492QsUWdRHDach2mjpuMXrgQFsp yHKbxVEQGf940Hp+SREYDIkW/vw4YbOi8I/xOI/eXw4LJy4N9ZtbPSSvjobnCx047vBeqTSqQw4ky s1SINSvwA1V2iQlmyAAQBX2+ybZjA6NZ2/MjXveIQZuOtLEjFeH6Nbqw4LSel4aJuOyoYMoi0MxzJ BxqYsY++LMbMwYwWR3dSPxADsmLQNVSysE2TZOIQWRD/Opx6SHR4lk4pu+rSa9rqFi65sMnLlJtPj 75VENtzmwU4fnLsEdmAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n0QD9-00CySO-VN; Thu, 23 Dec 2021 15:40:56 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n0QD6-00CyRd-Km for linux-arm-kernel@lists.infradead.org; Thu, 23 Dec 2021 15:40:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1640274052; x=1671810052; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=YcN1nSjIyeMlPtXRTSvXWfI2gE85Pz9oyuBbS0L9t3o=; b=QnzY7xZzYHD22XQJxYKtLp3ZoobkYTwiFQNvceiFsY8fvC/s6kty1UWm sqWJB9pkp8wU0ZurGOPI16tREFcoYDbGSl80E89i+dMWYb7xYPEXF82Xh FVnPiZ+E4rJaChP6rMuNWwebbvF0og+cYNng4v09pX6QX55a2bD8qmqGo B4N9GhCenjwWVUlA/xqoFiqmWodbjk6ykDs4UR49FpjwDHvYvU5NUMeyi 7fZktGCRwhAoDbdA/FY32o/dPMbDCYdfYqf+H6I8QigiHYJKicVha+Z1h jHN2T2PMEkhlJjB1GYn5domLEWxwUQNT+4mQvGYkwdQfYIxAywnLnEdbI g==; IronPort-SDR: 0a4KLaVZrN1JIu1Ug/vccFTYr2vwezpVcKJMBevxA2bKYV8aihzvV2pCCE612j4nGy/q/abjem yNDOpvQXvIc8AQW8i/SPJzlKtZn367ufgX8EyGMiT3Cve142VanXM1Ugu5BQAwEJ8PJ9bjS6vx Vxka0pr6tWiupKti87yictTNSbJPNHOc9XLuvLDagUf5kOhzoi8/wtpCMIsbwOKUNt7i0ePTI5 aPlZu8RD0SjPNNwfj/LXqJpzRnuIyCaeoNFCIB3T0uuQ0UYmRz4g9aeiCJDEpDmzsHkv6hXe+1 RQQgrAwNpsxeaEMqUX9xsAkB X-IronPort-AV: E=Sophos;i="5.88,229,1635231600"; d="scan'208";a="140721431" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 23 Dec 2021 08:40:51 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Thu, 23 Dec 2021 08:40:50 -0700 Received: from wendy.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Thu, 23 Dec 2021 08:40:49 -0700 From: To: , , , CC: , , , , Conor Dooley Subject: [PATCH] clk: bm1880: remove kfrees on static allocations Date: Thu, 23 Dec 2021 15:42:44 +0000 Message-ID: <20211223154244.1024062-1-conor.dooley@microchip.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211223_074052_793059_F30A42BD X-CRM114-Status: UNSURE ( 8.15 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Conor Dooley bm1880_clk_unregister_pll & bm1880_clk_unregister_div both try to free statically allocated variables, so remove those kfrees. For example, if we take L703 kfree(div_hw): - div_hw is a bm1880_div_hw_clock pointer - in bm1880_clk_register_plls this is pointed to an element of arg1: struct bm1880_div_hw_clock *clks - in the probe, where bm1880_clk_register_plls is called arg1 is bm1880_div_clks, defined on L371: static struct bm1880_div_hw_clock bm1880_div_clks[] Signed-off-by: Conor Dooley --- drivers/clk/clk-bm1880.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/drivers/clk/clk-bm1880.c b/drivers/clk/clk-bm1880.c index e6d6599d310a..fad78a22218e 100644 --- a/drivers/clk/clk-bm1880.c +++ b/drivers/clk/clk-bm1880.c @@ -522,14 +522,6 @@ static struct clk_hw *bm1880_clk_register_pll(struct bm1880_pll_hw_clock *pll_cl return hw; } -static void bm1880_clk_unregister_pll(struct clk_hw *hw) -{ - struct bm1880_pll_hw_clock *pll_hw = to_bm1880_pll_clk(hw); - - clk_hw_unregister(hw); - kfree(pll_hw); -} - static int bm1880_clk_register_plls(struct bm1880_pll_hw_clock *clks, int num_clks, struct bm1880_clock_data *data) @@ -555,7 +547,7 @@ static int bm1880_clk_register_plls(struct bm1880_pll_hw_clock *clks, err_clk: while (i--) - bm1880_clk_unregister_pll(data->hw_data.hws[clks[i].pll.id]); + clk_hw_unregister(data->hw_data.hws[clks[i].pll.id]); return PTR_ERR(hw); } @@ -695,14 +687,6 @@ static struct clk_hw *bm1880_clk_register_div(struct bm1880_div_hw_clock *div_cl return hw; } -static void bm1880_clk_unregister_div(struct clk_hw *hw) -{ - struct bm1880_div_hw_clock *div_hw = to_bm1880_div_clk(hw); - - clk_hw_unregister(hw); - kfree(div_hw); -} - static int bm1880_clk_register_divs(struct bm1880_div_hw_clock *clks, int num_clks, struct bm1880_clock_data *data) @@ -729,7 +713,7 @@ static int bm1880_clk_register_divs(struct bm1880_div_hw_clock *clks, err_clk: while (i--) - bm1880_clk_unregister_div(data->hw_data.hws[clks[i].div.id]); + clk_hw_unregister(data->hw_data.hws[clks[i].div.id]); return PTR_ERR(hw); }