Skip to content

Commit

Permalink
USB: wusbcore: return negative error codes
Browse files Browse the repository at this point in the history
cbaf_cdid_get() is only used in cbaf_wusb_chid_store().

In the original code cbaf_cdid_get() returns either a negative error
code or a small positive value on error.  I have changed it to
return -ENOENT if there is not enough data available.

In the original code the caller changed the negative error codes to
positive return values.  I've changed it to just return the error
value directly.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Jun 7, 2011
1 parent 325fd18 commit e90ed12
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/usb/wusbcore/cbaf.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ static int cbaf_cdid_get(struct cbaf *cbaf)
if (result < needed) {
dev_err(dev, "Not enough data in DEVICE_INFO reply (%zu vs "
"%zu bytes needed)\n", (size_t)result, needed);
return result;
return -ENOENT;
}

strlcpy(cbaf->device_name, di->DeviceFriendlyName, CBA_NAME_LEN);
Expand Down Expand Up @@ -350,7 +350,7 @@ static ssize_t cbaf_wusb_chid_store(struct device *dev,
return result;
result = cbaf_cdid_get(cbaf);
if (result < 0)
return -result;
return result;
return size;
}
static DEVICE_ATTR(wusb_chid, 0600, cbaf_wusb_chid_show, cbaf_wusb_chid_store);
Expand Down

0 comments on commit e90ed12

Please sign in to comment.