diff mbox

[1/2] input: touchscreen: mxs-lradc: Checking for ERR_PTR instead of NULL in probe

Message ID 20170426210410.k2pe5ov2nkxtuf54@mwanda (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter April 26, 2017, 9:04 p.m. UTC
devm_ioremap() returns NULL on error.  It never returns error pointers.

Fixes: d81ca730e3e4 ("input: touchscreen: mxs-lradc: Add support for touchscreen")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Dmitry Torokhov April 26, 2017, 9:08 p.m. UTC | #1
Hi Dan,

On Wed, Apr 26, 2017 at 2:04 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> devm_ioremap() returns NULL on error.  It never returns error pointers.
>
> Fixes: d81ca730e3e4 ("input: touchscreen: mxs-lradc: Add support for touchscreen")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c
> index 4b4aebfe3e7f..ff9cda29d9a0 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);

As mentioned in another email I'd prefer we switched to
devm_ioremap_resource() instead.
diff mbox

Patch

diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c
index 4b4aebfe3e7f..ff9cda29d9a0 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);