From patchwork Mon Jan 12 15:37:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 5611201 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 671B99F357 for ; Mon, 12 Jan 2015 15:53:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9CF92205B8 for ; Mon, 12 Jan 2015 15:53:57 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5284F205B6 for ; Mon, 12 Jan 2015 15:53:56 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YAhGv-0004cO-LE; Mon, 12 Jan 2015 15:51:17 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YAh4Z-0002EG-OT for linux-arm-kernel@lists.infradead.org; Mon, 12 Jan 2015 15:38:32 +0000 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NI200GUMMAD4F00@mailout1.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 12 Jan 2015 15:42:13 +0000 (GMT) X-AuditID: cbfec7f4-b7f126d000001e9a-99-54b3ea5dfe68 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id DE.02.07834.D5AE3B45; Mon, 12 Jan 2015 15:38:05 +0000 (GMT) Received: from AMDC1943.digital.local ([106.116.151.171]) by eusync4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NI2004U8M3EE0A0@eusync4.samsung.com>; Mon, 12 Jan 2015 15:38:05 +0000 (GMT) From: Krzysztof Kozlowski To: Russell King , Kukjin Kim , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ARM: EXYNOS: Handle of of_iomap() failure Date: Mon, 12 Jan 2015 16:37:45 +0100 Message-id: <1421077065-30175-1-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOJMWRmVeSWpSXmKPExsVy+t/xa7qxrzaHGJzcLW/x+oWhRf/j18wW mx5fY7W4vGsOm8WM8/uYLG5f5nVg82hp7mHz2LSqk81j85J6j74tqxg9Pm+SC2CN4rJJSc3J LEst0rdL4Mr48Woza0EDe8Xrbz+ZGhhfs3YxcnJICJhITDvczw5hi0lcuLeerYuRi0NIYCmj xNJNVxkhnD4miTNbX4JVsQkYS2xevgSsSkRgM6NEf+NusFHMAoYSP9/9ASsSFrCS2Hh8ATOI zSKgKrH12hQWEJtXwF1i18wtzBDr5CROHpvMOoGRewEjwypG0dTS5ILipPRcQ73ixNzi0rx0 veT83E2MkMD4soNx8TGrQ4wCHIxKPLwTZDaHCLEmlhVX5h5ilOBgVhLhdS0DCvGmJFZWpRbl xxeV5qQWH2Jk4uCUamDMbAgJviv/10yIS23ZJet5Dqm7fFZeubpaxSGyLzx3lsTMHUsVpuom lr2ocy4TV9l/ScJn2tn+xKML61btll4gvWJ/S85Zu1nmJova0o7IJPmEMfVfmrfxtYfpD9bJ AbNMK+5mfv9ftb9J7k7dV78Fbzh6dovFTNG6FnXp+fr7xZX2Oo+Mza4osRRnJBpqMRcVJwIA pyPKO+oBAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150112_073831_997384_4D23AF64 X-CRM114-Status: UNSURE ( 8.25 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -4.9 (----) Cc: Krzysztof Kozlowski X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Prevent possible NULL pointer dereference if of_iomap() fails. Handle the error by skipping such power domain. Signed-off-by: Krzysztof Kozlowski --- arch/arm/mach-exynos/pm_domains.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c index 20f267121b3e..fd7640a6b503 100644 --- a/arch/arm/mach-exynos/pm_domains.c +++ b/arch/arm/mach-exynos/pm_domains.c @@ -128,6 +128,13 @@ static __init int exynos4_pm_init_power_domain(void) pd->pd.name = kstrdup(np->name, GFP_KERNEL); pd->name = pd->pd.name; pd->base = of_iomap(np, 0); + if (!pd->base) { + dev_warn(&pdev->dev, "Failed to map memory\n"); + kfree(pd); + of_node_put(np); + continue; + } + pd->pd.power_off = exynos_pd_power_off; pd->pd.power_on = exynos_pd_power_on;