From patchwork Tue Jul 24 16:49:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 10542565 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B2295112E for ; Tue, 24 Jul 2018 16:50:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A203629126 for ; Tue, 24 Jul 2018 16:50:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9F53629185; Tue, 24 Jul 2018 16:50:48 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,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 3E2B429175 for ; Tue, 24 Jul 2018 16:50:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388837AbeGXR5u (ORCPT ); Tue, 24 Jul 2018 13:57:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:41130 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388414AbeGXR5u (ORCPT ); Tue, 24 Jul 2018 13:57:50 -0400 Received: from localhost.localdomain (xdsl-188-155-58-14.adslplus.ch [188.155.58.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4EA7720883; Tue, 24 Jul 2018 16:50:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1532451029; bh=12umIieZcuTxguc4cgZt2eNAjuSBXV7eA2Lj+nsGSgE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=of1YjaVGaO5Z4lnHWB+B95pHHnH8QIqonga6XGXzkZ+YwYCQVtHmpoyITdei7iFFc OmWUTR+RpzBgaVWUcuGx/4McF714uW5MpPIHPXzuWJQlEIoALvTP3WMK8cRlY9Xizn mJaBzgeLeUi7Jxd3BG7DAUJ9Hfza67BHQN/IoOz4= From: Krzysztof Kozlowski To: Kukjin Kim , Krzysztof Kozlowski , Russell King , Alim Akhtar , Marek Szyprowski , Pankaj Dubey , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/4] ARM: exynos: Clear global variable on init error path Date: Tue, 24 Jul 2018 18:49:45 +0200 Message-Id: <20180724164946.6274-3-krzk@kernel.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180724164946.6274-1-krzk@kernel.org> References: <20180724164946.6274-1-krzk@kernel.org> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For most of Exynos SoCs, Power Management Unit (PMU) address space is mapped into global variable 'pmu_base_addr' very early when initializing PMU interrupt controller. A lot of other machine code depends on it so when doing iounmap() on this address, clear the global as well to avoid usage of invalid value (pointing to unmapped memory region). Properly mapped PMU address space is a requirement for all other machine code so this fix is purely theoretical. Boot will fail immediately in many other places after following this error path. Signed-off-by: Krzysztof Kozlowski --- Changes since v1: New patch. --- arch/arm/mach-exynos/suspend.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c index 5d4822e5d0ba..d42ef1be2c70 100644 --- a/arch/arm/mach-exynos/suspend.c +++ b/arch/arm/mach-exynos/suspend.c @@ -207,6 +207,7 @@ static int __init exynos_pmu_irq_init(struct device_node *node, NULL); if (!domain) { iounmap(pmu_base_addr); + pmu_base_addr = NULL; return -ENOMEM; }