lkml.org 
[lkml]   [2012]   [Feb]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 1/3] drivers/power/pda_power.c: Move call to PTR_ERR after reassignment
    Date
    From: Julia Lawall <julia@diku.dk>

    Delete successive assignments to the same location.

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

    // <smpl>
    @@
    expression e,e1;
    constant c;
    @@

    *e = c
    ... when != e = e1
    when != &e
    when != true IS_ERR(e)
    *PTR_ERR(e)
    // </smpl>

    Signed-off-by: Julia Lawall <julia@diku.dk>
    Reported-by: Josh Triplett <josh@joshtriplett.org>

    ---
    This patch probably only half way solves the problem with this code. It would
    seem that it should have a goto at the end, but I am not sure to where.

    drivers/power/pda_power.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/drivers/power/pda_power.c b/drivers/power/pda_power.c
    index fd49689..16611c3 100644
    --- a/drivers/power/pda_power.c
    +++ b/drivers/power/pda_power.c
    @@ -316,8 +316,8 @@ static int pda_power_probe(struct platform_device *pdev)
    ac_draw = regulator_get(dev, "ac_draw");
    if (IS_ERR(ac_draw)) {
    dev_dbg(dev, "couldn't get ac_draw regulator\n");
    - ac_draw = NULL;
    ret = PTR_ERR(ac_draw);
    + ac_draw = NULL;
    }

    #ifdef CONFIG_USB_OTG_UTILS


    \
     
     \ /
      Last update: 2012-02-02 15:03    [W:0.019 / U:0.900 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site