From patchwork Tue Sep 20 11:08:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 9341481 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 2B0DC607D0 for ; Tue, 20 Sep 2016 11:09:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 19CCC29521 for ; Tue, 20 Sep 2016 11:09:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0EAF729553; Tue, 20 Sep 2016 11:09:58 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 A941529521 for ; Tue, 20 Sep 2016 11:09:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752901AbcITLJ5 (ORCPT ); Tue, 20 Sep 2016 07:09:57 -0400 Received: from mail-qk0-f196.google.com ([209.85.220.196]:34164 "EHLO mail-qk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751563AbcITLJ4 (ORCPT ); Tue, 20 Sep 2016 07:09:56 -0400 Received: by mail-qk0-f196.google.com with SMTP id b204so847809qkc.1; Tue, 20 Sep 2016 04:09:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=42i27QbGjDtBNRibg89YgWnWX+xvl2hRMxuOFhjb5R8=; b=x7GP169NIBB31Phoc/07s/iOWefBFsBopo/UOCFOwXDjY2SDDnrvQ8wp/QSsit9asY EXqmrVcTv7tvzSSXR2avsOt9Wjllshz8xv3avEMXz7jouPmXo4sGXNSAXjfEhTXG0tns 4zpE2N+Ifgy7XRQZttT8F9A4/XI0qgJymNTpEixYBL8SidS1blG6lKbgzAbQPkhkr64L FSs/d0WLm2IPHhtOs0baIRzDT5MGKv3NqpJ9xBSX1Px1EHBB7aUM+FB1/LKeeqlkbDg9 01J4v5BjJBu/pbnCwcVmHO6mf9gBO5NasMlbm5KRRQ7M/87+d5XdY5pEIg4UC+I6uS8a QjPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=42i27QbGjDtBNRibg89YgWnWX+xvl2hRMxuOFhjb5R8=; b=aWK4F3hScy2uFo6C4t/rzDEElLe1VfnzQiSWbE7PebpqiQPDKGWI64mvUQaRsMffW3 EcyoIsAKWND3MLdTBFZZclVQPZTFzQvlmaQ0pZOyQRTDxLmYMEoVi7HElBtNF2NlR499 EU2iF6W23SqyMVDpyCvhX0LhBEs85PjU+ahTzKdJ16h7K0dDnlI5cRkg0P0D6m8udcMk 8PyCBNjcC7tLSfaAmsMC7AKNiCefGRJY5doH5cYZdlBLlfscRSQrDE9aWFkyWk1RuIS3 9q1sBJ6lKobrlyZx2Mp9X7IuY+MVq1Elwn7Ka3VG+Bl1MTsZP/XThDlxz6Nx4BS0wf7y z1Qg== X-Gm-Message-State: AE9vXwNNn0tn1XUY/Ix3pk3iD2UYI1MqvHV5BnX7EOkuX7U64WiMaj8nTpt9fFX6u+4Odg== X-Received: by 10.55.186.65 with SMTP id k62mr33901130qkf.204.1474369795553; Tue, 20 Sep 2016 04:09:55 -0700 (PDT) Received: from symbol-HP-Z420-Workstation.symbol.com ([140.101.159.242]) by smtp.googlemail.com with ESMTPSA id k65sm15740622qkf.7.2016.09.20.04.09.52 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Sep 2016 04:09:55 -0700 (PDT) From: Arvind Yadav X-Google-Original-From: Arvind Yadav To: mturquette@baylibre.com, sboyd@codeaurora.org Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Arvind Yadav Subject: [v2] clk:mmp:clk-of-mmp2: Free memory and Unmap region obtained by kzalloc and of_iomap Date: Tue, 20 Sep 2016 16:38:58 +0530 Message-Id: <1474369738-16140-1-git-send-email-arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 1.7.9.5 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 From: Arvind Yadav Free memory and memory mapping , if mmp2_clk_init is not successful. Signed-off-by: Arvind Yadav --- drivers/clk/mmp/clk-of-mmp2.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/clk/mmp/clk-of-mmp2.c b/drivers/clk/mmp/clk-of-mmp2.c index 3a51fff..2376d28 100644 --- a/drivers/clk/mmp/clk-of-mmp2.c +++ b/drivers/clk/mmp/clk-of-mmp2.c @@ -309,21 +309,23 @@ static void __init mmp2_clk_init(struct device_node *np) pxa_unit->mpmu_base = of_iomap(np, 0); if (!pxa_unit->mpmu_base) { pr_err("failed to map mpmu registers\n"); - return; + goto free_memory; } pxa_unit->apmu_base = of_iomap(np, 1); if (!pxa_unit->mpmu_base) { pr_err("failed to map apmu registers\n"); - return; + goto unmap_mpmu_region; } pxa_unit->apbc_base = of_iomap(np, 2); if (!pxa_unit->apbc_base) { pr_err("failed to map apbc registers\n"); - return; + goto unmap_apmu_region; } + return; + mmp_clk_init(np, &pxa_unit->unit, MMP2_NR_CLKS); mmp2_pll_init(pxa_unit); @@ -333,6 +335,13 @@ static void __init mmp2_clk_init(struct device_node *np) mmp2_axi_periph_clk_init(pxa_unit); mmp2_clk_reset_init(np, pxa_unit); + +unmap_apmu_region: + iounmap(pxa_unit->apmu_base); +unmap_mpmu_region: + iounmap(pxa_unit->mpmu_base); +free_memory: + kfree(pxa_unit); } CLK_OF_DECLARE(mmp2_clk, "marvell,mmp2-clock", mmp2_clk_init);