From: Paul Walmsley <paul.walmsley@sifive.com>
To: Baolin Wang <baolin.wang@linaro.org>,
Aurabindo Jayamohanan <mail@aurabindo.in>
Cc: Mark Brown <broonie@kernel.org>,
palmer@sifive.com, linux-spi <linux-spi@vger.kernel.org>,
linux-riscv@lists.infradead.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] spi: sifive: check return value for platform_get_resource()
Date: Tue, 17 Sep 2019 05:15:26 -0700 (PDT) [thread overview]
Message-ID: <alpine.DEB.2.21.9999.1909170514130.11980@viisi.sifive.com> (raw)
In-Reply-To: <CAMz4kuJczzjTPSohQ=kbZ0Pr7U_9-hzXk-jPgKk79PENOM1-dA@mail.gmail.com>
On Tue, 17 Sep 2019, Baolin Wang wrote:
> On Tue, 17 Sep 2019 at 17:12, Aurabindo Jayamohanan <mail@aurabindo.in> wrote:
> >
> > platform_get_resource() may return NULL. If it is so, return -ENXIO
> >
> > Signed-off-by: Aurabindo Jayamohanan <mail@aurabindo.in>
> > ---
> > drivers/spi/spi-sifive.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/spi/spi-sifive.c b/drivers/spi/spi-sifive.c
> > index 93ec2c6cdbfd..67485067a694 100644
> > --- a/drivers/spi/spi-sifive.c
> > +++ b/drivers/spi/spi-sifive.c
> > @@ -308,6 +308,12 @@ static int sifive_spi_probe(struct platform_device *pdev)
> > platform_set_drvdata(pdev, master);
> >
> > res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > + if (!res) {
> > + dev_err(&pdev->dev, "no IOMEM resource found\n");
> > + ret = -ENXIO;
> > + goto put_master;
> > + }
>
> Seems unnecessary, the devm_ioremap_resource() already validated if
> the resource is available.
Just doublechecked lib/devres.c and I agree with you.
Aurobindo, is this a patch for a real problem that you've encountered?
- Paul
next prev parent reply other threads:[~2019-09-17 12:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-17 9:12 [PATCH] spi: sifive: check return value for platform_get_resource() Aurabindo Jayamohanan
2019-09-17 9:18 ` Paul Walmsley
2019-09-17 9:23 ` Baolin Wang
2019-09-17 9:58 ` Aurabindo Jayamohanan
2019-09-17 12:15 ` Paul Walmsley [this message]
2019-09-17 13:07 ` Geert Uytterhoeven
2019-09-17 14:06 ` Aurabindo Jayamohanan
2019-09-17 14:11 ` Paul Walmsley
2019-09-17 15:21 ` Paul Walmsley
2019-09-17 17:13 ` Aurabindo Jayamohanan
-- strict thread matches above, loose matches on Subject: below --
2019-09-17 9:12 Aurabindo Jayamohanan
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=alpine.DEB.2.21.9999.1909170514130.11980@viisi.sifive.com \
--to=paul.walmsley@sifive.com \
--cc=baolin.wang@linaro.org \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-spi@vger.kernel.org \
--cc=mail@aurabindo.in \
--cc=palmer@sifive.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).