From patchwork Mon Jan 17 10:21:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaolei Wang X-Patchwork-Id: 12715120 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9557AC433F5 for ; Mon, 17 Jan 2022 10:23:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=6thtUmyySPgPGnai49k4hEClt2LabEvqHNsUXwH80Fo=; b=etebvzaq23fndS kE1kKxHc1SU6xQ1eijBCEhmvyt1xs7VW4zDqbA1l8f+Uk20VU1iD3JYVVhYFpoHijzq7PkecdD9rJ FLUfjzKoP3hI54iQeGf/XdiWLQ/syk5uRJl1LFJKDA4EaAPEkzGwxIeIjjNhF641i9fEigZXhNA43 Pk2MrPvDQpcRZZpCiZd5AAwVjCzyxTZ+1q2FEC3gTtLd1zsIpW5zI6N6gVOjcV4U+7xfe8KdYKSU2 dJtFYzJnK/AJF0RLR54XdNB+9R5ofxjj5VkDGNfKzeBezWvpNIvaN4FMQiBlo0DzllMFkQz330sMN LQHJjL342KIenwxb1Few==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n9P9h-00ETFD-V2; Mon, 17 Jan 2022 10:22:30 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n9P9f-00ETEf-T5 for linux-arm-kernel@bombadil.infradead.org; Mon, 17 Jan 2022 10:22:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To:Content-ID: Content-Description:In-Reply-To:References; bh=3WkG7uFlL5yfTv5wMXkdZgzYg2o+HtY2tLWViIG2hw0=; b=cCQ5JXsjfob9JA4diY3yH8nFyJ Iay3XNZ96Z+F+d4sxJwlMcMG+PkttGSAg8drN+E4eke6uRRl4PtJxm06sDc1WtoiCfGKj9Yn4k+TV W5fnCvcGx93W+xbLupFtyG8yrUbzndOW78JfVQGjSBU4hGQrZbSqwHsEE5gP9kQhS5oVapK9IcVse QbzJmWunixoLvSQrcqEATHZ67fbG8ljEIs8wJMNcGJ9a6gb3xfKZ25nqFdxO0sJasSjXIjLO7XtyF bK2ztGB+5nc2FSkAXkY5qSJCsWhXkfle+72RZWD+QSwqVmRgGpfQUdHaMsnrGmTg0Y9UC7K8LTFWB 4VGCYl6g==; Received: from unknown-3-146.windriver.com ([147.11.3.146] helo=mail1.wrs.com) by casper.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n9P9c-0082TL-4Z for linux-arm-kernel@lists.infradead.org; Mon, 17 Jan 2022 10:22:26 +0000 Received: from mail.windriver.com (mail.wrs.com [147.11.1.11]) by mail1.wrs.com (8.15.2/8.15.2) with ESMTPS id 20HALxbZ025167 (version=TLSv1.1 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Mon, 17 Jan 2022 02:21:59 -0800 Received: from ala-exchng01.corp.ad.wrs.com (ala-exchng01.corp.ad.wrs.com [147.11.82.252]) by mail.windriver.com (8.15.2/8.15.2) with ESMTPS id 20HALowg008849 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 17 Jan 2022 02:21:51 -0800 (PST) Received: from pek-lpggp7.wrs.com (128.224.153.21) by ala-exchng01.corp.ad.wrs.com (147.11.82.252) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Mon, 17 Jan 2022 02:21:47 -0800 From: Xiaolei Wang To: , , , , , , , , , CC: , , , Subject: [PATCH] pci: imx: disable reglator when imx6_pcie_probe fails Date: Mon, 17 Jan 2022 18:21:37 +0800 Message-ID: <20220117102137.3513439-1-xiaolei.wang@windriver.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [128.224.153.21] X-ClientProxiedBy: ala-exchng01.corp.ad.wrs.com (147.11.82.252) To ala-exchng01.corp.ad.wrs.com (147.11.82.252) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220117_102224_892349_CB924617 X-CRM114-Status: GOOD ( 11.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: wrsadmin disable reglator when imx6_pcie_probe fails, otherwise the following calltrace will appear [ 3.785075] ------------[ cut here ]------------ [ 3.788142] Registering SWP/SWPB emulation handler [ 3.789853] WARNING: CPU: 0 PID: 7 at drivers/regulator/core.c:2257 _regulator_put.part.0+0x1bc/0x1e0 [ 3.795680] Loading compiled-in X.509 certificates [ 3.803947] Modules linked in: [ 3.811922] CPU: 0 PID: 7 Comm: kworker/u8:0 Not tainted 5.16.0-10645-g3c750c7b6143-dirty #9 [ 3.820393] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) [ 3.826945] Workqueue: events_unbound async_run_entry_fn [ 3.832304] unwind_backtrace from show_stack+0x10/0x14 [ 3.837569] show_stack from dump_stack_lvl+0x58/0x70 [ 3.842663] dump_stack_lvl from __warn+0xd8/0x114 [ 3.847493] __warn from warn_slowpath_fmt+0x5c/0xc4 [ 3.852490] warn_slowpath_fmt from _regulator_put.part.0+0x1bc/0x1e0 [ 3.858968] _regulator_put.part.0 from regulator_put+0x2c/0x3c [ 3.864918] regulator_put from release_nodes+0x50/0x178 [ 3.870270] release_nodes from devres_release_all+0x80/0xd0 [ 3.875968] devres_release_all from really_probe+0xdc/0x30c [ 3.881661] really_probe from __driver_probe_device+0x80/0xe4 [ 3.887522] __driver_probe_device from driver_probe_device+0x30/0xd4 [ 3.893991] driver_probe_device from __driver_attach_async_helper+0x20/0x38 [ 3.901068] __driver_attach_async_helper from async_run_entry_fn+0x20/0xb4 [ 3.908059] async_run_entry_fn from process_one_work+0x298/0x7d0 [ 3.914188] process_one_work from worker_thread+0x30/0x510 [ 3.919792] worker_thread from kthread+0x128/0x14c [ 3.924705] kthread from ret_from_fork+0x14/0x38 [ 3.929443] Exception stack(0xc20cbfb0 to 0xc20cbff8) [ 3.934521] bfa0: 00000000 00000000 00000000 00000000 [ 3.942722] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 3.950922] bfe0: 00000000 00000000 00000000 00000000 00000013 00000000 [ 3.957677] irq event stamp: 1207 [ 3.961024] hardirqs last enabled at (1215): [] __up_console_sem+0x50/0x60 [ 3.968974] hardirqs last disabled at (1224): [] __up_console_sem+0x3c/0x60 [ 3.976911] softirqs last enabled at (1206): [] __do_softirq+0x2ec/0x5a4 [ 3.984669] softirqs last disabled at (1197): [] irq_exit+0x18c/0x20c [ 3.992021] ---[ end trace 45a52c023bf8fb33 ]--- Signed-off-by: Xiaolei Wang --- drivers/pci/controller/dwc/pci-imx6.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 6974bd5aa116..f8279a15463b 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -1216,7 +1216,7 @@ static int imx6_pcie_probe(struct platform_device *pdev) ret = dw_pcie_host_init(&pci->pp); if (ret < 0) - return ret; + goto err_vpcie; if (pci_msi_enabled()) { u8 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_MSI); @@ -1226,6 +1226,11 @@ static int imx6_pcie_probe(struct platform_device *pdev) } return 0; + +err_vpcie: + regulator_disable(imx6_pcie->vpcie); + + return ret; } static void imx6_pcie_shutdown(struct platform_device *pdev)