linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 7/14] drivers/mtd/maps/rbtx4939-flash.c: delete unneeded test
       [not found] <1345365870-29831-1-git-send-email-Julia.Lawall@lip6.fr>
@ 2012-08-19  8:44 ` Julia Lawall
  2012-08-25 11:04   ` Artem Bityutskiy
  2012-08-19  8:44 ` [PATCH 13/14] drivers/mtd/ubi/build.c: fix error return code Julia Lawall
  1 sibling, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2012-08-19  8:44 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-mtd, kernel-janitors, linux-kernel

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

Err has only been initialized to 0 at this, so it is not possible that this
test can be true.

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

// <smpl>
(
if@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>

---
 drivers/mtd/maps/rbtx4939-flash.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/mtd/maps/rbtx4939-flash.c b/drivers/mtd/maps/rbtx4939-flash.c
index 6f52e1f..49c3fe7 100644
--- a/drivers/mtd/maps/rbtx4939-flash.c
+++ b/drivers/mtd/maps/rbtx4939-flash.c
@@ -100,8 +100,6 @@ static int rbtx4939_flash_probe(struct platform_device *dev)
 		goto err_out;
 	}
 	info->mtd->owner = THIS_MODULE;
-	if (err)
-		goto err_out;
 	err = mtd_device_parse_register(info->mtd, NULL, NULL, pdata->parts,
 					pdata->nr_parts);
 

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

* [PATCH 13/14] drivers/mtd/ubi/build.c: fix error return code
       [not found] <1345365870-29831-1-git-send-email-Julia.Lawall@lip6.fr>
  2012-08-19  8:44 ` [PATCH 7/14] drivers/mtd/maps/rbtx4939-flash.c: delete unneeded test Julia Lawall
@ 2012-08-19  8:44 ` Julia Lawall
  2012-08-25 11:10   ` Artem Bityutskiy
  1 sibling, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2012-08-19  8:44 UTC (permalink / raw)
  To: Artem Bityutskiy
  Cc: David Woodhouse, kernel-janitors, linux-kernel, linux-mtd

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

Initialize return variable before exiting on an error path.

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

// <smpl>
(
if@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>

---
 drivers/mtd/ubi/build.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 7b6b5f9..afe9075 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -1159,8 +1159,10 @@ static int __init ubi_init(void)
 	ubi_wl_entry_slab = kmem_cache_create("ubi_wl_entry_slab",
 					      sizeof(struct ubi_wl_entry),
 					      0, 0, NULL);
-	if (!ubi_wl_entry_slab)
+	if (!ubi_wl_entry_slab) {
+		err = -ENOMEM;
 		goto out_dev_unreg;
+	}
 
 	err = ubi_debugfs_init();
 	if (err)

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

* Re: [PATCH 7/14] drivers/mtd/maps/rbtx4939-flash.c: delete unneeded test
  2012-08-19  8:44 ` [PATCH 7/14] drivers/mtd/maps/rbtx4939-flash.c: delete unneeded test Julia Lawall
@ 2012-08-25 11:04   ` Artem Bityutskiy
  0 siblings, 0 replies; 4+ messages in thread
From: Artem Bityutskiy @ 2012-08-25 11:04 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, David Woodhouse, linux-kernel, linux-mtd

[-- Attachment #1: Type: text/plain, Size: 398 bytes --]

On Sun, 2012-08-19 at 10:44 +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Err has only been initialized to 0 at this, so it is not possible that this
> test can be true.
> 
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)

Pushed to l2-mt.git, thanks!

-- 
Best Regards,
Artem Bityutskiy

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 13/14] drivers/mtd/ubi/build.c: fix error return code
  2012-08-19  8:44 ` [PATCH 13/14] drivers/mtd/ubi/build.c: fix error return code Julia Lawall
@ 2012-08-25 11:10   ` Artem Bityutskiy
  0 siblings, 0 replies; 4+ messages in thread
From: Artem Bityutskiy @ 2012-08-25 11:10 UTC (permalink / raw)
  To: Julia Lawall; +Cc: David Woodhouse, kernel-janitors, linux-kernel, linux-mtd

[-- Attachment #1: Type: text/plain, Size: 244 bytes --]

On Sun, 2012-08-19 at 10:44 +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Initialize return variable before exiting on an error path.

Pushed to linux-ubi.git, thanks!

-- 
Best Regards,
Artem Bityutskiy

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2012-08-25 11:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1345365870-29831-1-git-send-email-Julia.Lawall@lip6.fr>
2012-08-19  8:44 ` [PATCH 7/14] drivers/mtd/maps/rbtx4939-flash.c: delete unneeded test Julia Lawall
2012-08-25 11:04   ` Artem Bityutskiy
2012-08-19  8:44 ` [PATCH 13/14] drivers/mtd/ubi/build.c: fix error return code Julia Lawall
2012-08-25 11:10   ` Artem Bityutskiy

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).