Skip to content

Commit

Permalink
arch/sh/mm: Move a dereference below a NULL test
Browse files Browse the repository at this point in the history
If the NULL test is necessary, then the dereference should be moved below
the NULL test.

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/).

// <smpl>
@disable is_null@
identifier f;
expression E;
identifier fld;
statement S;
@@

+ if (E == NULL) S
  f(...,E->fld,...);
- if (E == NULL) S

@@
identifier f;
expression E;
identifier fld;
statement S;
@@

+ if (!E) S
  f(...,E->fld,...);
- if (!E) S
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
  • Loading branch information
Julia Lawall authored and Paul Mundt committed Jan 21, 2009
1 parent f3b8436 commit 7bfa122
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/sh/mm/ioremap_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ void *__ioremap(unsigned long phys_addr, unsigned long size,
* Ok, go for it..
*/
area = get_vm_area(size, VM_IOREMAP);
pr_debug("Get vm_area returns %p addr %p\n",area,area->addr);
if (!area)
return NULL;
pr_debug("Get vm_area returns %p addr %p\n", area, area->addr);
area->phys_addr = phys_addr;
addr = area->addr;
if (ioremap_page_range((unsigned long)addr, (unsigned long)addr + size,
Expand Down

0 comments on commit 7bfa122

Please sign in to comment.