From patchwork Tue Feb 3 03:20:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: kgene@kernel.org X-Patchwork-Id: 5766081 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 CE80CBF440 for ; Tue, 3 Feb 2015 03:20:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F1DA1208F6 for ; Tue, 3 Feb 2015 03:20:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1196220900 for ; Tue, 3 Feb 2015 03:20:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753027AbbBCDU0 (ORCPT ); Mon, 2 Feb 2015 22:20:26 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:57631 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751133AbbBCDUY (ORCPT ); Mon, 2 Feb 2015 22:20:24 -0500 Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NJ600HFFELYJN10@mailout4.samsung.com>; Tue, 03 Feb 2015 12:20:22 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.136]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id 4B.08.18484.67E30D45; Tue, 03 Feb 2015 12:20:22 +0900 (KST) X-AuditID: cbfee68f-f791c6d000004834-9d-54d03e760d67 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 42.A2.20081.67E30D45; Tue, 03 Feb 2015 12:20:22 +0900 (KST) Received: from DOKGENEKIM04 ([12.36.165.190]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NJ600DTWELYWYQ0@mmp2.samsung.com>; Tue, 03 Feb 2015 12:20:22 +0900 (KST) From: Kukjin Kim To: 'Krzysztof Kozlowski' , 'Russell King' , 'Kukjin Kim' , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org References: <1421077065-30175-1-git-send-email-k.kozlowski@samsung.com> In-reply-to: <1421077065-30175-1-git-send-email-k.kozlowski@samsung.com> Subject: RE: [PATCH] ARM: EXYNOS: Handle of of_iomap() failure Date: Tue, 03 Feb 2015 12:20:19 +0900 Message-id: <054001d03f60$58535150$08f9f3f0$@kernel.org> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: AQJkKQ1kIdjWS6rbueU/x6XD/8TExJu2WWOg Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrPIsWRmVeSWpSXmKPExsWyRsSkQ7fM7kKIwa52TYvXLwwt+h+/ZrbY 9Pgaq8XlXXPYLGac38dkcfsyrwObR0tzD5vHplWdbB6bl9R79G1ZxejxeZNcAGsUl01Kak5m WWqRvl0CV8b/ZVvZC27yVhw7PJ+lgXEGdxcjJ4eEgInEu87XLBC2mMSFe+vZuhi5OIQEljJK XJ25ih2maMfX6VCJ6YwSH7dugXL+Mkr8mXoPqJ2Dg01AWaKxSR+kQVhAS2LhliYWkBoRgVeM Ek/XHAabJCTgLnH272wwm1PAQ2JCXyczRIOdRPu9zawgNouAqsTJFS+ZQGxeAQuJJf8OQNmC Ej8m3wM7lRlowfqdx5kgbHmJzWveMkNcqiCx4+xrRpB7RASMJP7fl4QoEZHY9+IdI8g9EgK3 2CV27jjEDLFLQOLb5ENg90sIyE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KL8uOLSnNSiw8x mgI9OpFZSjQ5H5io8kriDY1NzIwsjcwsjEzMzZXEeZXs20KEBNITS1KzU1MLUotg+pg4OKUa GA+lyN/Wnrb+jnRc2Ici9R3N/UevBHvZBXatfdGtnbz73lRP746nohLP9p7sXfz9E3eFKLtv usFVz577U69yeS1VWemlvFt7ncG6fSVRzF5X4yOklolsF+22YZ3uaaCt+uhar5Xfgfj0/VeM bsxal/Xk14PrNjomMTE7Pl/6WW+gMKH17R43fSWW4oxEQy3mouJEAGEJIWMcAwAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Krzysztof Kozlowski wrote: > > 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; > > -- Looks good and applied. BTW if we need more error handling like this, how about error handling for failing of of_find_device_by_node() something like following? I mean I'm not sure how many error/exception handling is required... Note you can see your patch in Samsung tree tonight in my time. Thanks, Kukjin --- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c index 20f2671..234f967 100644 --- a/arch/arm/mach-exynos/pm_domains.c +++ b/arch/arm/mach-exynos/pm_domains.c @@ -116,6 +116,10 @@ static __init int exynos4_pm_init_power_domain(void) struct device *dev; pdev = of_find_device_by_node(np); + if (!pdev) { + /* error handling */ + } + dev = &pdev->dev; pd = kzalloc(sizeof(*pd), GFP_KERNEL);