Skip to content

Commit

Permalink
pinctrl: digicolor: convert null test to IS_ERR test
Browse files Browse the repository at this point in the history
Since commit 323de9e ("pinctrl: make pinctrl_register() return proper
error code"), pinctrl_register returns an error code rather than NULL on
failure.  Update a driver that was introduced more recently.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e,e1,e2;
@@

e = pinctrl_register(...)
... when != e = e1
if (
-   e == NULL
+   IS_ERR(e)
   ) {
     ...
     return
-      e2
+      PTR_ERR(e)
     ;
     }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Julia Lawall authored and Linus Walleij committed Sep 14, 2015
1 parent d259ec2 commit 5a99233
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/pinctrl/pinctrl-digicolor.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,9 @@ static int dc_pinctrl_probe(struct platform_device *pdev)
pmap->dev = &pdev->dev;

pmap->pctl = pinctrl_register(pctl_desc, &pdev->dev, pmap);
if (!pmap->pctl) {
if (IS_ERR(pmap->pctl)) {
dev_err(&pdev->dev, "pinctrl driver registration failed\n");
return -EINVAL;
return PTR_ERR(pmap->pctl);
}

ret = dc_gpiochip_add(pmap, pdev->dev.of_node);
Expand Down

0 comments on commit 5a99233

Please sign in to comment.