Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1714640ybp; Fri, 4 Oct 2019 21:06:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqybQQ6RSDdASae2fxeVE/Y9jcxI+g1UJ26MaXXEzJLMSoZT1RW/e4cb+LcDHeccVS4sOHIP X-Received: by 2002:a17:907:20c4:: with SMTP id qq4mr15353265ejb.161.1570248371159; Fri, 04 Oct 2019 21:06:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570248371; cv=none; d=google.com; s=arc-20160816; b=B9ZsdH5mJc7niq+EcFR5+keJarg474DoXm5Eplerjxqhmqhm+TD/Hd8quzjyAr8Tc/ wWacmEe6SWUgDta44WcgEibe7B2A7oSM7/KhU3zc/3EZwUwI0woWzLt3JYuiAgNzVRhw OjM728TlPvEDhjqT+hbH1oEDft33Qm1Rz67GydrcqzNa/ym6EZ5WwNSRV2ZJxJPSSBi6 v8cEUIbose1adJRnl4imq8v2HNzCO8+Q3PaCOgXPH7Xh4D73MgNLK/UvnSg2sZTqVYq9 ALkRsz7/m7VaQhGu1vZQoVnyqMbKZmuIaJBs2Z+n2Ln7ELlYll+cPNANy+ye0QSoj6lw FM2A== 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:dkim-signature; bh=ep+T4ZjSmgVgmfOmjNJkzXbXl0FrJoxYAHDsSkcqpX0=; b=VrSfODbrbIvcHqfauxP0GxRKG3oN8VeisuVYXXJyNwkVBF3bntGKnBUAg4ZPX8RYun t9XYxYBvJyr1T/wk0wzBL9iZWVPaFKo7ogxEiVPAAwyJQsTPhX9gelMi9FAVtTAh72CL V7l84ajWJVjVG82wY7TQGuWZ8gBr1mskPbOFduDfxdRKRrJgScOZz0v1eonT6VKXp6v9 Q+cvRQ4n5TcZ9jgE7GUsjs3b4GL5A5l2D7IsGxSKi20q3LH8RtgS/qFHz2MRHSFDc5BQ ZJ/FjjIBhIZ5MT05R9L15E/7P6iSgKFebZ+cKiX/USI8WKoQgvRQ1m2vmxOdWGgjF2DL NOZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Ym13/luv"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v14si2833288ejw.424.2019.10.04.21.05.47; Fri, 04 Oct 2019 21:06:11 -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; dkim=pass header.i=@linaro.org header.s=google header.b="Ym13/luv"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726183AbfJEEDc (ORCPT + 99 others); Sat, 5 Oct 2019 00:03:32 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:39350 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725987AbfJEEDc (ORCPT ); Sat, 5 Oct 2019 00:03:32 -0400 Received: by mail-pf1-f196.google.com with SMTP id v4so5070279pff.6 for ; Fri, 04 Oct 2019 21:03:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ep+T4ZjSmgVgmfOmjNJkzXbXl0FrJoxYAHDsSkcqpX0=; b=Ym13/luvCh4HRz9APPjske1u+h0i1SJvJ/OhgaVzdzAtnKWjlspe8o7xEmP+7IbY7f sJcI8dgcp/8xe2szkey2GF1l42mvdGVRx2mI8/KL+8QXBgillBcxrPfY+6808U57GFeD S6JqnpqljXqfWpOYoBxju6COK3d8eNXCzpyqmu2I58UXR5daXXiBIZGqcxp/+f3eN+QZ SJkNy+5P/fpY17vkKSu5RAX8TK9qXn0UdH360eT+NJjnvoVFeeWCK5D9XR9we5BGFxCN 83vhwmNyiMbrxr6MLwb/bts1DpkdL9eTRdCA6Eu9mKObTZm/GSOgTo3ylyLrWc7e6Pdy 5M9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ep+T4ZjSmgVgmfOmjNJkzXbXl0FrJoxYAHDsSkcqpX0=; b=gFaAMJlDBm1D+lwyiTomTlM783LWBXCiCBdkLKcFXay8uEhxGx48xDaXBSNpNDBSUV Yy1fD6w80bg9tqeJm5XMceM6Ov62QRQJW95vlF5orkELSEvm3ZYQ5/9RYxMcCg3PWERz rkPCM2kUPTerpFgw3HYLDKPewCMfs6rXTahwIaswu2bxu4V0juYiCeiptJlJ5e/l7fp2 d2bSA9OKokHbnwpXDv9F+v3Q3YOaZn681/9v34HeuPn93RmA9g+OdsCfx1qPUqpEfbwi S73g2pavvUbB2HT2MBz0KQFUJ9Nu5laTW/mqhStY6wV2S91CgmV21roIZ02TTy7wp/Q0 o0LA== X-Gm-Message-State: APjAAAWkAOJRonzD4S8PttdA6uUCG68g9gj8BrpOZ4pPPL6orjvUavtG j2crfjsJ6I0E4qpJn7ymZf0ZslMmlwI= X-Received: by 2002:a17:90a:cb18:: with SMTP id z24mr20149664pjt.108.1570248209669; Fri, 04 Oct 2019 21:03:29 -0700 (PDT) Received: from tuxbook-pro (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id e14sm7692470pjt.8.2019.10.04.21.03.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Oct 2019 21:03:29 -0700 (PDT) Date: Fri, 4 Oct 2019 21:03:26 -0700 From: Bjorn Andersson To: Fabien Dessenne Cc: Maxime Coquelin , Alexandre Torgue , Ohad Ben-Cohen , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org, Loic Pallardy , Arnaud Pouliquen Subject: Re: [PATCH] remoteproc: stm32: fix probe error case Message-ID: <20191005040326.GB5189@tuxbook-pro> References: <1570190555-12465-1-git-send-email-fabien.dessenne@st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1570190555-12465-1-git-send-email-fabien.dessenne@st.com> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 04 Oct 05:02 PDT 2019, Fabien Dessenne wrote: > If the rproc driver is probed before the mailbox driver and if the rproc > Device Tree node has some mailbox properties, the rproc driver probe > shall be deferred instead of being probed without mailbox support. > > Signed-off-by: Fabien Dessenne > --- > drivers/remoteproc/stm32_rproc.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_rproc.c > index 2cf4b29..410b794 100644 > --- a/drivers/remoteproc/stm32_rproc.c > +++ b/drivers/remoteproc/stm32_rproc.c > @@ -310,7 +310,7 @@ static const struct stm32_mbox stm32_rproc_mbox[MBOX_NB_MBX] = { > } > }; > > -static void stm32_rproc_request_mbox(struct rproc *rproc) > +static int stm32_rproc_request_mbox(struct rproc *rproc) > { > struct stm32_rproc *ddata = rproc->priv; > struct device *dev = &rproc->dev; > @@ -328,11 +328,15 @@ static void stm32_rproc_request_mbox(struct rproc *rproc) > cl->dev = dev->parent; > > ddata->mb[i].chan = mbox_request_channel_byname(cl, name); > - if (IS_ERR(ddata->mb[i].chan)) { > + if (PTR_ERR(ddata->mb[i].chan) == -EPROBE_DEFER) { You may not use PTR_ERR() without first checking IS_ERR(), apart from that your patch looks good. Regards, Bjorn > + return -EPROBE_DEFER; > + } else if (IS_ERR(ddata->mb[i].chan)) { > dev_warn(dev, "cannot get %s mbox\n", name); > ddata->mb[i].chan = NULL; > } > } > + > + return 0; > } > > static int stm32_rproc_set_hold_boot(struct rproc *rproc, bool hold) > @@ -596,7 +600,9 @@ static int stm32_rproc_probe(struct platform_device *pdev) > if (ret) > goto free_rproc; > > - stm32_rproc_request_mbox(rproc); > + ret = stm32_rproc_request_mbox(rproc); > + if (ret) > + goto free_rproc; > > ret = rproc_add(rproc); > if (ret) > -- > 2.7.4 >