From: Daniel Elstner Date: Sat, 25 Jan 2014 22:27:40 +0000 (+0100) Subject: sysclk-lwla: Limit use of SR_ERR_ARG to user-supplied arguments. X-Git-Tag: libsigrok-0.3.0~180 X-Git-Url: https://sigrok.org/gitweb/?a=commitdiff_plain;h=5413df19528c96c6fba3ee4cc61ec3dfe01047cb;hp=1c873c114cdf67b2cffa78293611d8f8f275bab8;p=libsigrok.git sysclk-lwla: Limit use of SR_ERR_ARG to user-supplied arguments. The return code SR_ERR_ARG is intended for reporting unsupported or inapplicable device configuration settings and is not a hard error. In order to indicate failure of internal sanity checks, use SR_ERR_BUG instead. --- diff --git a/hardware/sysclk-lwla/lwla.c b/hardware/sysclk-lwla/lwla.c index f1b76592..8a6496fb 100644 --- a/hardware/sysclk-lwla/lwla.c +++ b/hardware/sysclk-lwla/lwla.c @@ -137,8 +137,8 @@ SR_PRIV int lwla_send_command(const struct sr_usb_dev_inst *usb, int ret; int xfer_len; - if (usb == NULL || command == NULL || cmd_len <= 0) - return SR_ERR_ARG; + if (!usb || !command || cmd_len <= 0) + return SR_ERR_BUG; xfer_len = 0; ret = libusb_bulk_transfer(usb->devhdl, EP_COMMAND, @@ -163,8 +163,8 @@ SR_PRIV int lwla_receive_reply(const struct sr_usb_dev_inst *usb, int ret; int xfer_len; - if (usb == NULL || reply == NULL || reply_len <= 0) - return SR_ERR_ARG; + if (!usb || !reply || reply_len <= 0) + return SR_ERR_BUG; xfer_len = 0; ret = libusb_bulk_transfer(usb->devhdl, EP_REPLY,