From patchwork Tue Oct 25 17:34:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 9395141 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B28D160762 for ; Tue, 25 Oct 2016 17:37:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A538B295B2 for ; Tue, 25 Oct 2016 17:37:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99A5D296E2; Tue, 25 Oct 2016 17:37:20 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2D0E0295B2 for ; Tue, 25 Oct 2016 17:37:20 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bz5do-0002dr-Qp; Tue, 25 Oct 2016 17:36:00 +0000 Received: from bh-25.webhostbox.net ([208.91.199.152]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bz5da-0000zX-1r for linux-arm-kernel@lists.infradead.org; Tue, 25 Oct 2016 17:35:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=roeck-us.net; s=default; h=Message-Id:Date:Subject:Cc:To:From; bh=MI9o8XCaLJe0e+bZejPyZ/HhI2Rt9ePGGGZ5x1432vo=; b=xACV8YYvkNXRlVx+9Xt3NAgbNF b9YWRIPhPL5xjZN7oaAzNzjdPCPIMnWD9MbDFNvAuWJ4zv5o02Hx4vQIeoxg2EM4+FLgxQdNM5OXV kGoQQt1n0O2odsOsgWLBAEM4nwaaEBYtdXYWqXnZRMGIYHx41N4f+O4hGtNcgOVM/X3cMs++vvGjJ A8dwImuMJLhewoGtj7F7HXwLl72y/2qefeeg5TkCaL9ECBVpr5SDxszuDoi5cHaVgiNUH/FjC/Rs/ KK2ZfHbkQ3uojkE97I9MvM3FP+/1SXFcy0dqmPKQpLg5rEjNgRwEbSUQTAWOXR1JO6pnn6bPhV/cF 6+HLQS6Q==; Received: from 108-223-40-66.lightspeed.sntcca.sbcglobal.net ([108.223.40.66]:40610 helo=localhost) by bh-25.webhostbox.net with esmtpa (Exim 4.86_1) (envelope-from ) id 1bz5cS-003Swc-HW; Tue, 25 Oct 2016 17:34:37 +0000 From: Guenter Roeck To: Shawn Guo Subject: [PATCH] ARM: imx6: Fix GPC probe error path Date: Tue, 25 Oct 2016 10:34:38 -0700 Message-Id: <1477416878-30353-1-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 2.5.0 X-Authenticated_sender: guenter@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - lists.infradead.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: guenter@roeck-us.net X-Authenticated-Sender: bh-25.webhostbox.net: guenter@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161025_103546_353674_C52BF12D X-CRM114-Status: GOOD ( 14.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Philipp Zabel , Arnd Bergmann , linux-kernel@vger.kernel.org, Russell King , linux-arm-kernel@lists.infradead.org, Sascha Hauer , Fabio Estevam , Guenter Roeck MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP GPC may fail to instantiate with imx-gpc: probe of 20dc000.gpc failed with error -22 which is returned from of_genpd_add_provider_onecell(). The error path does not call pm_genpd_remove(). This results in the following crash later on. Unhandled fault: page domain fault (0x01b) at 0x00000040 pgd = c0204000 [00000040] *pgd=00000000 Internal error: : 1b [#1] SMP ARM Modules linked in: CPU: 0 PID: 108 Comm: kworker/0:3 Not tainted 4.9.0-rc2 #8 Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) Workqueue: pm genpd_power_off_work_fn task: c759ea00 task.stack: c766a000 PC is at mutex_lock+0xc/0x4c LR is at regulator_disable+0x28/0x64 ... [] (mutex_lock) from [] (regulator_disable+0x28/0x64) [] (regulator_disable) from [] (imx6q_pm_pu_power_off+0x90/0x98) [] (imx6q_pm_pu_power_off) from [] (genpd_poweroff+0x114/0x1d4) [] (genpd_poweroff) from [] (genpd_power_off_work_fn+0x20/0x2c) [] (genpd_power_off_work_fn) from [] (process_one_work+0x138/0x34c) [] (process_one_work) from [] (worker_thread+0x38/0x510) [] (worker_thread) from [] (kthread+0xdc/0xf4) [] (kthread) from [] (ret_from_fork+0x14/0x3c) This is seen with multi_v7_defconfig and imx6dl-sabrelite.dtb running in qemu (v2.7 patched to fix a qemu related problem). The error return from of_genpd_add_provider_onecell() is not seen in v4.8 and may be caused by a devicetree change (this is a wild guess only), but that is a different problem. Fixes: 00eb60a8b4f7 ("ARM: imx6: gpc: Add PU power domain for GPU/VPU") Cc: Philipp Zabel Cc: Arnd Bergmann Signed-off-by: Guenter Roeck --- Several bisect attempts trying to track down "imx-gpc: probe ... failed with error -22" point to commit 00e729c93395 ("Merge tag 'armsoc-dt' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc"). I have not been able to track down the real culprit. Part of the problem is that CONFIG_REGULATOR_ANATOP must be enabled for the problem to be seen, and CONFIG_ARCH_AT91 causes compile errors for some sequence of commits between v4.8 and v4.9-rc1. But even after taking this into account, the bisect results always point to 00e729c93395. If anyone has an idea how to track down that problem, or what might be causing it, please let me know. arch/arm/mach-imx/gpc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-imx/gpc.c b/arch/arm/mach-imx/gpc.c index 0df062d8b2c9..f3f40045b4c9 100644 --- a/arch/arm/mach-imx/gpc.c +++ b/arch/arm/mach-imx/gpc.c @@ -409,6 +409,7 @@ static int imx_gpc_genpd_init(struct device *dev, struct regulator *pu_reg) { struct clk *clk; int i; + int ret; imx6q_pu_domain.reg = pu_reg; @@ -431,9 +432,14 @@ static int imx_gpc_genpd_init(struct device *dev, struct regulator *pu_reg) return 0; pm_genpd_init(&imx6q_pu_domain.base, NULL, false); - return of_genpd_add_provider_onecell(dev->of_node, - &imx_gpc_onecell_data); + ret = of_genpd_add_provider_onecell(dev->of_node, + &imx_gpc_onecell_data); + if (ret) + goto genpd_remove; + return 0; +genpd_remove: + pm_genpd_remove(&imx6q_pu_domain.base); clk_err: while (i--) clk_put(imx6q_pu_domain.clk[i]);