From patchwork Tue Nov 22 09:44:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 9440699 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 29AF860235 for ; Tue, 22 Nov 2016 09:47:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2EEAF284B5 for ; Tue, 22 Nov 2016 09:47:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2353C284B7; Tue, 22 Nov 2016 09:47:59 +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_SIGNED, 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 A6E42284B5 for ; Tue, 22 Nov 2016 09:47:58 +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 1c97ef-0000j6-F3; Tue, 22 Nov 2016 09:46:21 +0000 Received: from mail-wj0-x22b.google.com ([2a00:1450:400c:c01::22b]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c97dh-0006zE-JA for linux-arm-kernel@lists.infradead.org; Tue, 22 Nov 2016 09:45:33 +0000 Received: by mail-wj0-x22b.google.com with SMTP id mp19so39725037wjc.1 for ; Tue, 22 Nov 2016 01:45:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZhQxCq7pz2euFHubm4MVR9laXw7FW50yjR2c99M2Qlk=; b=kWM5amJUdiTySi7UVeEf7s1gMJUgiwXlV0bnS9M/qzTeg16MwvOsfuP0WRYIGvBqwx kNSNBw81i/WgMs3RUye9TCi8CdUQdySleWUJUjwY/tn/8P4wZWCYlpWd3jqKxch/GX+W 3lYNX+jIbLPMv8ft6Hbp+/k/HyJXcAAoTjLK8= 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:in-reply-to :references; bh=ZhQxCq7pz2euFHubm4MVR9laXw7FW50yjR2c99M2Qlk=; b=JR4QyW/Miwtt8020EbYoRF3mH2YGJ7YOCY3LPtuJaHm5H+u6mtuPEeaxYJNG80XUvi s39GakLhpMl686ZqUoYmkv9PBUO4EUFykMt+yGiSf8fvVbOxeAkYjKiJplqTDNBfGwRL 2lOl4V4Yg+bWNGJKVN1e7ZhqrOMLdBZ87EYJjAah4j8wr4b6MrQUcCVZ5mhQxRvNIgKc shpnUc4dGw8O12OAYFox2MHTAHBh1uqvqRTjxU5DlLAKB1/6pJ8xaY9V8AwG5epnC9p7 VlWqgA5Kae8sIx2u4zdoUYEoYxR/dTx2wN9ULMCrXuJK3KNeoH6u1wYbMW8wfwzXmWBb RAGQ== X-Gm-Message-State: AKaTC02ZO/1mb/WF8RmtIo0PAacP5rApfyJAIhQeootzIsdTjpMEHo1pLubSQumX5BRPwdTR X-Received: by 10.194.101.97 with SMTP id ff1mr15387271wjb.67.1479807899635; Tue, 22 Nov 2016 01:44:59 -0800 (PST) Received: from localhost.localdomain ([2a01:e35:879a:6cd0:d4cd:7489:29a3:d5ed]) by smtp.gmail.com with ESMTPSA id ab10sm29789450wjc.45.2016.11.22.01.44.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 22 Nov 2016 01:44:59 -0800 (PST) From: Daniel Lezcano To: tglx@linutronix.de Subject: [PATCH 4/4] clocksource/drivers/bcm2835_timer: Unmap region obtained by of_iomap Date: Tue, 22 Nov 2016 10:44:24 +0100 Message-Id: <1479807866-6957-4-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1479807866-6957-1-git-send-email-daniel.lezcano@linaro.org> References: <20161122094300.GA2017@mai> <1479807866-6957-1-git-send-email-daniel.lezcano@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161122_014522_347447_F1542E0E X-CRM114-Status: GOOD ( 11.24 ) 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: Florian Fainelli , Scott Branden , Stephen Warren , Ray Jui , Lee Jones , linux-kernel@vger.kernel.org, Eric Anholt , "maintainer:BROADCOM BCM281XX/BCM11XXX/BCM216XX ARM ARCHITE..." , "moderated list:BROADCOM BCM2835 ARM ARCHITECTURE" , Arvind Yadav , "moderated list:BROADCOM BCM2835 ARM ARCHITECTURE" 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 From: Arvind Yadav Free memory mapping, if bcm2835_timer_init is not successful. Signed-off-by: Arvind Yadav Reviewed-by: Eric Anholt Signed-off-by: Daniel Lezcano --- 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);