Skip to content

Commit

Permalink
netbsd/openbsd: Remove extraneous parentheses around ioctl call
Browse files Browse the repository at this point in the history
Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
  • Loading branch information
tormodvolden committed Jul 7, 2023
1 parent 0a29e4f commit 9891cf2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions libusb/os/netbsd_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ netbsd_get_config_descriptor(struct libusb_device *dev, uint8_t idx,
ufd.ufd_size = len;
ufd.ufd_data = buf;

if ((ioctl(fd, USB_GET_FULL_DESC, &ufd)) < 0) {
if (ioctl(fd, USB_GET_FULL_DESC, &ufd) < 0) {
err = errno;
if (dpriv->fd < 0)
close(fd);
Expand Down Expand Up @@ -476,7 +476,7 @@ _cache_active_config_descriptor(struct libusb_device *dev, int fd)

ucd.ucd_config_index = USB_CURRENT_CONFIG_INDEX;

if ((ioctl(fd, USB_GET_CONFIG_DESC, &ucd)) < 0)
if (ioctl(fd, USB_GET_CONFIG_DESC, &ucd) < 0)
return _errno_to_libusb(errno);

usbi_dbg(DEVICE_CTX(dev), "active bLength %d", ucd.ucd_desc.bLength);
Expand All @@ -492,7 +492,7 @@ _cache_active_config_descriptor(struct libusb_device *dev, int fd)

usbi_dbg(DEVICE_CTX(dev), "index %d, len %d", ufd.ufd_config_index, len);

if ((ioctl(fd, USB_GET_FULL_DESC, &ufd)) < 0) {
if (ioctl(fd, USB_GET_FULL_DESC, &ufd) < 0) {
free(buf);
return _errno_to_libusb(errno);
}
Expand Down Expand Up @@ -533,10 +533,10 @@ _sync_control_transfer(struct usbi_transfer *itransfer)
if ((transfer->flags & LIBUSB_TRANSFER_SHORT_NOT_OK) == 0)
req.ucr_flags = USBD_SHORT_XFER_OK;

if ((ioctl(dpriv->fd, USB_SET_TIMEOUT, &transfer->timeout)) < 0)
if (ioctl(dpriv->fd, USB_SET_TIMEOUT, &transfer->timeout) < 0)
return _errno_to_libusb(errno);

if ((ioctl(dpriv->fd, USB_DO_REQUEST, &req)) < 0)
if (ioctl(dpriv->fd, USB_DO_REQUEST, &req) < 0)
return _errno_to_libusb(errno);

itransfer->transferred = req.ucr_actlen;
Expand Down Expand Up @@ -595,12 +595,12 @@ _sync_gen_transfer(struct usbi_transfer *itransfer)
if ((fd = _access_endpoint(transfer)) < 0)
return _errno_to_libusb(errno);

if ((ioctl(fd, USB_SET_TIMEOUT, &transfer->timeout)) < 0)
if (ioctl(fd, USB_SET_TIMEOUT, &transfer->timeout) < 0)
return _errno_to_libusb(errno);

if (IS_XFERIN(transfer)) {
if ((transfer->flags & LIBUSB_TRANSFER_SHORT_NOT_OK) == 0)
if ((ioctl(fd, USB_SET_SHORT_XFER, &nr)) < 0)
if (ioctl(fd, USB_SET_SHORT_XFER, &nr) < 0)
return _errno_to_libusb(errno);

nr = read(fd, transfer->buffer, transfer->length);
Expand Down
10 changes: 5 additions & 5 deletions libusb/os/openbsd_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,17 +594,17 @@ _sync_control_transfer(struct usbi_transfer *itransfer)
if ((fd = _bus_open(transfer->dev_handle->dev->bus_number)) < 0)
return _errno_to_libusb(errno);

if ((ioctl(fd, USB_REQUEST, &req)) < 0) {
if (ioctl(fd, USB_REQUEST, &req) < 0) {
err = errno;
close(fd);
return _errno_to_libusb(err);
}
close(fd);
} else {
if ((ioctl(dpriv->fd, USB_SET_TIMEOUT, &transfer->timeout)) < 0)
if (ioctl(dpriv->fd, USB_SET_TIMEOUT, &transfer->timeout) < 0)
return _errno_to_libusb(errno);

if ((ioctl(dpriv->fd, USB_DO_REQUEST, &req)) < 0)
if (ioctl(dpriv->fd, USB_DO_REQUEST, &req) < 0)
return _errno_to_libusb(errno);
}

Expand Down Expand Up @@ -668,12 +668,12 @@ _sync_gen_transfer(struct usbi_transfer *itransfer)
if ((fd = _access_endpoint(transfer)) < 0)
return _errno_to_libusb(errno);

if ((ioctl(fd, USB_SET_TIMEOUT, &transfer->timeout)) < 0)
if (ioctl(fd, USB_SET_TIMEOUT, &transfer->timeout) < 0)
return _errno_to_libusb(errno);

if (IS_XFERIN(transfer)) {
if ((transfer->flags & LIBUSB_TRANSFER_SHORT_NOT_OK) == 0)
if ((ioctl(fd, USB_SET_SHORT_XFER, &nr)) < 0)
if (ioctl(fd, USB_SET_SHORT_XFER, &nr) < 0)
return _errno_to_libusb(errno);

nr = read(fd, transfer->buffer, transfer->length);
Expand Down
2 changes: 1 addition & 1 deletion libusb/version_nano.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define LIBUSB_NANO 11804
#define LIBUSB_NANO 11805

0 comments on commit 9891cf2

Please sign in to comment.