[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7kLa83nF-ufh-AGA_LpBQ6M-ErUf-LEVXANxL2LmirJAh-snvVtJLTVFkBKFxaHvIH9Vi1E3iXDmxW6Ijktoo6k1S7pyFrwmVVLkhKr4Q_Q=@aurabindo.in>
Date: Tue, 17 Sep 2019 09:58:13 +0000
From: Aurabindo Jayamohanan <mail@...abindo.in>
To: Baolin Wang <baolin.wang@...aro.org>
Cc: Mark Brown <broonie@...nel.org>,
"palmer@...ive.com" <palmer@...ive.com>,
"paul.walmsley@...ive.com" <paul.walmsley@...ive.com>,
linux-spi <linux-spi@...r.kernel.org>,
"linux-riscv@...ts.infradead.org" <linux-riscv@...ts.infradead.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] spi: sifive: check return value for platform_get_resource()
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Tuesday, September 17, 2019 2:53 PM, Baolin Wang <baolin.wang@...aro.org> wrote:
> On Tue, 17 Sep 2019 at 17:12, Aurabindo Jayamohanan mail@...abindo.in wrote:
>
> > platform_get_resource() may return NULL. If it is so, return -ENXIO
> >
> > Signed-off-by: Aurabindo Jayamohanan mail@...abindo.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.
>
Okay, thanks for the headsup
Powered by blists - more mailing lists