From: Dan Carpenter <dan.carpenter@oracle.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
aisheng.dong@nxp.com, festevam@gmail.com, shawnguo@kernel.org,
stefan@agner.ch, kernel@pengutronix.de, linus.walleij@linaro.org,
s.hauer@pengutronix.de, linux-imx@nxp.com, aalonso@freescale.com,
linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] pinctrl: freescale: imx: Use 'devm_of_iomap()' to avoid a resource leak in case of error in 'imx_pinctrl_probe()'
Date: Mon, 15 Jun 2020 15:15:20 +0300 [thread overview]
Message-ID: <20200615121520.GK4282@kadam> (raw)
In-Reply-To: <20200613154954.GA98985@roeck-us.net>
On Sat, Jun 13, 2020 at 08:49:54AM -0700, Guenter Roeck wrote:
> On Tue, Jun 02, 2020 at 10:06:26PM +0200, Christophe JAILLET wrote:
> > Use 'devm_of_iomap()' instead 'of_iomap()' to avoid a resource leak in
> > case of error.
> >
> > Update the error handling code accordingly.
> >
> > Fixes: 26d8cde5260b ("pinctrl: freescale: imx: add shared input select reg support")
> > Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
> > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>
> When booting mcimx7d-sabre in qemu, his patch results in:
>
> [ 1.835341] imx7d-pinctrl 302c0000.iomuxc-lpsr: initialized IMX pinctrl driver
> [ 1.839702] imx7d-pinctrl 30330000.pinctrl: can't request region for resource [mem 0x30330000-0x3033ffff]
> [ 1.840261] imx7d-pinctrl: probe of 30330000.pinctrl failed with error -16
Yeah. Sorry about that. We had to revert that patch.
The problem is that that devm_of_iomap() tracks if the regions are
already used and of_iomap() does not. In this case there were two
places mapping the same memory. I added a comment about that to the
devm_of_iomap() so hopefully we won't introduce bugs like this in the
future.
regards,
dan carpenter
prev parent reply other threads:[~2020-06-15 12:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-02 20:06 [PATCH] pinctrl: freescale: imx: Use 'devm_of_iomap()' to avoid a resource leak in case of error in 'imx_pinctrl_probe()' Christophe JAILLET
2020-06-03 10:52 ` Dan Carpenter
2020-06-03 12:36 ` Linus Walleij
2020-06-13 15:49 ` Guenter Roeck
2020-06-15 12:15 ` Dan Carpenter [this message]
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=20200615121520.GK4282@kadam \
--to=dan.carpenter@oracle.com \
--cc=aalonso@freescale.com \
--cc=aisheng.dong@nxp.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=linux@roeck-us.net \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=stefan@agner.ch \
/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).