• Julia Lawall's avatar
    mtd: Use BLOCK_NIL consistently in NFTL/INFTL · 70ec3bb8
    Julia Lawall authored
    Use BLOCK_NIL consistently rather than sometimes 0xffff and sometimes
    BLOCK_NIL.
    
    The semantic patch that finds this issue is below
    (http://www.emn.fr/x-info/coccinelle/).  On the other hand, the changes
    were made by hand, in part because drivers/mtd/inftlcore.c contains dead
    code that causes spatch to ignore a relevant function.  Specifically, the
    function INFTL_findwriteunit contains a do-while loop, but always takes a
    return that leaves the loop on the first iteration.
    
    // <smpl>
    @r exists@
    identifier f,C;
    @@
    
    f(...) { ... return C; }
    
    @s@
    identifier r.C;
    expression E;
    @@
    
    @@
    identifier r.f,r.C,I;
    expression s.E;
    @@
    
    f(...) {
     <...
    (
      I
    |
    - E
    + C
    )
     ...>
    }
    
    // </smpl>
    Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
    Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
    70ec3bb8
nftlcore.c 22.8 KB