staging: dgap: Use unsigned for loop index
authorTapasweni Pathak <tapaswenipathak@gmail.com>
Sun, 26 Oct 2014 15:08:32 +0000 (20:38 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Oct 2014 08:19:02 +0000 (16:19 +0800)
commitac2f46c365e655dd2c366f69c609febc4ac310fd
tree5911a72019d9e1aba84082b37441a033fb922441
parent43f61da20769923f951ded489b3b2de2e5dc0e3f
staging: dgap: Use unsigned for loop index

The following semantic patch is used to do this

@r exists@ // find anything that might decrement the variable
identifier i;
expression E;
position p;
@@

  int i@p;
  ...
(
  &i
|
  i--
|
  --i
|
  i-=E
|
  i+=E
)

@x disable decl_init@
identifier r.i;
expression E;
position p1 != r.p;
@@

(
  volatile int i = 0;
|
  volatile int i;
|
+ unsigned
  int i@p1 = 0;
|
+ unsigned
  int i@p1;
)
  <... when != i = E
(
  i = 0
|
  i = 1
)
  ...>

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/dgap/dgap.c