From patchwork Wed Apr 22 13:17:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 6256001 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 E8467BF4A6 for ; Wed, 22 Apr 2015 13:21:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1750D20165 for ; Wed, 22 Apr 2015 13:21:24 +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 E394E20328 for ; Wed, 22 Apr 2015 13:21:21 +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 1YkuXk-00045y-0i; Wed, 22 Apr 2015 13:18:20 +0000 Received: from mail-pa0-x22f.google.com ([2607:f8b0:400e:c03::22f]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YkuXf-000434-Ax for linux-arm-kernel@lists.infradead.org; Wed, 22 Apr 2015 13:18:16 +0000 Received: by pabsx10 with SMTP id sx10so272859995pab.3 for ; Wed, 22 Apr 2015 06:17:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=doMCLXfiqwn7+afUfYnd7H5XcutqtKmaEeT0Ke6BxJ4=; b=r93EeEz5NSEyqYnz8+9EnFn6Cz+bGfggGnhOK4HWnn8amqMUcVX7yP6KozaDAtW2IB yB4JcHxALc4wRBvIczAjRIWT+CbmdyukQioPHqnOdtr4K1CJSd51/DD4FakgGsmU/1B/ LQTZ6Xh08c0xIGT/R0VdWOkMZ5LKHImKKp4sv7A01WuIISFNDmJpbGmDRGOFiKoxfNlh rIlZ6DrmzlP9+Ro3qqgPpBVLkmUVRwR3gLWJAmdP84h9RbSEv6jFo/2P9N44LCev1JyX C3DfH71OmAGXeBY8fURgidF/gowjqSXy7K6WghKZI3eqiiYRGlvfILOIMNHH/q2rNgQh Pp/A== X-Received: by 10.70.37.45 with SMTP id v13mr46460311pdj.50.1429708671818; Wed, 22 Apr 2015 06:17:51 -0700 (PDT) Received: from localhost.localdomain ([125.130.175.98]) by mx.google.com with ESMTPSA id sz7sm5193014pab.22.2015.04.22.06.17.49 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 22 Apr 2015 06:17:51 -0700 (PDT) From: Krzysztof Kozlowski To: Kukjin Kim , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RESEND PATCH v2 1/3] ARM: EXYNOS: Handle of of_iomap() failure Date: Wed, 22 Apr 2015 22:17:08 +0900 Message-Id: <1429708630-19810-1-git-send-email-k.kozlowski.k@gmail.com> X-Mailer: git-send-email 2.1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150422_061815_414263_F93864F4 X-CRM114-Status: GOOD ( 10.11 ) X-Spam-Score: -0.8 (/) 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.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 From: Krzysztof Kozlowski 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;