* [PATCH 0/2] adjust duplicate test
@ 2013-02-24 11:55 Julia Lawall
2013-02-24 11:55 ` [PATCH 1/2] drivers/gpu/drm/tilcdc/tilcdc_drv.c: " Julia Lawall
2013-02-24 11:55 ` [PATCH 2/2] drivers/regulator/s5m8767.c: " Julia Lawall
0 siblings, 2 replies; 4+ messages in thread
From: Julia Lawall @ 2013-02-24 11:55 UTC (permalink / raw)
To: linux-kernel; +Cc: kernel-janitors
These patches fix cases where a value is tested that was previously
tested. Often the problem is that the tested value has not been updated
properly. Sometimes the test is simply duplicated. These problems were
found using the following semantic match (http://coccinelle.lip6.fr/):
// <smpl>
@r exists@
expression e1,e2;
identifier f,g;
position p1,p2;
@@
if@p1 ( \(e1->f == NULL\|IS_ERR(e1->f)\) ) { ... when forall
return ...; }
... when != \(e1->f = e2\|e1->f += e2\|e1->f -= e2\|e1->f |= e2\|e1->f &= e2\|e1->f++\|e1->f--\|g(...,e1,...)\)
if@p2 ( \(e1->f == NULL\|IS_ERR(e1->f)\) ) { ... when forall
return ...; }
@rsame exists@
expression e;
position r.p1,r.p2;
statement S1,S2;
@@
if@p1 ( e ) S1
... when any
if@p2 ( e ) S2
@rok depends on rsame exists@
expression e1,e2;
identifier f;
position r.p1,r.p2;
statement S1,S2;
@@
if@p1 ( \(e1->f == NULL\|IS_ERR(e1->f)\) ) S1
... when any
\(e1->f = e2\|e1->f += e2\|e1->f -= e2\|e1->f |= e2\|e1->f &= e2\|e1->f++\|e1->f--\|g(...,e1,...)\)
... when any
if@p2 ( ... ) S2
@rother depends on rsame exists@
position r.p1,r.p2;
statement S;
@@
... when != if@p1 (...) S
if@p2 ( ... ) { ... return ...; }
@script:python depends on rsame && !rok && !rother@
p1 << r.p1;
p2 << r.p2;
@@
if (p1[0].line != p2[0].line):
cocci.print_main("",p1)
cocci.print_secs("",p2)
@s exists@
local idexpression y;
expression e;
position p1,p2;
@@
if@p1 ( \(y == NULL\|IS_ERR(y)\|y != 0\) ) { ... when forall
return ...; }
... when != \(y = e\|y += e\|y -= e\|y |= e\|y &= e\|y++\|y--\|&y\|XT_GETPAGE(...,y)\|WMI_CMD_BUF(...)\)
if@p2 ( \(y == NULL\|IS_ERR(y)\|y != 0\) ) { ... when forall
return ...; }
@ssame exists@
expression e;
position s.p1,s.p2;
statement S1,S2;
@@
if@p1 ( e ) S1
... when any
if@p2 ( e ) S2
@sok depends on ssame exists@
local idexpression y;
expression e;
position s.p1,s.p2;
statement S1,S2;
@@
if@p1 ( \(y == NULL\|IS_ERR(y)\|y != 0\) ) S1
... when any
\(y = e\|y += e\|y -= e\|y |= e\|y &= e\|y++\|y--\|&y\|XT_GETPAGE(...,y)\|WMI_CMD_BUF(...)\)
... when any
if@p2 ( ... ) S2
@sother depends on ssame exists@
position s.p1,s.p2;
statement S;
@@
... when != if@p1 (...) S
if@p2 ( ... ) { ... return ...; }
@script:python depends on ssame && !sok && !sother@
p1 << s.p1;
p2 << s.p2;
@@
if (p1[0].line != p2[0].line):
cocci.print_main("",p1)
cocci.print_secs("",p2)
// </smpl>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] drivers/gpu/drm/tilcdc/tilcdc_drv.c: adjust duplicate test
2013-02-24 11:55 [PATCH 0/2] adjust duplicate test Julia Lawall
@ 2013-02-24 11:55 ` Julia Lawall
2013-02-24 11:55 ` [PATCH 2/2] drivers/regulator/s5m8767.c: " Julia Lawall
1 sibling, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2013-02-24 11:55 UTC (permalink / raw)
To: David Airlie; +Cc: kernel-janitors, dri-devel, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Delete successive tests to the same location.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@s exists@
local idexpression y;
expression x,e;
@@
*if ( \(x == NULL\|IS_ERR(x)\|y != 0\) )
{ ... when forall
return ...; }
... when != \(y = e\|y += e\|y -= e\|y |= e\|y &= e\|y++\|y--\|&y\)
*if ( \(x == NULL\|IS_ERR(x)\|y != 0\) )
{ ... when forall
return ...; }
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/gpu/drm/tilcdc/tilcdc_drv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index c5b592d..3ad0a63 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -192,7 +192,7 @@ static int tilcdc_load(struct drm_device *dev, unsigned long flags)
}
priv->disp_clk = clk_get(dev->dev, "dpll_disp_ck");
- if (IS_ERR(priv->clk)) {
+ if (IS_ERR(priv->disp_clk)) {
dev_err(dev->dev, "failed to get display clock\n");
ret = -ENODEV;
goto fail;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] drivers/regulator/s5m8767.c: adjust duplicate test
2013-02-24 11:55 [PATCH 0/2] adjust duplicate test Julia Lawall
2013-02-24 11:55 ` [PATCH 1/2] drivers/gpu/drm/tilcdc/tilcdc_drv.c: " Julia Lawall
@ 2013-02-24 11:55 ` Julia Lawall
2013-03-01 7:41 ` Mark Brown
1 sibling, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2013-02-24 11:55 UTC (permalink / raw)
To: Sangbeom Kim; +Cc: kernel-janitors, Liam Girdwood, Mark Brown, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Delete successive tests to the same location.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@s exists@
local idexpression y;
expression x,e;
@@
*if ( \(x == NULL\|IS_ERR(x)\|y != 0\) )
{ ... when forall
return ...; }
... when != \(y = e\|y += e\|y -= e\|y |= e\|y &= e\|y++\|y--\|&y\)
*if ( \(x == NULL\|IS_ERR(x)\|y != 0\) )
{ ... when forall
return ...; }
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/regulator/s5m8767.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
index 8a83194..8e56198 100644
--- a/drivers/regulator/s5m8767.c
+++ b/drivers/regulator/s5m8767.c
@@ -549,7 +549,7 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev,
rmode = devm_kzalloc(&pdev->dev, sizeof(*rmode) *
pdata->num_regulators, GFP_KERNEL);
- if (!rdata) {
+ if (!rmode) {
dev_err(iodev->dev,
"could not allocate memory for regulator mode\n");
return -ENOMEM;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] drivers/regulator/s5m8767.c: adjust duplicate test
2013-02-24 11:55 ` [PATCH 2/2] drivers/regulator/s5m8767.c: " Julia Lawall
@ 2013-03-01 7:41 ` Mark Brown
0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2013-03-01 7:41 UTC (permalink / raw)
To: Julia Lawall; +Cc: Sangbeom Kim, kernel-janitors, Liam Girdwood, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 339 bytes --]
On Sun, Feb 24, 2013 at 12:55:34PM +0100, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Delete successive tests to the same location.
Applied, thanks. If you're sending a bunch of patches intended to be
applied separately it's probably not worth numbering them, it avoids
confusion (like waiting for 1/2).
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-03-01 7:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-24 11:55 [PATCH 0/2] adjust duplicate test Julia Lawall
2013-02-24 11:55 ` [PATCH 1/2] drivers/gpu/drm/tilcdc/tilcdc_drv.c: " Julia Lawall
2013-02-24 11:55 ` [PATCH 2/2] drivers/regulator/s5m8767.c: " Julia Lawall
2013-03-01 7:41 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox