From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 030A8C433DB for ; Sun, 14 Mar 2021 09:42:17 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 955B764EBD for ; Sun, 14 Mar 2021 09:42:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 955B764EBD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:References: Cc:To:From:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zUWpuctqmkwIx0CK2n6SjwtJsk9I7KWNzFxOxwaRYQU=; b=o8AAl7VPiVna5QuXZD1XtlenI fGADCksGQ4lWCjlV6Bk0sx2iseGQZos78hK33HdPvkt9gsL6/wZN8z2pGywkTRtMqLc2oz4au9Hut Knmm+hLRTNU5e2mDVBNf8yKI7yiuic/6o0zq+uziq4XfpWPOsyMtgBh1yarvuj8juzHeiXyLvcsA4 d4nu9g40eMgieBKXCzAq8Bgm9NJTGh76S8z7aHDCLgNVcljVVDXgEG295J298zxgtqDID87iO1Jli k1L07tD2jyRs7hZQirXK3hRVSz0m4RJK/Uw0DHJQstHwYm3QlAoq6a5afpddEyXR7FmjnNbS584mf 1FjxjdEGw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lLNEg-00E55p-P5; Sun, 14 Mar 2021 09:40:35 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lLNEc-00E55T-Ke for linux-arm-kernel@lists.infradead.org; Sun, 14 Mar 2021 09:40:32 +0000 Received: from gallifrey.ext.pengutronix.de ([2001:67c:670:201:5054:ff:fe8d:eefb] helo=[IPv6:::1]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1lLNEb-0000iR-MW; Sun, 14 Mar 2021 10:40:29 +0100 Subject: Re: [PATCH V4] clk: imx: Fix reparenting of UARTs not associated with stdout From: Ahmad Fatoum To: Adam Ford , linux-clk@vger.kernel.org Cc: Aisheng Dong , Linus Walleij , Abel Vesa , Stephen Boyd , Fabio Estevam , Michael Turquette , aford@beaconembedded.com, linux-kernel@vger.kernel.org, NXP Linux Team , Pengutronix Kernel Team , Shawn Guo , Sascha Hauer , linux-arm-kernel@lists.infradead.org, Jerome Brunet References: <20210313122818.445228-1-aford173@gmail.com> Message-ID: <0361ab5b-a26e-7631-9bae-8909715f6354@pengutronix.de> Date: Sun, 14 Mar 2021 10:40:24 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: a.fatoum@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210314_094030_813703_6F654B19 X-CRM114-Status: GOOD ( 16.74 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 13.03.21 16:16, Ahmad Fatoum wrote: >> +/* i.MX boards use device trees now. For build tests without CONFIG_OF, do nothing */ >> +#ifdef CONFIG_OF >> if (imx_keep_uart_clocks) { >> int i; >> >> - imx_uart_clocks = clks; >> - for (i = 0; imx_uart_clocks[i]; i++) >> - clk_prepare_enable(*imx_uart_clocks[i]); >> + imx_uart_clocks = kcalloc(clk_count, sizeof(struct clk *), GFP_KERNEL); >> + >> + if (!of_stdout) >> + return; > > Memory leak. Just do if (imx_keep_uart_clocks && of_stdout) Please dismiss. I overlooked that you free it in a later initcall. >> static int __init imx_clk_disable_uart(void) >> { >> - if (imx_keep_uart_clocks && imx_uart_clocks) { >> + if (imx_keep_uart_clocks && imx_enabled_uart_clocks) { >> int i; >> >> - for (i = 0; imx_uart_clocks[i]; i++) >> - clk_disable_unprepare(*imx_uart_clocks[i]); >> + for (i = 0; i < imx_enabled_uart_clocks; i++) { >> + clk_disable_unprepare(imx_uart_clocks[i]); >> + clk_put(imx_uart_clocks[i]); >> + }; >> + kfree(imx_uart_clocks); >> } -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel