From patchwork Tue Sep 20 10:33:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 9341433 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 DC3D2607D0 for ; Tue, 20 Sep 2016 10:34:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD1DE29ECD for ; Tue, 20 Sep 2016 10:34:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C15E629ED5; Tue, 20 Sep 2016 10:34:27 +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 7261E29ECD for ; Tue, 20 Sep 2016 10:34:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932688AbcITKeK (ORCPT ); Tue, 20 Sep 2016 06:34:10 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:35765 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932789AbcITKeG (ORCPT ); Tue, 20 Sep 2016 06:34:06 -0400 Received: by mail-pf0-f194.google.com with SMTP id 6so799847pfl.2; Tue, 20 Sep 2016 03:34:06 -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=QaIR/l0JSgRxmydmltwCi9G4zBCXPBVHU93C/Ti8v5U=; b=jUsto7Q+qfLiGlo1RTSObuBSQ4XssgmplRDIxX9OyQ35mtzJyOK/SJ3Ej74rfWmAqA N7TZBV3kqr2lncY0ZrUrhX1T2WNeV90IH7Uw3vXYt07TWklHca64huww5Pm+7T7CX4/f +vceBH38jMc+xqyjPSJX0dbOfJIq0DIfp9bZw+Ae30+PU4ERpO8k9BtBl+GH9pdnYbcn lxKrST51O3PVT9Syfqa5zQk9K1AMwjYzjVZB7kKWbD9UrgQDDmSx/LHxwvAjj42EOZi2 w/D38MUoTs9MyCXGl5ODQ9DA1cj4TINQHu03lWfO3AFof9Ch7Xv/koayia6bkESS++c1 tajA== 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=QaIR/l0JSgRxmydmltwCi9G4zBCXPBVHU93C/Ti8v5U=; b=J8ZqFaZZOd4tHyP22n8wE+4VvKIEFENKbjy0nb4Ryd155I75pAl0BW5/AdWiFmBG4n 5xdE6ssxUPes5XjnG1FMmAB3aXxTU7EOuJcbUIVP+N1ez10nPg68yu8H3623K4F7252Z iiEPTH5s91OfBBOFspe/R8ZUezCimUj1dzuF8mwHFsKH1awcY4RU7omB8KvTsQFDwWRe UJZ7WhwmmzyE3JAeZEJcfCDOa1iH/cK8UczRx8pavzM2FyU2ZpPuvKSaABQ5XYZojmfV s3BSTpRpsl0XROd9cilbwkNEwVJ4Kjx919p+7kQ6JRgUbtTwK3CrvAib2MrVHS0TDmae oODw== X-Gm-Message-State: AE9vXwOYVB+CXO987OHa9ZYwFXAa33pwz2pCaCYJZE2b/AVxgUv1tn4dajgWeXe8nTJU4Q== X-Received: by 10.98.156.81 with SMTP id f78mr21750897pfe.139.1474367645747; Tue, 20 Sep 2016 03:34:05 -0700 (PDT) Received: from symbol-HP-Z420-Workstation.symbol.com ([140.101.159.242]) by smtp.googlemail.com with ESMTPSA id tq5sm38103361pac.42.2016.09.20.03.34.03 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Sep 2016 03:34:05 -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-pxa910: Free memory and Unmap region obtained by kzmalloc and of_iomap Date: Tue, 20 Sep 2016 16:03:11 +0530 Message-Id: <1474367591-15750-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 | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/clk/mmp/clk-of-pxa910.c b/drivers/clk/mmp/clk-of-pxa910.c index e22a67f..a50d42a 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,15 @@ static void __init pxa910_clk_init(struct device_node *np) pxa910_axi_periph_clk_init(pxa_unit); pxa910_clk_reset_init(np, pxa_unit); + +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);