Skip to content

Commit

Permalink
pinctrl: qcom: ssbi: 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 some drivers that were 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>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Julia Lawall authored and Linus Walleij committed Sep 14, 2015
1 parent 6ff33f3 commit d259ec2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -723,9 +723,9 @@ static int pm8xxx_gpio_probe(struct platform_device *pdev)
#endif

pctrl->pctrl = pinctrl_register(&pctrl->desc, &pdev->dev, pctrl);
if (!pctrl->pctrl) {
if (IS_ERR(pctrl->pctrl)) {
dev_err(&pdev->dev, "couldn't register pm8xxx gpio driver\n");
return -ENODEV;
return PTR_ERR(pctrl->pctrl);
}

pctrl->chip = pm8xxx_gpio_template;
Expand Down
4 changes: 2 additions & 2 deletions drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c
Original file line number Diff line number Diff line change
Expand Up @@ -814,9 +814,9 @@ static int pm8xxx_mpp_probe(struct platform_device *pdev)
#endif

pctrl->pctrl = pinctrl_register(&pctrl->desc, &pdev->dev, pctrl);
if (!pctrl->pctrl) {
if (IS_ERR(pctrl->pctrl)) {
dev_err(&pdev->dev, "couldn't register pm8xxx mpp driver\n");
return -ENODEV;
return PTR_ERR(pctrl->pctrl);
}

pctrl->chip = pm8xxx_mpp_template;
Expand Down

0 comments on commit d259ec2

Please sign in to comment.