linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/25] fix error return code
@ 2013-12-29 22:47 Julia Lawall
  2013-12-29 22:47 ` [PATCH 23/25] thermal: exynos: " Julia Lawall
  0 siblings, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2013-12-29 22:47 UTC (permalink / raw)
  To: linux-arm-kernel

These patches fix cases where the return variable is not set to an error
code in an error case.

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

* [PATCH 23/25] thermal: exynos: fix error return code
  2013-12-29 22:47 [PATCH 0/25] fix error return code Julia Lawall
@ 2013-12-29 22:47 ` Julia Lawall
  2013-12-30  1:31   ` Jingoo Han
  2014-01-02  1:55   ` Zhang Rui
  0 siblings, 2 replies; 4+ messages in thread
From: Julia Lawall @ 2013-12-29 22:47 UTC (permalink / raw)
  To: linux-arm-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Set the return variable to an error code as done elsewhere in the function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
(
if at p1 (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}

// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
Not tested.

 drivers/thermal/samsung/exynos_tmu.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index 32f38b9..0d96a51 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -205,6 +205,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
 skip_calib_data:
 	if (pdata->max_trigger_level > MAX_THRESHOLD_LEVS) {
 		dev_err(&pdev->dev, "Invalid max trigger level\n");
+		ret = -EINVAL;
 		goto out;
 	}
 

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

* [PATCH 23/25] thermal: exynos: fix error return code
  2013-12-29 22:47 ` [PATCH 23/25] thermal: exynos: " Julia Lawall
@ 2013-12-30  1:31   ` Jingoo Han
  2014-01-02  1:55   ` Zhang Rui
  1 sibling, 0 replies; 4+ messages in thread
From: Jingoo Han @ 2013-12-30  1:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Monday, December 30, 2013 7:48 AM, Julia Lawall wrote:
> 
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Set the return variable to an error code as done elsewhere in the function.
> 
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> (
> if at p1 (\(ret < 0\|ret != 0\))
>  { ... return ret; }
> |
> ret at p1 = 0
> )
> ... when != ret = e1
>     when != &ret
> *if(...)
> {
>   ... when != ret = e2
>       when forall
>  return ret;
> }
> 
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

(+cc Amit Daniel Kachhap, Jonghwa Lee)

Reviewed-by: Jingoo Han <jg1.han@samsung.com>

Best regards,
Jingoo Han

> 
> ---
> Not tested.
> 
>  drivers/thermal/samsung/exynos_tmu.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index 32f38b9..0d96a51 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -205,6 +205,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
>  skip_calib_data:
>  	if (pdata->max_trigger_level > MAX_THRESHOLD_LEVS) {
>  		dev_err(&pdev->dev, "Invalid max trigger level\n");
> +		ret = -EINVAL;
>  		goto out;
>  	}
> 
> 
> --

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

* [PATCH 23/25] thermal: exynos: fix error return code
  2013-12-29 22:47 ` [PATCH 23/25] thermal: exynos: " Julia Lawall
  2013-12-30  1:31   ` Jingoo Han
@ 2014-01-02  1:55   ` Zhang Rui
  1 sibling, 0 replies; 4+ messages in thread
From: Zhang Rui @ 2014-01-02  1:55 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, 2013-12-29 at 23:47 +0100, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Set the return variable to an error code as done elsewhere in the function.
> 
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> (
> if at p1 (\(ret < 0\|ret != 0\))
>  { ... return ret; }
> |
> ret at p1 = 0
> )
> ... when != ret = e1
>     when != &ret
> *if(...)
> {
>   ... when != ret = e2
>       when forall
>  return ret;
> }
> 
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

applied.

thanks,
rui
> 
> ---
> Not tested.
> 
>  drivers/thermal/samsung/exynos_tmu.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index 32f38b9..0d96a51 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -205,6 +205,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
>  skip_calib_data:
>  	if (pdata->max_trigger_level > MAX_THRESHOLD_LEVS) {
>  		dev_err(&pdev->dev, "Invalid max trigger level\n");
> +		ret = -EINVAL;
>  		goto out;
>  	}
>  
> 

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

end of thread, other threads:[~2014-01-02  1:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-29 22:47 [PATCH 0/25] fix error return code Julia Lawall
2013-12-29 22:47 ` [PATCH 23/25] thermal: exynos: " Julia Lawall
2013-12-30  1:31   ` Jingoo Han
2014-01-02  1:55   ` Zhang Rui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).