Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp512834imm; Wed, 26 Sep 2018 02:27:46 -0700 (PDT) X-Google-Smtp-Source: ACcGV60CEBpt8FUC83orY7m+DNBmrl4PaSN+dDrp7ln/zZnwa7VfBCc+m1xbJnOFXGYpy7KRoLu2 X-Received: by 2002:a17:902:6b44:: with SMTP id g4-v6mr5272567plt.50.1537954066799; Wed, 26 Sep 2018 02:27:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537954066; cv=none; d=google.com; s=arc-20160816; b=WTD+2Q6zXMnXYU4247FMRd0SulR7K4/ilrzNtUbI5ppoetsQ6M2jz6/GQ62UPfp1AL SuQpoptg6YdIXORPVqXLxITaJSxkERUzmhNApNeQdGmwiavR082ZRKFwC5gHccc0Eztb J9W1x4cQvumZaGORvTORzytNImwa0EK1uBQD6yKTw/+bXIrA8rA5bFEeyuc3TEY/CY6n 5aVIVY/pdYe2/hi7ZMPLx7QAPJiNK4vT9oaI/LCxbn5NY78jQdesqEwyqld4TMt5RtAJ tzzewL7D5MkvlfVNU5WdfNokFo7OvR3nu/enXubeUgrzzCLQjrmPQPnV5UyuN7pz+rYX +RZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=aGlxmV1NbmDvsRFh275oRPks74D2SLU2eVW2XkDuphM=; b=e6IKSY0QzgcsWO5ngMzpq9Ph0wMxCWHuVfDZK4YwQD+oBrWgFifVj6+azqqhQ7hS1E kr/CxnpLv3JxHP/QBLF87eCtIuSFWa3jUwIt6Q8hHrLF1/9kSVTlfaMcvX6s+CWvVaQp hBSOpoMmDNoSl5jJc1sdcYeWacrQNc38fDm8T6w1/eo0zCtLt9maHvkt0Yke6oZgNQw7 VRZXPYAawR9kgzDxsS+BGzl2mdCw6imVbYuu4ZzxcTeRd9IEHSwodju0reax36HSmb6s tuXRLR4c7IuvG93TVDXt7mRCmW+t63AdABbsaE6NnZjU70XX9xmp0j2fzhFfyp8GNlSw N9Rw== 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 w15-v6si4801224pgg.529.2018.09.26.02.27.30; Wed, 26 Sep 2018 02:27:46 -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 S1728107AbeIZPjW (ORCPT + 99 others); Wed, 26 Sep 2018 11:39:22 -0400 Received: from mail.bootlin.com ([62.4.15.54]:39220 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727157AbeIZPjW (ORCPT ); Wed, 26 Sep 2018 11:39:22 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 8F3E1206FF; Wed, 26 Sep 2018 11:27:17 +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, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (242.171.71.37.rev.sfr.net [37.71.171.242]) by mail.bootlin.com (Postfix) with ESMTPSA id DA8AF208A1; Wed, 26 Sep 2018 11:27:05 +0200 (CEST) Date: Wed, 26 Sep 2018 11:27:06 +0200 From: Alexandre Belloni To: Olof Johansson Cc: Li Yang , Roy Pledge , linuxppc-dev , Linux ARM Mailing List , Linux Kernel Mailing List Subject: Re: [PATCH 1/2] soc: fsl: qbman: qman_portal: defer probing when qman is not available Message-ID: <20180926092706.GA16644@piout.net> References: <20180823213600.23426-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25/09/2018 21:45:56+0200, Olof Johansson wrote: > Hi, > > > On Thu, Aug 23, 2018 at 11:36 PM Alexandre Belloni > wrote: > > > > 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; > > This is quite late in the probe, after a bunch of resources have been claimed. > > Note that the ioremaps above this are doing unwinds, and you'll end up > doing duplicate ioremaps if you come in and probe again. > > You should probably unwind those allocations, or move them to devm_* > or do this check earlier in the function. > The actual chance of having that happen is quite small (this was coming from a non working DT) and I mainly wanted to avoid a crash so the platform could still boot. I would think moving to devm_ would be the right thing to do. -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com