Skip to contentSkip to conversation

sound/soc/kirkwood/kirkwood-i2s.c: add missing kfree

PATCH Applied Julia Lawall 4 participants 6 messages Aug 20, 2011 – Sep 12, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 sound/soc/kirkwood/kirkwood-i2s.c: add missing kfree

From: Julia Lawall <[email protected]>

Adjust the goto to jump to the error handling code that includes kfree.

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

// <smpl>
@@
identifier x;
expression E1!=0,E2,E3,E4;
statement S;
iterator I;
@@

(
if (...) { ... when != kfree(x)

               when != x = E3
               when != E3 = x
*  return ...;
 }
... when != x = E2
    when != I(...,x,...) S

if (...) { ... when != x = E4
kfree(x); ... return ...; }
)
// </smpl>

---
 sound/soc/kirkwood/kirkwood-i2s.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/kirkwood/kirkwood-i2s.c +1 -1
index a33fc51..8f16cd3 100644
@@ -424,7 +424,7 @@ static __devinit int kirkwood_i2s_dev_probe(struct platform_device *pdev)
 	if (!priv->mem) {
 		dev_err(&pdev->dev, "request_mem_region failed\n");
 		err = -EBUSY;
-		goto error;
+		goto error_alloc;
 	}
 
 	priv->io = ioremap(priv->mem->start, SZ_16K);
Acked-by on v1 1/4
#1 lore raw
Quoted 40 lines · Julia Lawall

From: Julia Lawall <[email protected]>

Adjust the goto to jump to the error handling code that includes kfree.

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

// <smpl>
@@
identifier x;
expression E1!=0,E2,E3,E4;
statement S;
iterator I;
@@

(
if (...) { ... when != kfree(x)

               when != x = E3
               when != E3 = x
*  return ...;
 }
... when != x = E2
    when != I(...,x,...) S

if (...) { ... when != x = E4
kfree(x); ... return ...; }
)
// </smpl>

---
 sound/soc/kirkwood/kirkwood-i2s.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/kirkwood/kirkwood-i2s.c +0 -0
index a33fc51..8f16cd3 100644

sound/soc/kirkwood/kirkwood-i2s.c static __devinit int kirkwood_i2s_dev_probe(struct platform_device *pdev) · line 430

Quoted 8 lines
sound/soc/kirkwood/kirkwood-i2s.c +1 -1
@@ -424,7 +424,7 @@ static __devinit int kirkwood_i2s_dev_probe(struct platform_device *pdev)
 	if (!priv->mem) {
 		dev_err(&pdev->dev, "request_mem_region failed\n");
 		err = -EBUSY;
-		goto error;
+		goto error_alloc;
 	}
 
 	priv->io = ioremap(priv->mem->start, SZ_16K);

All

#3 lore raw

PATCH 1/1 sound/soc/kirkwood/kirkwood-i2s.c: fix trivial build regression

In reply to Julia Lawall

A fix merged in 3.1-rc2 introduced a small regression, this should get it to build again.

---

Quoted 4 lines · On Saturday 20 August 2011 08:12:38 Julia Lawall wrote:

From: Julia Lawall <[email protected]>

Adjust the goto to jump to the error handling code that includes kfree.

/home/arnd/linux-arm/sound/soc/kirkwood/kirkwood-i2s.c: In function 'kirkwood_i2s_dev_probe':
/home/arnd/linux-arm/sound/soc/kirkwood/kirkwood-i2s.c:427:3: error: label 'error_alloc' used but not defined

sound/soc/kirkwood/kirkwood-i2s.c +1 -1
index 8f16cd3..d0bcf3f 100644
@@ -424,7 +424,7 @@ static __devinit int kirkwood_i2s_dev_probe(struct platform_device *pdev)
 	if (!priv->mem) {
 		dev_err(&pdev->dev, "request_mem_region failed\n");
 		err = -EBUSY;
-		goto error_alloc;
+		goto err_alloc;
 	}
 
 	priv->io = ioremap(priv->mem->start, SZ_16K);
Acked-by on v1 1/1
#4 lore raw

Re: [PATCH] sound/soc/kirkwood/kirkwood-i2s.c: fix trivial build regression

Quoted 30 lines · Arnd Bergmann

A fix merged in 3.1-rc2 introduced a small regression, this should get it to build again.

---

Quoted 4 lines · On Saturday 20 August 2011 08:12:38 Julia Lawall wrote:

From: Julia Lawall <[email protected]>

Adjust the goto to jump to the error handling code that includes kfree.

/home/arnd/linux-arm/sound/soc/kirkwood/kirkwood-i2s.c: In function 'kirkwood_i2s_dev_probe':
/home/arnd/linux-arm/sound/soc/kirkwood/kirkwood-i2s.c:427:3: error: label 'error_alloc' used but not defined

sound/soc/kirkwood/kirkwood-i2s.c +1 -1
index 8f16cd3..d0bcf3f 100644
@@ -424,7 +424,7 @@ static __devinit int kirkwood_i2s_dev_probe(struct
 platform_device *pdev)
       if (!priv->mem) {
               dev_err(&pdev->dev, "request_mem_region failed\n");
               err = -EBUSY;
-               goto error_alloc;
+               goto err_alloc;
       }
 
Quoted 2 lines
       priv->io = ioremap(priv->mem->start, SZ_16K);
Applied
#5 lore raw

Re: [PATCH] sound/soc/kirkwood/kirkwood-i2s.c: fix trivial build regression

In reply to Arnd Bergmann
Quoted 4 lines · Arnd Bergmann

A fix merged in 3.1-rc2 introduced a small regression, this should get it to build again.

Applied, thanks.

Please try to make sure that your commit logs match the style of the subsystem.