lkml.org 
[lkml]   [2010]   [Aug]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH 16/16] drivers/net/qlcnic: Use available error codes
    From: Julia Lawall <julia@diku.dk>

    The error code is stored in the variable err, but it is the variable ret
    that is returned instead. So store the error code in ret. Err is then
    useless.

    The semantic match that finds this problem is as follows:
    (http://coccinelle.lip6.fr/)

    // <smpl>
    @r@
    local idexpression x;
    constant C;
    @@

    if (...) { ...
    x = -C
    ... when != x
    (
    return <+...x...+>;
    |
    return NULL;
    |
    return;
    |
    * return ...;
    )
    }
    // </smpl>

    Signed-off-by: Julia Lawall <julia@diku.dk>

    ---
    This changes the semantics and has not been tested.

    drivers/net/qlcnic/qlcnic_main.c | 4 ++--
    1 file changed, 2 insertions(+), 2 deletions(-)

    diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
    index b9615bd..142ab1d 100644
    --- a/drivers/net/qlcnic/qlcnic_main.c
    +++ b/drivers/net/qlcnic/qlcnic_main.c
    @@ -474,7 +474,7 @@ static int
    qlcnic_init_pci_info(struct qlcnic_adapter *adapter)
    {
    struct qlcnic_pci_info pci_info[QLCNIC_MAX_PCI_FUNC];
    - int i, ret = 0, err;
    + int i, ret = 0;
    u8 pfn;

    if (!adapter->npars)
    @@ -487,7 +487,7 @@ qlcnic_init_pci_info(struct qlcnic_adapter *adapter)
    adapter->eswitch = kzalloc(sizeof(struct qlcnic_eswitch) *
    QLCNIC_NIU_MAX_XG_PORTS, GFP_KERNEL);
    if (!adapter->eswitch) {
    - err = -ENOMEM;
    + ret = -ENOMEM;
    goto err_eswitch;
    }


    \
     
     \ /
      Last update: 2010-08-16 18:33    [W:0.030 / U:0.924 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site