* [PATCH] input: touchscreen: mxs-lradc: Use devm_ioremap_resource()
@ 2017-06-21 14:03 Fabio Estevam
2017-06-22 2:44 ` Fabio Estevam
0 siblings, 1 reply; 2+ messages in thread
From: Fabio Estevam @ 2017-06-21 14:03 UTC (permalink / raw)
To: dmitry.torokhov
Cc: festevam, marex, ksenija.stanojevic, linux-input, Fabio Estevam
In case of error devm_ioremap() returns NULL pointer not ERR_PTR().
The iores NULL check is also missing.
Fix both problems by using devm_ioremap_resource() variant instead.
Fixes: d81ca730e3e4 ("input: touchscreen: mxs-lradc: Add support for touchscreen")
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
drivers/input/touchscreen/mxs-lradc-ts.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c
index 58c016c..0f8c9e7 100644
--- a/drivers/input/touchscreen/mxs-lradc-ts.c
+++ b/drivers/input/touchscreen/mxs-lradc-ts.c
@@ -630,7 +630,7 @@ static int mxs_lradc_ts_probe(struct platform_device *pdev)
spin_lock_init(&ts->lock);
iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- ts->base = devm_ioremap(dev, iores->start, resource_size(iores));
+ ts->base = devm_ioremap_resource(dev, iores);
if (IS_ERR(ts->base))
return PTR_ERR(ts->base);
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] input: touchscreen: mxs-lradc: Use devm_ioremap_resource()
2017-06-21 14:03 [PATCH] input: touchscreen: mxs-lradc: Use devm_ioremap_resource() Fabio Estevam
@ 2017-06-22 2:44 ` Fabio Estevam
0 siblings, 0 replies; 2+ messages in thread
From: Fabio Estevam @ 2017-06-22 2:44 UTC (permalink / raw)
To: Fabio Estevam
Cc: Dmitry Torokhov, Marek Vasut, Ksenija Stanojevic, linux-input
On Wed, Jun 21, 2017 at 11:03 AM, Fabio Estevam <fabio.estevam@nxp.com> wrote:
> In case of error devm_ioremap() returns NULL pointer not ERR_PTR().
>
> The iores NULL check is also missing.
>
> Fix both problems by using devm_ioremap_resource() variant instead.
>
> Fixes: d81ca730e3e4 ("input: touchscreen: mxs-lradc: Add support for touchscreen")
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
> ---
> drivers/input/touchscreen/mxs-lradc-ts.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c
> index 58c016c..0f8c9e7 100644
> --- a/drivers/input/touchscreen/mxs-lradc-ts.c
> +++ b/drivers/input/touchscreen/mxs-lradc-ts.c
> @@ -630,7 +630,7 @@ static int mxs_lradc_ts_probe(struct platform_device *pdev)
> spin_lock_init(&ts->lock);
>
> iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - ts->base = devm_ioremap(dev, iores->start, resource_size(iores));
> + ts->base = devm_ioremap_resource(dev, iores);
> if (IS_ERR(ts->base))
> return PTR_ERR(ts->base);
It seems we cannot use devm_ioremap_resource() in this case as it
shares the resources with the lradc driver:
http://www.spinics.net/lists/linux-iio/msg32864.html
I will send a v2 that does a NULL check on iores.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-06-22 2:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-21 14:03 [PATCH] input: touchscreen: mxs-lradc: Use devm_ioremap_resource() Fabio Estevam
2017-06-22 2:44 ` Fabio Estevam
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).