From patchwork Tue Sep 20 10:59:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 9341477 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 018A1607D0 for ; Tue, 20 Sep 2016 11:07:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E5FC229521 for ; Tue, 20 Sep 2016 11:07:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DAC3A2955C; Tue, 20 Sep 2016 11:07:51 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 6047029521 for ; Tue, 20 Sep 2016 11:07:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751579AbcITLBb (ORCPT ); Tue, 20 Sep 2016 07:01:31 -0400 Received: from mail-qk0-f194.google.com ([209.85.220.194]:34857 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751387AbcITLBa (ORCPT ); Tue, 20 Sep 2016 07:01:30 -0400 Received: by mail-qk0-f194.google.com with SMTP id w204so831497qka.2; Tue, 20 Sep 2016 04:01: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=VIPfDPxENbeEoFUpRU4WieIJbLmcNjr2DIsNCprY+BQ=; b=txCkqFe/9DmPhR7rfEaXPv6jlXYfIMT2M+dM+fkMVpP7aIccHDQb4lTjBsVIqa/E4w cg7SbfSTpx/cVxVnfFytgU4JDGIp6wrKZaD3nPogRsqxPIvlxKybPKklAmH7jKg2Lqn8 dJKpH2putvB3SzlSloW3aNe6a+uwbPw78JZmV9hyWqFRafebmGPrRbA+JF3tk96FQrGz IowclPJsr0KYncUm7PX+RzrFzmKA6+0G4EKJakJVI5g/9CRxZKEO6zfZ1kkawkGL7ztr rCGVAC/hBzzO2fFP0fOOW9WnFDgcMrxnYRqp9Mynk2Ekzj8vDiTjOcFXvOBw44S+r4jj cD1Q== 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=VIPfDPxENbeEoFUpRU4WieIJbLmcNjr2DIsNCprY+BQ=; b=UQcT+Dqn+IXQZVdAbOVACJhPsQf1ZtagE0pNLavayO1Q2Qnjh9/g3jBFUxRLrKrqga QHwfA5THaV3vAIsBRN/nZatdgAeZenktqCV7r5aAWrndrNhyguTuXPFFIDsJ8ElMNsqx 4TlhBJlP1hiRmuXlmIf0axGQeS5CVQgNVGV8UtWlfdhdz5lLCJJYmOZXbD/QNzxFG+1N 4F09m63GYmw/tK6lO32F+XNcdMadOPdpnDq9dquWuL53WMzO2eKbAWmrdQ09kd31vj4q UmC3DdbAi8OKeBPKnPZD0Xwackm69r+TwSEoqwP/VMHzkTSO8OSKjtIq4UNbjsqCe+vs crVw== X-Gm-Message-State: AE9vXwOoyLMr3nWawKocoaTbkOUfX246qEZwANJWJwvJmdU45VJeW5hOwP+6VccwMNzqdA== X-Received: by 10.55.48.9 with SMTP id w9mr33318606qkw.147.1474369234741; Tue, 20 Sep 2016 04:00:34 -0700 (PDT) Received: from symbol-HP-Z420-Workstation.symbol.com ([140.101.159.242]) by smtp.googlemail.com with ESMTPSA id c44sm15706653qta.49.2016.09.20.04.00.31 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Sep 2016 04:00:34 -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-pxa910: Free memory and Unmap region obtained by kzmalloc and of_iomap Date: Tue, 20 Sep 2016 16:29:38 +0530 Message-Id: <1474369178-16015-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 pxa910_clk_init is not successful. Signed-off-by: Arvind Yadav --- drivers/clk/mmp/clk-of-pxa910.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/clk/mmp/clk-of-pxa910.c b/drivers/clk/mmp/clk-of-pxa910.c index e22a67f..dce6245 100644 --- a/drivers/clk/mmp/clk-of-pxa910.c +++ b/drivers/clk/mmp/clk-of-pxa910.c @@ -278,25 +278,25 @@ static void __init pxa910_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; } pxa_unit->apbcp_base = of_iomap(np, 3); if (!pxa_unit->mpmu_base) { pr_err("failed to map apbcp registers\n"); - return; + goto unmap_apbc_region; } mmp_clk_init(np, &pxa_unit->unit, PXA910_NR_CLKS); @@ -308,6 +308,17 @@ static void __init pxa910_clk_init(struct device_node *np) pxa910_axi_periph_clk_init(pxa_unit); pxa910_clk_reset_init(np, pxa_unit); + + return; + +unmap_apbc_region: + iounmap(pxa_unit->apbc_base); +unmap_apmu_region: + iounmap(pxa_unit->apmu_base); +unmap_mpmu_region: + iounmap(pxa_unit->mpmu_base); +free_memory: + kfree(pxa_unit); } CLK_OF_DECLARE(pxa910_clk, "marvell,pxa910-clock", pxa910_clk_init);