From patchwork Tue Sep 20 10:18:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 9341403 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 E5F2E6077A for ; Tue, 20 Sep 2016 10:19:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D711029E7B for ; Tue, 20 Sep 2016 10:19:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CBCA729E7E; Tue, 20 Sep 2016 10:19:31 +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 727BE29E7B for ; Tue, 20 Sep 2016 10:19:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752075AbcITKTb (ORCPT ); Tue, 20 Sep 2016 06:19:31 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:32819 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751594AbcITKTa (ORCPT ); Tue, 20 Sep 2016 06:19:30 -0400 Received: by mail-pf0-f195.google.com with SMTP id q2so785241pfj.0; Tue, 20 Sep 2016 03:19:30 -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=i/gjcZPxN150ZFCMrsZHPjTKcWj97Vgz4ztGkMIH1Pw=; b=CJIO+HzfcheW/bnWO5nIPcNtNdTL8fzecVBrwHH1byXmfBgesI35+g198ZFQ366VTz yet38JkMvrh//tCYFY9j5o5ysur7XDsSHmXvmW+kT98sjU88iOR/isAXT7GwhFzA3Zm0 w3Q1EcAiom0GmN4Br/H03h8fyQJISbhE08WeL1P6z0UHMJcRG8QYtpoaRnoPXGT1N87P tcpJRk9t/nANzYMzhb/SYMWH8k828zAiR2pmoW3dbv5UifH7ts9lbTB7EdJtgS1a+L/s xHW7CllFKjxUzV5lMGZpafnl8PJkbcHZLh/tByI3tJBYYPF//QenlMVxLsHGfdUHayI6 NK3w== 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=i/gjcZPxN150ZFCMrsZHPjTKcWj97Vgz4ztGkMIH1Pw=; b=BUjfAdk+OOxyDN1r3ahaeArFzig6XzZidJVaNPLzB0njhxtpyNRmZUVu9m5DD9acYb iojhJWaB4CYGyg36hPOLSbvziXZ0RRQ+WY8AHCJmeIuA642AUUeZ/AiXGtDDKutQ/HPw 3n7N7yLGJYZGVdGAPmw0W+ckSbqfehQm1BOfBYxKEy57L6qtxjVrfTZ5+vKfj9npbAyF sdgCoY3nxGYpHuTapcBERVQQVCC5jL8x6zSod0ywN2hdb2+jjQVfvlVdAH1BPO29mTVD B2tkeEBg4Se+ISLkmdDJoQZzfvzW7ZQ1ILelCaCTvAAmCbEF4JDAiiY1KAfX0hE2EDlW UVFQ== X-Gm-Message-State: AE9vXwOFIOx5dE2SPuG+bHANlNcaVUsggzAtlIpo860iopumFpo6/YdvXHfVuhmINHeV3w== X-Received: by 10.98.103.193 with SMTP id t62mr51630274pfj.2.1474366769616; Tue, 20 Sep 2016 03:19:29 -0700 (PDT) Received: from symbol-HP-Z420-Workstation.symbol.com ([140.101.159.242]) by smtp.googlemail.com with ESMTPSA id 3sm77977869pfz.33.2016.09.20.03.19.27 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Sep 2016 03:19:28 -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: [PATCH] clk:mmp:clk-of-mmp2: Free memory and Unmap region obtained by kzalloc and of_iomap Date: Tue, 20 Sep 2016 15:48:35 +0530 Message-Id: <1474366715-15608-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 | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/clk/mmp/clk-of-mmp2.c b/drivers/clk/mmp/clk-of-mmp2.c index 3a51fff..3757287 100644 --- a/drivers/clk/mmp/clk-of-mmp2.c +++ b/drivers/clk/mmp/clk-of-mmp2.c @@ -309,19 +309,19 @@ 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; } mmp_clk_init(np, &pxa_unit->unit, MMP2_NR_CLKS); @@ -333,6 +333,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);