From patchwork Wed Sep 21 17:33:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 9344025 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 AEEA16077A for ; Wed, 21 Sep 2016 17:36:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C6FB2A83D for ; Wed, 21 Sep 2016 17:36:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 90EFB2A84A; Wed, 21 Sep 2016 17:36: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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2C8D42A83D for ; Wed, 21 Sep 2016 17:36:16 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bmlQ3-0008A2-Ud; Wed, 21 Sep 2016 17:34:51 +0000 Received: from mail-pa0-x241.google.com ([2607:f8b0:400e:c03::241]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bmlPv-000856-Nj; Wed, 21 Sep 2016 17:34:44 +0000 Received: by mail-pa0-x241.google.com with SMTP id s3so1174505pay.1; Wed, 21 Sep 2016 10:34:22 -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=dd3OC9wqadP1SnvIWfYJti2GcODlgNSzIu4/7YPwwOc=; b=vBtkdDjvvu7bZ7PO6lwno9qTWxhjweslNPsOMJzncLWY0WmiOm7rT7/GGmsHKfjlLG uz0IxCit48o8lU46kajfkxMWNzvlMzrGk0Sx6Kh7MZpcbKbgZtuMQXU1HQGA6qziW5kv CXyURz7m4SGoLvQjlhDDkwnDga9Lhxuy1RhWQi2HxfA+n9ytOCSXjQDCcHrSqA5JbduS VpzwxjUKLZ9ADbNJdganKg/i552y01fS0bmJL/SIhN3f/MyJBPbumvskxg9TeYpLMAwh OAM/mvyhtDECiTIJDjGB8VIPZijAEHSSyvd2bjuzL1tPVunMywyjOax2pZXCdAC/RCpe 9JHw== 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=dd3OC9wqadP1SnvIWfYJti2GcODlgNSzIu4/7YPwwOc=; b=le8j3t+cQAx04a2pE64fzWNnTMTrdkIaCwBasHXbC18diGdwWVDMmadPZvT+zZGsRD INjYzEEcnTDfZMJzDZ/XRYeOh3bz16giLRIU4AolSmyyL++g4b9U6enugwTXBRc4sHbi j3Ff+o6AUAe3WfeoSFjarKDkSZ+cHvoY1RErX70hhlm8GdvWFRl7OQNaP7LX8zOpeWCH gfXAEwicNeSgZ/w2IEKlWRRQldd5KIlApM9l55J5DBfoa2r5K1KB6mXUtwD25T758Fk/ 7Y4P4ERPLJVhxM5+N/dVf4xuPzbNWhgnyCFQ6KBw9FBkjflEUAQzJTb0wsESUUWQwGZn kyqQ== X-Gm-Message-State: AE9vXwMuApyxLv8sRJnKQlPFziDtUA2/rmC6GxJWTuy9wgb4zWyWKuyP+O4u0kcjr7nHeg== X-Received: by 10.67.8.41 with SMTP id dh9mr66636283pad.132.1474479262382; Wed, 21 Sep 2016 10:34:22 -0700 (PDT) Received: from localhost.localdomain ([103.16.70.178]) by smtp.gmail.com with ESMTPSA id mk9sm48160517pab.1.2016.09.21.10.34.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Sep 2016 10:34:21 -0700 (PDT) From: Arvind Yadav To: daniel.lezcano@linaro.org, tglx@linutronix.de, lee@kernel.org, eric@anholt.net, f.fainelli@gmail.com, rjui@broadcom.com, sbranden@broadcom.com, bcm-kernel-feedback-list@broadcom.com Subject: [PATCH] clocksource: bcm2835_timer: Unmap region obtained by of_iomap Date: Wed, 21 Sep 2016 23:03:57 +0530 Message-Id: <1474479237-10356-1-git-send-email-arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160921_103443_859944_73B76A93 X-CRM114-Status: UNSURE ( 9.76 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Free memory mapping, if bcm2835_timer_init is not successful. Signed-off-by: Arvind Yadav Reviewed-by: Eric Anholt --- drivers/clocksource/bcm2835_timer.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/clocksource/bcm2835_timer.c b/drivers/clocksource/bcm2835_timer.c index e71acf2..f2f29d2 100644 --- a/drivers/clocksource/bcm2835_timer.c +++ b/drivers/clocksource/bcm2835_timer.c @@ -96,7 +96,7 @@ static int __init bcm2835_timer_init(struct device_node *node) ret = of_property_read_u32(node, "clock-frequency", &freq); if (ret) { pr_err("Can't read clock-frequency"); - return ret; + goto err_iounmap; } system_clock = base + REG_COUNTER_LO; @@ -108,13 +108,15 @@ static int __init bcm2835_timer_init(struct device_node *node) irq = irq_of_parse_and_map(node, DEFAULT_TIMER); if (irq <= 0) { pr_err("Can't parse IRQ"); - return -EINVAL; + ret = -EINVAL; + goto err_iounmap; } timer = kzalloc(sizeof(*timer), GFP_KERNEL); if (!timer) { pr_err("Can't allocate timer struct\n"); - return -ENOMEM; + ret = -ENOMEM; + goto err_iounmap; } timer->control = base + REG_CONTROL; @@ -133,7 +135,7 @@ static int __init bcm2835_timer_init(struct device_node *node) ret = setup_irq(irq, &timer->act); if (ret) { pr_err("Can't set up timer IRQ\n"); - return ret; + goto err_iounmap; } clockevents_config_and_register(&timer->evt, freq, 0xf, 0xffffffff); @@ -141,6 +143,10 @@ static int __init bcm2835_timer_init(struct device_node *node) pr_info("bcm2835: system timer (irq = %d)\n", irq); return 0; + +err_iounmap: + iounmap(base); + return ret; } CLOCKSOURCE_OF_DECLARE(bcm2835, "brcm,bcm2835-system-timer", bcm2835_timer_init);