Skip to content
  • Julia Lawall's avatar
    netfilter: x_tables: simplify IS_ERR_OR_NULL to NULL test · eb1a6bdc
    Julia Lawall authored
    Since commit 7926dbfa ("netfilter: don't use
    mutex_lock_interruptible()"), the function xt_find_table_lock can only
    return NULL on an error.  Simplify the call sites and update the
    comment before the function.
    
    The semantic patch that change the code is as follows:
    (http://coccinelle.lip6.fr/
    
    )
    
    // <smpl>
    @@
    expression t,e;
    @@
    
    t = \(xt_find_table_lock(...)\|
          try_then_request_module(xt_find_table_lock(...),...)\)
    ... when != t=e
    - ! IS_ERR_OR_NULL(t)
    + t
    
    @@
    expression t,e;
    @@
    
    t = \(xt_find_table_lock(...)\|
          try_then_request_module(xt_find_table_lock(...),...)\)
    ... when != t=e
    - IS_ERR_OR_NULL(t)
    + !t
    
    @@
    expression t,e,e1;
    @@
    
    t = \(xt_find_table_lock(...)\|
          try_then_request_module(xt_find_table_lock(...),...)\)
    ... when != t=e
    ?- t ? PTR_ERR(t) : e1
    + e1
    ... when any
    
    // </smpl>
    
    Signed-off-by: default avatarJulia Lawall <Julia.Lawall@lip6.fr>
    Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
    eb1a6bdc