From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Mon, 11 Nov 2019 14:04:20 -0800 From: Bjorn Andersson Subject: Re: [PATCH v2] remoteproc: stm32: fix probe error case Message-ID: <20191111220416.GB3108315@builder> References: <1570433991-16353-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: <1570433991-16353-1-git-send-email-fabien.dessenne@st.com> 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 List-ID: On Mon 07 Oct 00:39 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 > --- > Changes since v1: test IS_ERR() before checking PTR_ERR() > --- > drivers/remoteproc/stm32_rproc.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_rproc.c > index 2cf4b29..a507332 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; > @@ -329,10 +329,14 @@ static void stm32_rproc_request_mbox(struct rproc *rproc) > > 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) > + return -EPROBE_DEFER; If for some reason you get EPROBE_DEFER when i > 0 you need to mbox_free_channel() channels [0..i) before returning. Regards, Bjorn > 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 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.4 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBAB6C43331 for ; Mon, 11 Nov 2019 22:04:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A3EDF21783 for ; Mon, 11 Nov 2019 22:04:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="fL7Vo58n" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726955AbfKKWEV (ORCPT ); Mon, 11 Nov 2019 17:04:21 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:34731 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726845AbfKKWEV (ORCPT ); Mon, 11 Nov 2019 17:04:21 -0500 Received: by mail-pg1-f193.google.com with SMTP id z188so4409966pgb.1 for ; Mon, 11 Nov 2019 14:04:20 -0800 (PST) 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=b6mNCX/KX4boUEtiC4AfiPV9MtFO5pIWwbz7PSRKAGA=; b=fL7Vo58nzJhGzD6mdJp1QeRvNGKLgdPvqHWFIW8gS1JkcmXyMkkZooq1lWwqynq6jy ye9GJKZGGhLs5Gl1BIidWCcJcwsg4S0ZHHYBS64Ac3uKvYlrHTkQ+YaNa+zP4iWIxUyl NKdUycwDJ1c5ARuP1+Hb8YD8aOl+oAgsTQ4s5Syi1t0XHfH8GII5MHsizKKYIGa0uj4S K0Jrl3XwFs7A2XZMG1qY6oo8LcTv7dHjA6fJPAM+ofy8gUxtLY6AqOsZ+g7CnDF7+caI ueNzcWI2NWy5M4toTT7ymIUUoTzAMD2T1uPphNtcdZ8XBjTU7tafFBd5QVB8ZTtOarMA MRjw== 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=b6mNCX/KX4boUEtiC4AfiPV9MtFO5pIWwbz7PSRKAGA=; b=naqSI8n/Wbs5ERZ4SxraAfyGjmYhIPyIOA4Aaoix0K36v8sF6u6EaqQbRWRoucT7ON ycOemNIlhL8LZjEXIRzD5D/b0USZSAHI7F0pJVWpt9DzfTO6RFP6pf/uvBEdkMMKI+Lr pgIgOwIxducwA893OCDo1muzYGDeEbNtFYFtFZDTJ89PKaR206OcWp5rqk96OzOSm7By YIUWo1wwdOxwkw/BqvCdkN/sG4qtDK/i9DAxg2mVOY564pzyNRBxSWkjUIoq0nIXte05 PKSZR4TBRvusGc7nG5jP57wzXe2ZfgEKEPSh5DdZULYWvVAJnY33IyPwDKy2l+oeaW8R 40BQ== X-Gm-Message-State: APjAAAUkUAaeabyY8wEZoDUSMauJCIAbg1CrRCw7M4UTbWMb0uxc58TT 6Uu85lgfdP0a+83UjwYycTxVbsSH3ms= X-Google-Smtp-Source: APXvYqyWTI6bisXzwWbs7tADpWb7qCtkjIYrZwQXbVFK2S/mZ3Li94In+tKU3yps+tF5SFtBvVa+6g== X-Received: by 2002:aa7:870c:: with SMTP id b12mr32518116pfo.30.1573509860257; Mon, 11 Nov 2019 14:04:20 -0800 (PST) Received: from builder (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id f19sm11173159pfk.109.2019.11.11.14.04.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Nov 2019 14:04:19 -0800 (PST) Date: Mon, 11 Nov 2019 14:04:16 -0800 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 v2] remoteproc: stm32: fix probe error case Message-ID: <20191111220416.GB3108315@builder> References: <1570433991-16353-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: <1570433991-16353-1-git-send-email-fabien.dessenne@st.com> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 07 Oct 00:39 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 > --- > Changes since v1: test IS_ERR() before checking PTR_ERR() > --- > drivers/remoteproc/stm32_rproc.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_rproc.c > index 2cf4b29..a507332 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; > @@ -329,10 +329,14 @@ static void stm32_rproc_request_mbox(struct rproc *rproc) > > 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) > + return -EPROBE_DEFER; If for some reason you get EPROBE_DEFER when i > 0 you need to mbox_free_channel() channels [0..i) before returning. Regards, Bjorn > 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 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74D70C43331 for ; Mon, 11 Nov 2019 22:04:25 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 462EE21783 for ; Mon, 11 Nov 2019 22:04:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hf06ibWB"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="fL7Vo58n" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 462EE21783 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RbusEyE81E7UiNYlKML66/wf3DFGNyQD9ivgtJ9nmWA=; b=hf06ibWBB662h7 4wG/WBucm4IDGnQ5Tg8Ey6ICCWQQzmDtFKkTMXabAD0pP99DHjLstH3sILrpJXOQA+i1V9SqdU2V2 KuY1gBidpP8PdAcVSd6JweRXtIzIHkefwlu01l+K1FqxJ+qomfCpRx5cIGCtAYtRxP9tjSO+mBlKj OS8NwUXRZa3eLhvDXq/n4wB1QyBSNbsZsIO+Azk1+l+oQsBiurUqJhXigXNsuauafJ/SXMTiZY6an 8ykdAozT650dqtO+yYtxTol8wN7mK1aiS1ehca1KdSp9O+3eGtU/A4Qb3hAjPDw6z89UeMjZWaOwa G2cb/qhcZ71MOViPne5A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iUHnM-00024T-CX; Mon, 11 Nov 2019 22:04:24 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iUHnJ-000242-Kg for linux-arm-kernel@lists.infradead.org; Mon, 11 Nov 2019 22:04:22 +0000 Received: by mail-pf1-x442.google.com with SMTP id x28so11650456pfo.6 for ; Mon, 11 Nov 2019 14:04:20 -0800 (PST) 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=b6mNCX/KX4boUEtiC4AfiPV9MtFO5pIWwbz7PSRKAGA=; b=fL7Vo58nzJhGzD6mdJp1QeRvNGKLgdPvqHWFIW8gS1JkcmXyMkkZooq1lWwqynq6jy ye9GJKZGGhLs5Gl1BIidWCcJcwsg4S0ZHHYBS64Ac3uKvYlrHTkQ+YaNa+zP4iWIxUyl NKdUycwDJ1c5ARuP1+Hb8YD8aOl+oAgsTQ4s5Syi1t0XHfH8GII5MHsizKKYIGa0uj4S K0Jrl3XwFs7A2XZMG1qY6oo8LcTv7dHjA6fJPAM+ofy8gUxtLY6AqOsZ+g7CnDF7+caI ueNzcWI2NWy5M4toTT7ymIUUoTzAMD2T1uPphNtcdZ8XBjTU7tafFBd5QVB8ZTtOarMA MRjw== 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=b6mNCX/KX4boUEtiC4AfiPV9MtFO5pIWwbz7PSRKAGA=; b=CN7oCItExM1cKtds9+8O63BNRA5KGmz7KyNwP5yL7EYYrbW7JJMCpH259uRN/gFTFq ezBtCHB9CHM4v5KIbVcFDlbmSpONtyIRTw4uZ8f9Gdxe+YpMyH3UtnzQWe/VDDgxEVEv 0YlWlUvDpXAgZjTUpgrGnw0GQx3Rbvrh13DFPgzIzuXos95vi6vJv6UdHYzLC6ra9ES3 bsK6ck13GnrMiAR9fsbz/79zoh5eCQfeMsmQSvog1da95KOP0K+MDxRXXNy5AzHD81IK HWJ4EB5+TSYaOUyKfWEPQx0M0/8nDnpLbhIbBCfgE6ZFXb2GapAkMfaHB8oAT0TH5xk7 DIiw== X-Gm-Message-State: APjAAAVfCr+OGn7rAQJRnO4FuHczNcakz1JTBOWzQnL/3d1+Ny/dPRJS sMdmCE/gqSw/Tus/ktFE49kW7g== X-Google-Smtp-Source: APXvYqyWTI6bisXzwWbs7tADpWb7qCtkjIYrZwQXbVFK2S/mZ3Li94In+tKU3yps+tF5SFtBvVa+6g== X-Received: by 2002:aa7:870c:: with SMTP id b12mr32518116pfo.30.1573509860257; Mon, 11 Nov 2019 14:04:20 -0800 (PST) Received: from builder (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id f19sm11173159pfk.109.2019.11.11.14.04.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Nov 2019 14:04:19 -0800 (PST) Date: Mon, 11 Nov 2019 14:04:16 -0800 From: Bjorn Andersson To: Fabien Dessenne Subject: Re: [PATCH v2] remoteproc: stm32: fix probe error case Message-ID: <20191111220416.GB3108315@builder> References: <1570433991-16353-1-git-send-email-fabien.dessenne@st.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1570433991-16353-1-git-send-email-fabien.dessenne@st.com> User-Agent: Mutt/1.12.2 (2019-09-21) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191111_140421_711051_57874530 X-CRM114-Status: GOOD ( 18.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ohad Ben-Cohen , Alexandre Torgue , Loic Pallardy , Arnaud Pouliquen , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, Maxime Coquelin , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon 07 Oct 00:39 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 > --- > Changes since v1: test IS_ERR() before checking PTR_ERR() > --- > drivers/remoteproc/stm32_rproc.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_rproc.c > index 2cf4b29..a507332 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; > @@ -329,10 +329,14 @@ static void stm32_rproc_request_mbox(struct rproc *rproc) > > 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) > + return -EPROBE_DEFER; If for some reason you get EPROBE_DEFER when i > 0 you need to mbox_free_channel() channels [0..i) before returning. Regards, Bjorn > 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 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel