Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2119740imm; Thu, 23 Aug 2018 14:38:33 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzFtoKFOeRJSlQNVQxmFvCHIMuut5rBhkvzLpXk7oFgHzwwNWIRfcCuNFqmXsqZKtczvhuY X-Received: by 2002:a17:902:bf04:: with SMTP id bi4-v6mr15952145plb.124.1535060313815; Thu, 23 Aug 2018 14:38:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535060313; cv=none; d=google.com; s=arc-20160816; b=tIk/U6iiplJhuUZzkNwnI52jGbYYKq0CWkhQxjvhib7fuxXeUtk6ckjZO4Ce2gwcMp FfPwJR4Iw1HoaZb62p36GPNcUREB71UkIzhYL0k22us3ENWtNFoPlRkEI0l14fI4xN0G /M0WYp00NnmKb6w3onWtD/pCOCWDlIOnaZP5tSbjoqIi9NVY69lcBQ/Zxd/2Bwy33BwF xncgPS/xsIApmFQ4YrwL9hxUR2tyGwU7rwpruHKhUuOEXKeA8oWrLyAqZsBS+q/urKul 59BpRDdsdsiQQonpWuJ5lJTyZ3Xks9u7RqY+K3vsjhyPxYzBxhyYu9pXUjc4cMb39MoG +3HQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=cdtFGusKEXFwfBokRPGXlwnvQGK1P18s1zWYgarnAXQ=; b=FEwh9f2qQQsVz4DzLWsElxKdm6M/8a4MMdPRqRCIX8J2HYjgVC2+m2jo5fDksnRz/M 32DghU39Z5Bpf5iSnBMz1nzmygICkIeBLWGxdupj3RoILkM903kFKQXLG1bYplvQV7OT ZUAYP4lLr4kpq1l80nOV9pk4kWIsR+pMitmTfW+xJNRDmTXNPY3A+UPYloYCJkEBXgj8 NNE+4soc+5HrsVaL3n1dloT7EvjG0T+UpENzdEqqVnIX6bPdVYWB3Mo8obZqyw18RJAk 8QF/CkYCU+tLsi4uC78godMFftkovyCknZi3WpI4hylGLxsI0iW8tGEvUQpOvopJ6xBP huMQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1-v6si5280323plw.99.2018.08.23.14.38.18; Thu, 23 Aug 2018 14:38:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728154AbeHXBHp (ORCPT + 99 others); Thu, 23 Aug 2018 21:07:45 -0400 Received: from mail.bootlin.com ([62.4.15.54]:50812 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727590AbeHXBHp (ORCPT ); Thu, 23 Aug 2018 21:07:45 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 5187420750; Thu, 23 Aug 2018 23:36:07 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 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 Cc: Roy Pledge , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Alexandre Belloni 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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); -- 2.18.0