drivers/net/irda: fix error return code
authorJulia Lawall <Julia.Lawall@lip6.fr>
Thu, 16 Aug 2012 21:46:58 +0000 (21:46 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 20 Aug 2012 09:33:21 +0000 (02:33 -0700)
Convert a nonnegative error return code to a negative one, as returned
elsewhere in the function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier ret;
expression e1,e2;
@@

if (ret < 0)
 { ... return ret; }
 ... when != ret = e1
     when forall
*if(...)
 {
  ... when != ret = e2
* return ret;
 }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/irda/ks959-sir.c
drivers/net/irda/ksdazzle-sir.c

index 824e2a93fe8a68d0228897828a51a010e9a8306b..5f3aeac3f86df57e297b1559a5bda2b7669145a9 100644 (file)
@@ -542,6 +542,7 @@ static int ks959_net_open(struct net_device *netdev)
        sprintf(hwname, "usb#%d", kingsun->usbdev->devnum);
        kingsun->irlap = irlap_open(netdev, &kingsun->qos, hwname);
        if (!kingsun->irlap) {
+               err = -ENOMEM;
                dev_err(&kingsun->usbdev->dev, "irlap_open failed\n");
                goto free_mem;
        }
index 5a278ab83c2f040e3ac0f8427f6744b15e42de26..2d4b6a1ab2029b0d2267cf967931e47c84796123 100644 (file)
@@ -436,6 +436,7 @@ static int ksdazzle_net_open(struct net_device *netdev)
        sprintf(hwname, "usb#%d", kingsun->usbdev->devnum);
        kingsun->irlap = irlap_open(netdev, &kingsun->qos, hwname);
        if (!kingsun->irlap) {
+               err = -ENOMEM;
                dev_err(&kingsun->usbdev->dev, "irlap_open failed\n");
                goto free_mem;
        }