Commit 9915e67e authored by Julia Lawall's avatar Julia Lawall Committed by David S. Miller

drivers/net/irda: fix error return code

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: default avatarJulia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 623d896b
...@@ -542,6 +542,7 @@ static int ks959_net_open(struct net_device *netdev) ...@@ -542,6 +542,7 @@ static int ks959_net_open(struct net_device *netdev)
sprintf(hwname, "usb#%d", kingsun->usbdev->devnum); sprintf(hwname, "usb#%d", kingsun->usbdev->devnum);
kingsun->irlap = irlap_open(netdev, &kingsun->qos, hwname); kingsun->irlap = irlap_open(netdev, &kingsun->qos, hwname);
if (!kingsun->irlap) { if (!kingsun->irlap) {
err = -ENOMEM;
dev_err(&kingsun->usbdev->dev, "irlap_open failed\n"); dev_err(&kingsun->usbdev->dev, "irlap_open failed\n");
goto free_mem; goto free_mem;
} }
......
...@@ -436,6 +436,7 @@ static int ksdazzle_net_open(struct net_device *netdev) ...@@ -436,6 +436,7 @@ static int ksdazzle_net_open(struct net_device *netdev)
sprintf(hwname, "usb#%d", kingsun->usbdev->devnum); sprintf(hwname, "usb#%d", kingsun->usbdev->devnum);
kingsun->irlap = irlap_open(netdev, &kingsun->qos, hwname); kingsun->irlap = irlap_open(netdev, &kingsun->qos, hwname);
if (!kingsun->irlap) { if (!kingsun->irlap) {
err = -ENOMEM;
dev_err(&kingsun->usbdev->dev, "irlap_open failed\n"); dev_err(&kingsun->usbdev->dev, "irlap_open failed\n");
goto free_mem; goto free_mem;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment