提交 3ee7451a 编写于 作者: J Julia Lawall 提交者: David Woodhouse

mtd: ts5500_flash: avoid calling map_destroy on NULL

map_destroy dereferences its argument.  The call is furthermore only
reachable when this argument is NULL.  Thus the call is dropped.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression *x;
@@

*if (x == NULL)
{ ...
* map_destroy(x);
  ...
  return ...;
}
// </smpl>
Signed-off-by: NJulia Lawall <julia@diku.dk>
Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
上级 f17f12ce
...@@ -94,7 +94,6 @@ static int __init init_ts5500_map(void) ...@@ -94,7 +94,6 @@ static int __init init_ts5500_map(void)
return 0; return 0;
err1: err1:
map_destroy(mymtd);
iounmap(ts5500_map.virt); iounmap(ts5500_map.virt);
err2: err2:
return rc; return rc;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册