linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* input: touchscreen: mxs-lradc: use correct error check
@ 2017-08-08 13:00 Pan Bian
  2017-08-14 17:30 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Pan Bian @ 2017-08-08 13:00 UTC (permalink / raw)
  To: Dmitry Torokhov, Lee Jones, Ksenija Stanojevic, Marek Vasut,
	Dan Carpenter
  Cc: linux-input, linux-kernel, Pan Bian

Function devm_ioremap() will return a NULL pointer on failure. However,
in function mxs_lradc_ts_probe(), its return value is checked with
IS_ERR(), which cannot detect the exceptional case.

Signed-off-by: Pan Bian <bianpan2016@163.com>
---
 drivers/input/touchscreen/mxs-lradc-ts.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c
index 58c016c..9bcc98c6 100644
--- a/drivers/input/touchscreen/mxs-lradc-ts.c
+++ b/drivers/input/touchscreen/mxs-lradc-ts.c
@@ -631,8 +631,8 @@ static int mxs_lradc_ts_probe(struct platform_device *pdev)
 
 	iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	ts->base = devm_ioremap(dev, iores->start, resource_size(iores));
-	if (IS_ERR(ts->base))
-		return PTR_ERR(ts->base);
+	if (!ts->base)
+		return -ENOMEM;
 
 	ret = of_property_read_u32(node, "fsl,lradc-touchscreen-wires",
 				   &ts_wires);
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: input: touchscreen: mxs-lradc: use correct error check
  2017-08-08 13:00 input: touchscreen: mxs-lradc: use correct error check Pan Bian
@ 2017-08-14 17:30 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2017-08-14 17:30 UTC (permalink / raw)
  To: Pan Bian
  Cc: Lee Jones, Ksenija Stanojevic, Marek Vasut, Dan Carpenter,
	linux-input, linux-kernel

On Tue, Aug 08, 2017 at 09:00:37PM +0800, Pan Bian wrote:
> Function devm_ioremap() will return a NULL pointer on failure. However,
> in function mxs_lradc_ts_probe(), its return value is checked with
> IS_ERR(), which cannot detect the exceptional case.
> 
> Signed-off-by: Pan Bian <bianpan2016@163.com>

Applied, thank you.

> ---
>  drivers/input/touchscreen/mxs-lradc-ts.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c
> index 58c016c..9bcc98c6 100644
> --- a/drivers/input/touchscreen/mxs-lradc-ts.c
> +++ b/drivers/input/touchscreen/mxs-lradc-ts.c
> @@ -631,8 +631,8 @@ static int mxs_lradc_ts_probe(struct platform_device *pdev)
>  
>  	iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	ts->base = devm_ioremap(dev, iores->start, resource_size(iores));
> -	if (IS_ERR(ts->base))
> -		return PTR_ERR(ts->base);
> +	if (!ts->base)
> +		return -ENOMEM;
>  
>  	ret = of_property_read_u32(node, "fsl,lradc-touchscreen-wires",
>  				   &ts_wires);
> -- 
> 1.9.1
> 
> 

-- 
Dmitry

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-08-14 17:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-08 13:00 input: touchscreen: mxs-lradc: use correct error check Pan Bian
2017-08-14 17:30 ` Dmitry Torokhov

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).