HID: Move dereferences below a NULL test
commit76c317d6e5cb7f58541879006d39774596962715
authorJulia Lawall <julia@diku.dk>
Sun, 19 Jul 2009 15:26:13 +0000 (19 17:26 +0200)
committerJiri Kosina <jkosina@suse.cz>
Sun, 19 Jul 2009 22:03:35 +0000 (20 00:03 +0200)
treec92ad2c0b1e4b849d99bf6c97df87b637f1fd4f6
parent4859484b0957ddc7fe3e0fa349d98b0f1c7876bd
HID: Move dereferences below a NULL test

If the NULL test is necessary, then the dereferences 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>
@@
type T;
expression E,E1;
identifier i,fld;
statement S;
@@

- T i = E->fld;
+ T i;
  ... when != E=E1
      when != i
  if (E == NULL||...) S
+ i = E->fld;
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-core.c