All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pinctrl: stm32: Modify error handling for pinctrl_register
@ 2016-06-27 14:23 ` Amitoj Kaur Chawla
  0 siblings, 0 replies; 5+ messages in thread
From: Amitoj Kaur Chawla @ 2016-06-27 14:23 UTC (permalink / raw)
  To: linus.walleij, mcoquelin.stm32, linux-gpio, linux-arm-kernel,
	linux-kernel
  Cc: julia.lawall

pinctrl_register returns an ERR_PTR on error.

The Coccinelle semantic patch used to make this change is as follows:

@@
expression e,e1,e2;
@@

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

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
 drivers/pinctrl/stm32/pinctrl-stm32.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
index 8deb566..857bb3d 100644
--- a/drivers/pinctrl/stm32/pinctrl-stm32.c
+++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
@@ -814,9 +814,9 @@ int stm32_pctl_probe(struct platform_device *pdev)
 	pctl->dev = &pdev->dev;
 
 	pctl->pctl_dev = pinctrl_register(&pctl->pctl_desc, &pdev->dev, pctl);
-	if (!pctl->pctl_dev) {
+	if (IS_ERR(pctl->pctl_dev)) {
 		dev_err(&pdev->dev, "Failed pinctrl registration\n");
-		return -EINVAL;
+		return PTR_ERR(pctl->pctl_dev);
 	}
 
 	for (i = 0; i < pctl->nbanks; i++)
-- 
1.9.1


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

* [PATCH] pinctrl: stm32: Modify error handling for pinctrl_register
@ 2016-06-27 14:23 ` Amitoj Kaur Chawla
  0 siblings, 0 replies; 5+ messages in thread
From: Amitoj Kaur Chawla @ 2016-06-27 14:23 UTC (permalink / raw)
  To: linux-arm-kernel

pinctrl_register returns an ERR_PTR on error.

The Coccinelle semantic patch used to make this change is as follows:

@@
expression e,e1,e2;
@@

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

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
 drivers/pinctrl/stm32/pinctrl-stm32.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
index 8deb566..857bb3d 100644
--- a/drivers/pinctrl/stm32/pinctrl-stm32.c
+++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
@@ -814,9 +814,9 @@ int stm32_pctl_probe(struct platform_device *pdev)
 	pctl->dev = &pdev->dev;
 
 	pctl->pctl_dev = pinctrl_register(&pctl->pctl_desc, &pdev->dev, pctl);
-	if (!pctl->pctl_dev) {
+	if (IS_ERR(pctl->pctl_dev)) {
 		dev_err(&pdev->dev, "Failed pinctrl registration\n");
-		return -EINVAL;
+		return PTR_ERR(pctl->pctl_dev);
 	}
 
 	for (i = 0; i < pctl->nbanks; i++)
-- 
1.9.1

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

* Re: [PATCH] pinctrl: stm32: Modify error handling for pinctrl_register
  2016-06-27 14:23 ` Amitoj Kaur Chawla
  (?)
@ 2016-06-29  8:33   ` Linus Walleij
  -1 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2016-06-29  8:33 UTC (permalink / raw)
  To: Amitoj Kaur Chawla
  Cc: Maxime Coquelin, linux-gpio, linux-arm-kernel, linux-kernel,
	Julia Lawall

On Mon, Jun 27, 2016 at 4:23 PM, Amitoj Kaur Chawla
<amitoj1606@gmail.com> wrote:

> pinctrl_register returns an ERR_PTR on error.
>
> The Coccinelle semantic patch used to make this change is as follows:
>
> @@
> expression e,e1,e2;
> @@
>
> e = pinctrl_register(...)
> ... when != e = e1
> if (
> -   e == NULL
> +   IS_ERR(e)
>    ) {
>      ...
>      return
> -      e2
> +      PTR_ERR(e)
>      ;
>      }
>
> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>

I already have a patch like this in my tree it seems.

But very nice that cocinelle is now finding this!

Yours,
Linus Walleij

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

* Re: [PATCH] pinctrl: stm32: Modify error handling for pinctrl_register
@ 2016-06-29  8:33   ` Linus Walleij
  0 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2016-06-29  8:33 UTC (permalink / raw)
  To: Amitoj Kaur Chawla
  Cc: Maxime Coquelin, linux-gpio, linux-arm-kernel, linux-kernel,
	Julia Lawall

On Mon, Jun 27, 2016 at 4:23 PM, Amitoj Kaur Chawla
<amitoj1606@gmail.com> wrote:

> pinctrl_register returns an ERR_PTR on error.
>
> The Coccinelle semantic patch used to make this change is as follows:
>
> @@
> expression e,e1,e2;
> @@
>
> e = pinctrl_register(...)
> ... when != e = e1
> if (
> -   e == NULL
> +   IS_ERR(e)
>    ) {
>      ...
>      return
> -      e2
> +      PTR_ERR(e)
>      ;
>      }
>
> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>

I already have a patch like this in my tree it seems.

But very nice that cocinelle is now finding this!

Yours,
Linus Walleij

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

* [PATCH] pinctrl: stm32: Modify error handling for pinctrl_register
@ 2016-06-29  8:33   ` Linus Walleij
  0 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2016-06-29  8:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jun 27, 2016 at 4:23 PM, Amitoj Kaur Chawla
<amitoj1606@gmail.com> wrote:

> pinctrl_register returns an ERR_PTR on error.
>
> The Coccinelle semantic patch used to make this change is as follows:
>
> @@
> expression e,e1,e2;
> @@
>
> e = pinctrl_register(...)
> ... when != e = e1
> if (
> -   e == NULL
> +   IS_ERR(e)
>    ) {
>      ...
>      return
> -      e2
> +      PTR_ERR(e)
>      ;
>      }
>
> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>

I already have a patch like this in my tree it seems.

But very nice that cocinelle is now finding this!

Yours,
Linus Walleij

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

end of thread, other threads:[~2016-06-29  8:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-27 14:23 [PATCH] pinctrl: stm32: Modify error handling for pinctrl_register Amitoj Kaur Chawla
2016-06-27 14:23 ` Amitoj Kaur Chawla
2016-06-29  8:33 ` Linus Walleij
2016-06-29  8:33   ` Linus Walleij
2016-06-29  8:33   ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.