All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pinctrl: berlin: fix return value for dev_get_regmap
@ 2014-06-29  7:18 Himangi Saraogi
  2014-06-30  9:34 ` Sebastian Hesselbarth
  0 siblings, 1 reply; 2+ messages in thread
From: Himangi Saraogi @ 2014-06-29  7:18 UTC (permalink / raw)
  To: Linus Walleij, linux-kernel; +Cc: julia.lawall

The failure value of dev_get_regmap is NULL. Hence, the return value is
changed to -ENODEV.

A simplified version of the semantic match that finds this problem is as
follows:

// <smpl>
@@
expression e1;
@@

* if (!e1)
  return PTR_ERR(e1);

// </smpl>

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
---
 drivers/pinctrl/berlin/berlin.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/berlin/berlin.c b/drivers/pinctrl/berlin/berlin.c
index edf5d2f..86db223 100644
--- a/drivers/pinctrl/berlin/berlin.c
+++ b/drivers/pinctrl/berlin/berlin.c
@@ -320,7 +320,7 @@ int berlin_pinctrl_probe(struct platform_device *pdev,
 
 	regmap = dev_get_regmap(&pdev->dev, NULL);
 	if (!regmap)
-		return PTR_ERR(regmap);
+		return -ENODEV;
 
 	pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL);
 	if (!pctrl)
-- 
1.9.1


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

* Re: [PATCH] pinctrl: berlin: fix return value for dev_get_regmap
  2014-06-29  7:18 [PATCH] pinctrl: berlin: fix return value for dev_get_regmap Himangi Saraogi
@ 2014-06-30  9:34 ` Sebastian Hesselbarth
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Hesselbarth @ 2014-06-30  9:34 UTC (permalink / raw)
  To: Himangi Saraogi, Linus Walleij, linux-kernel; +Cc: julia.lawall

On 06/29/2014 09:18 AM, Himangi Saraogi wrote:
> The failure value of dev_get_regmap is NULL. Hence, the return value is
> changed to -ENODEV.
>
> A simplified version of the semantic match that finds this problem is as
> follows:
>
> // <smpl>
> @@
> expression e1;
> @@
>
> * if (!e1)
>    return PTR_ERR(e1);
>
> // </smpl>
>
> Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
> Acked-by: Julia Lawall <julia.lawall@lip6.fr>

Himangi,

thanks for the fix, but we already have a similar patch [1] pending.

Sebastian

[1] http://www.spinics.net/lists/linux-kernel-janitors/msg19125.html

> ---
>   drivers/pinctrl/berlin/berlin.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/berlin/berlin.c b/drivers/pinctrl/berlin/berlin.c
> index edf5d2f..86db223 100644
> --- a/drivers/pinctrl/berlin/berlin.c
> +++ b/drivers/pinctrl/berlin/berlin.c
> @@ -320,7 +320,7 @@ int berlin_pinctrl_probe(struct platform_device *pdev,
>
>   	regmap = dev_get_regmap(&pdev->dev, NULL);
>   	if (!regmap)
> -		return PTR_ERR(regmap);
> +		return -ENODEV;
>
>   	pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL);
>   	if (!pctrl)
>


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

end of thread, other threads:[~2014-06-30  9:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-29  7:18 [PATCH] pinctrl: berlin: fix return value for dev_get_regmap Himangi Saraogi
2014-06-30  9:34 ` Sebastian Hesselbarth

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.