From patchwork Mon Oct 24 20:43:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 9393233 X-Patchwork-Delegate: sboyd@codeaurora.org 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 B02B06077A for ; Mon, 24 Oct 2016 20:44:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A18DB2574A for ; Mon, 24 Oct 2016 20:44:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 96747288CD; Mon, 24 Oct 2016 20:44:16 +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=-6.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 429302574A for ; Mon, 24 Oct 2016 20:44:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757624AbcJXUnu (ORCPT ); Mon, 24 Oct 2016 16:43:50 -0400 Received: from smtp10.smtpout.orange.fr ([80.12.242.132]:18364 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757597AbcJXUns (ORCPT ); Mon, 24 Oct 2016 16:43:48 -0400 Received: from localhost.localdomain ([92.140.170.6]) by mwinf5d87 with ME id zYjV1t00A08dmlo03YjhJK; Mon, 24 Oct 2016 22:43:42 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 24 Oct 2016 22:43:42 +0200 X-ME-IP: 92.140.170.6 From: Christophe JAILLET To: lars@metafoo.de, dan.carpenter@oracle.com, ssantosh@kernel.org, mturquette@baylibre.com, sboyd@codeaurora.org Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH 3/3] clk: keystone: Fix missing iounmap calls in an error handling path Date: Mon, 24 Oct 2016 22:43:26 +0200 Message-Id: <7ed7c1abf1666f1e6eda240bb705940bc14bd186.1477339880.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.9.3 In-Reply-To: References: In-Reply-To: References: X-Antivirus: avast! (VPS 161024-1, 24/10/2016), Outbound message X-Antivirus-Status: Clean Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Factorize 'iounmap()' calls in the error handling path. The main goal is to add these calls if 'clk_register_pll()' fails. Add an error message if an 'of_iomap' call fails to be consistent. Signed-off-by: Christophe JAILLET --- Un-compiled & un-tested --- drivers/clk/keystone/pll.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/clk/keystone/pll.c b/drivers/clk/keystone/pll.c index 35c0e2b011d1..73a2558b29c0 100644 --- a/drivers/clk/keystone/pll.c +++ b/drivers/clk/keystone/pll.c @@ -191,7 +191,6 @@ static void __init _of_pll_clk_init(struct device_node *node, bool pllctrl) pll_data->pll_ctl0 = of_iomap(node, i); if (!pll_data->pll_ctl0) { pr_err("%s: ioremap failed\n", __func__); - iounmap(pll_data->pllod); goto out; } @@ -206,8 +205,7 @@ static void __init _of_pll_clk_init(struct device_node *node, bool pllctrl) i = of_property_match_string(node, "reg-names", "multiplier"); pll_data->pllm = of_iomap(node, i); if (!pll_data->pllm) { - iounmap(pll_data->pll_ctl0); - iounmap(pll_data->pllod); + pr_err("%s: ioremap failed\n", __func__); goto out; } } @@ -220,6 +218,12 @@ static void __init _of_pll_clk_init(struct device_node *node, bool pllctrl) out: pr_err("%s: error initializing pll %s\n", __func__, node->name); + if (pll_data->pllm) + iounmap(pll_data->pllm); + if (pll_data->pll_ctl0) + iounmap(pll_data->pll_ctl0); + if (pll_data->pllod) + iounmap(pll_data->pllod); kfree(pll_data); }