• Q
    iommu/amd: Convert non-returned local variable to boolean when relevant · ae0cbbb1
    Quentin Lambert 提交于
    This patch was produced using Coccinelle. A simplified version of the
    semantic patch is:
    
    @r exists@
    identifier f;
    local idexpression u8 x;
    identifier xname;
    @@
    
    f(...) {
    ...when any
    (
      x@xname = 1;
    |
      x@xname = 0;
    )
    ...when any
    }
    
    @bad exists@
    identifier r.f;
    local idexpression u8 r.x
    expression e1 != {0, 1}, e2;
    @@
    
    f(...) {
    ...when any
    (
      x = e1;
    |
      x + e2
    )
    ...when any
    }
    
    @depends on !bad@
    identifier r.f;
    local idexpression u8 r.x;
    identifier r.xname;
    @@
    
    f(...) {
    ...
    ++ bool xname;
    - int xname;
    <...
    (
      x =
    - 1
    + true
    |
      x =
    - -1
    + false
    )
    ...>
    
    }
    Signed-off-by: NQuentin Lambert <lambert.quentin@gmail.com>
    Signed-off-by: NJoerg Roedel <jroedel@suse.de>
    ae0cbbb1
amd_iommu.c 97.0 KB