From: Wei Yongjun <weiyj.lk@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>,
Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
Ksenija Stanojevic <ksenija.stanojevic@gmail.com>,
Lee Jones <lee.jones@linaro.org>, Marek Vasut <marex@denx.de>
Cc: Wei Yongjun <weiyongjun1@huawei.com>, linux-iio@vger.kernel.org
Subject: [PATCH -next v3] iio: adc: mxs-lradc: Fix return value check in mxs_lradc_adc_probe()
Date: Tue, 16 May 2017 15:26:12 +0000 [thread overview]
Message-ID: <20170516152612.19090-1-weiyj.lk@gmail.com> (raw)
In-Reply-To: <20170427151413.23843-1-weiyj.lk@gmail.com>
From: Wei Yongjun <weiyongjun1@huawei.com>
In case of error, the function devm_ioremap() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check should
be replaced with NULL test. Also add NULL test for iores.
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
v2 -> v3: use NULL test instead of devm_ioremap_resource()
---
drivers/iio/adc/mxs-lradc-adc.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c
index b0c7d8e..6888167 100644
--- a/drivers/iio/adc/mxs-lradc-adc.c
+++ b/drivers/iio/adc/mxs-lradc-adc.c
@@ -718,9 +718,12 @@ static int mxs_lradc_adc_probe(struct platform_device *pdev)
adc->dev = dev;
iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!iores)
+ return -EINVAL;
+
adc->base = devm_ioremap(dev, iores->start, resource_size(iores));
- if (IS_ERR(adc->base))
- return PTR_ERR(adc->base);
+ if (!adc->base)
+ return -ENOMEM;
init_completion(&adc->completion);
spin_lock_init(&adc->lock);
next prev parent reply other threads:[~2017-05-16 15:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-25 3:36 [PATCH -next] iio: adc: mxs-lradc: Fix return value check in mxs_lradc_adc_probe() Wei Yongjun
2017-04-26 5:23 ` Jonathan Cameron
2017-04-26 8:49 ` Lee Jones
2017-04-26 8:58 ` weiyongjun (A)
2017-04-26 10:07 ` Lee Jones
2017-04-26 10:28 ` weiyongjun (A)
2017-04-26 15:02 ` Jonathan Cameron
2017-04-27 15:14 ` [PATCH -next v2] " Wei Yongjun
2017-04-30 16:31 ` Jonathan Cameron
2017-05-01 22:22 ` Ksenija Stanojević
2017-05-02 1:43 ` weiyongjun (A)
2017-05-16 15:26 ` Wei Yongjun [this message]
2017-05-21 12:12 ` [PATCH -next v3] " Jonathan Cameron
2017-06-03 9:53 ` Jonathan Cameron
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=20170516152612.19090-1-weiyj.lk@gmail.com \
--to=weiyj.lk@gmail.com \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=ksenija.stanojevic@gmail.com \
--cc=lars@metafoo.de \
--cc=lee.jones@linaro.org \
--cc=linux-iio@vger.kernel.org \
--cc=marex@denx.de \
--cc=pmeerw@pmeerw.net \
--cc=weiyongjun1@huawei.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).