From patchwork Fri Mar 27 12:28:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 6106891 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C3D68BF90F for ; Fri, 27 Mar 2015 12:50:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EFBE5203B8 for ; Fri, 27 Mar 2015 12:50:19 +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 D6161203AD for ; Fri, 27 Mar 2015 12:50:17 +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 1YbTVG-0006aj-IX; Fri, 27 Mar 2015 12:36:46 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YbTNi-0007UQ-Bx for linux-arm-kernel@lists.infradead.org; Fri, 27 Mar 2015 12:28:59 +0000 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NLV00FUNEU8XF60@mailout2.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 27 Mar 2015 12:32:32 +0000 (GMT) X-AuditID: cbfec7f4-b7f126d000001e9a-3b-55154c48ef7d Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 88.3C.07834.84C45155; Fri, 27 Mar 2015 12:25:44 +0000 (GMT) Received: from AMDC1943.digital.local ([106.116.151.171]) by eusync3.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NLV00I58ENIRF00@eusync3.samsung.com>; Fri, 27 Mar 2015 12:28:33 +0000 (GMT) From: Krzysztof Kozlowski To: Kukjin Kim , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] ARM: EXYNOS: Handle of of_iomap() failure Date: Fri, 27 Mar 2015 13:28:23 +0100 Message-id: <1427459305-26625-1-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCJMWRmVeSWpSXmKPExsVy+t/xq7oePqKhBqvniFv8nXSM3eL1C0OL /sevmS02Pb7GanF51xw2ixnn9zFZrD1yl93i1PXPbA4cHr9/TWL02LSqk81j85J6jysnmlg9 +rasYvT4vEkugC2KyyYlNSezLLVI3y6BK2P/SfmCP+wVDYunsTQwnmfrYuTgkBAwkdi13ryL kRPIFJO4cG89UJiLQ0hgKaPEpbcrmSGcPiaJGb8fM4NUsQkYS2xevgSsSkSgi1Fi1pbfbCAJ ZoFFjBJLLjqD2MICjhInLt9mBLFZBFQlfj/7zQKyjVfAXeL250KIbXISJ49NZp3AyL2AkWEV o2hqaXJBcVJ6rqFecWJucWleul5yfu4mRkjIfNnBuPiY1SFGAQ5GJR5eg4PCoUKsiWXFlbmH GCU4mJVEePldREOFeFMSK6tSi/Lji0pzUosPMTJxcEo1MNZOYhYJvSbGITFjPR9/e7r42stK vA9+8VVsfKbDaXAuvPNekrPT1tItht5HQvnnb3zbunfV2r+ipzxldweu8NAKOXz83t8JKcd4 7gjIuU7mU0gVXuK7+XbAT8Z4kRnLXkhM9PA5dz3m17N3Dhtb5BjL6vt1VhjpZcYu/RYgk1/D 3h6roe+fpMRSnJFoqMVcVJwIAKKOz5/3AQAA X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150327_052858_623627_389950FC X-CRM114-Status: UNSURE ( 8.00 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -5.0 (-----) Cc: Olof Johansson , Krzysztof Kozlowski , Arnd Bergmann , Marek Szyprowski 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 --- Changes since v1: 1. Add missing kfree() of domain name (allocated with kstrdup()). --- arch/arm/mach-exynos/pm_domains.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c index cbe56b35aea0..14622b5f4481 100644 --- a/arch/arm/mach-exynos/pm_domains.c +++ b/arch/arm/mach-exynos/pm_domains.c @@ -138,6 +138,14 @@ static __init int exynos4_pm_init_power_domain(void) pd->pd.name = kstrdup(dev_name(dev), 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->pd.name); + kfree(pd); + of_node_put(np); + continue; + } + pd->pd.power_off = exynos_pd_power_off; pd->pd.power_on = exynos_pd_power_on;