From: Olof Johansson <olof@lixom.net>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Li Yang <leoyang.li@nxp.com>, Roy Pledge <roy.pledge@nxp.com>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
Linux ARM Mailing List <linux-arm-kernel@lists.infradead.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] soc: fsl: qbman: qman_portal: defer probing when qman is not available
Date: Tue, 25 Sep 2018 21:45:56 +0200 [thread overview]
Message-ID: <CAOesGMjDKKSNVccu4D579SiwL9zEU7ha7HQCHncvh2r4kpO6fQ@mail.gmail.com> (raw)
In-Reply-To: <20180823213600.23426-1-alexandre.belloni@bootlin.com>
Hi,
On Thu, Aug 23, 2018 at 11:36 PM Alexandre Belloni
<alexandre.belloni@bootlin.com> 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 <alexandre.belloni@bootlin.com>
> ---
> 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.
-Olof
next prev parent reply other threads:[~2018-09-25 19:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-23 21:35 [PATCH 1/2] soc: fsl: qbman: qman_portal: defer probing when qman is not available Alexandre Belloni
2018-08-23 21:36 ` [PATCH 2/2] soc: fsl: qbman: qman: avoid allocating from non existing gen_pool Alexandre Belloni
2018-08-24 14:53 ` Roy Pledge
2018-08-24 14:52 ` [PATCH 1/2] soc: fsl: qbman: qman_portal: defer probing when qman is not available Roy Pledge
2018-08-28 22:49 ` Li Yang
2018-09-25 19:45 ` Olof Johansson [this message]
2018-09-25 22:11 ` Li Yang
2018-09-26 9:27 ` Alexandre Belloni
2018-09-26 18:15 ` Li Yang
2018-09-27 19:24 ` Li Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAOesGMjDKKSNVccu4D579SiwL9zEU7ha7HQCHncvh2r4kpO6fQ@mail.gmail.com \
--to=olof@lixom.net \
--cc=alexandre.belloni@bootlin.com \
--cc=leoyang.li@nxp.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=roy.pledge@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).