From patchwork Thu Aug 23 21:35:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 10574589 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D5AD85A4 for ; Thu, 23 Aug 2018 21:36:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEF432C665 for ; Thu, 23 Aug 2018 21:36:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1BE12C8A6; Thu, 23 Aug 2018 21:36:24 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 21C4D2C665 for ; Thu, 23 Aug 2018 21:36:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject: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=HhFB6Tu0DpqB6VjRxsER3ydWHysCQm9Q0oCb7ZMbtMk=; b=A5D Zi6D+vYVWhGk/potL1gylAeEJKdQkcVY4Kjc6UovXFUl7M4tHD8iXyMfFYFNOY1O2gas/TOq2xYfa K7ApsXNieqOPonat81RuiRawRWENFNcqH9bCgQPiGpU/YVaxVkQHy5/5zgtLNclCj8y7QCLqC/ISM wKuZHbJ/6KD2DGc/nBPwmpn+amtRTj1nTDyO8ZLJTnssp03XqDmyjVBOHWB7yZcHqpAdoBnAibVDc dc/QQyyunAorECmR6a2BkdLsxk1ZxhgdH1Nm83S3NyipIc7uTeE7+bRxSXsK8+KVHlW6mlWouZDtg 9cGD8ayBfHn0ppNJFPf+XoK7cezv3Yw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fsxHC-00010u-7C; Thu, 23 Aug 2018 21:36:22 +0000 Received: from mail.bootlin.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fsxH9-0000zQ-Ax for linux-arm-kernel@lists.infradead.org; Thu, 23 Aug 2018 21:36:20 +0000 Received: by mail.bootlin.com (Postfix, from userid 110) id 5187420750; Thu, 23 Aug 2018 23:36:07 +0200 (CEST) Received: from localhost (unknown [88.191.26.124]) by mail.bootlin.com (Postfix) with ESMTPSA id 27A26204AE; Thu, 23 Aug 2018 23:36:07 +0200 (CEST) From: Alexandre Belloni To: Li Yang Subject: [PATCH 1/2] soc: fsl: qbman: qman_portal: defer probing when qman is not available Date: Thu, 23 Aug 2018 23:35:59 +0200 Message-Id: <20180823213600.23426-1-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.18.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180823_143619_514984_AF296D73 X-CRM114-Status: UNSURE ( 9.48 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , Roy Pledge , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 If the qman driver (qman_ccsr) doesn't probe or fail to probe before qman_portal, qm_ccsr_start will be either NULL or a stale pointer to an unmapped page. This leads to a crash when probing qman_portal as the init_pcfg function calls qman_liodn_fixup that tries to read qman registers. Assume that qman didn't probe when the pool mask is 0. Signed-off-by: Alexandre Belloni Reviewed-by: Roy Pledge --- drivers/soc/fsl/qbman/qman_portal.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/soc/fsl/qbman/qman_portal.c b/drivers/soc/fsl/qbman/qman_portal.c index a120002b630e..4fc80d2c8feb 100644 --- a/drivers/soc/fsl/qbman/qman_portal.c +++ b/drivers/soc/fsl/qbman/qman_portal.c @@ -277,6 +277,8 @@ static int qman_portal_probe(struct platform_device *pdev) } pcfg->pools = qm_get_pools_sdqcr(); + if (pcfg->pools == 0) + return -EPROBE_DEFER; spin_lock(&qman_lock); cpu = cpumask_next_zero(-1, &portal_cpus);