X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Ffx2lafw%2Ffx2lafw.c;h=b3df9731fbc6e294c608285578c67878b39df95f;hb=f086b83011b1282f62f0058872f333aef4bf9daa;hp=118d2d24dbb4bfa6b7ec3748cd246761b4c51660;hpb=f5cfe894eca22fc40dac721566a727cae8d8454c;p=libsigrok.git diff --git a/hardware/fx2lafw/fx2lafw.c b/hardware/fx2lafw/fx2lafw.c index 118d2d24..b3df9731 100644 --- a/hardware/fx2lafw/fx2lafw.c +++ b/hardware/fx2lafw/fx2lafw.c @@ -23,7 +23,6 @@ #include #include #include -#include "config.h" #include "libsigrok.h" #include "libsigrok-internal.h" #include "fx2lafw.h" @@ -144,8 +143,7 @@ static struct sr_dev_driver *fdi = &fx2lafw_driver_info; static int hw_dev_close(struct sr_dev_inst *sdi); static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, const void *value); -static int hw_dev_acquisition_stop(const struct sr_dev_inst *sdi, - void *cb_data); +static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data); /** * Check the USB configuration to determine if this is an fx2lafw device. @@ -407,7 +405,7 @@ static int hw_init(void) if (!(drvc = g_try_malloc0(sizeof(struct drv_context)))) { sr_err("fx2lafw: driver context malloc failed."); - return SR_ERR; + return SR_ERR_MALLOC; } if (libusb_init(NULL) != 0) { @@ -433,8 +431,8 @@ static GSList *hw_scan(GSList *options) libusb_device **devlist; int devcnt, num_logic_probes, ret, i, j; - /* Avoid compiler warnings. */ (void)options; + drvc = fdi->priv; /* This scan always invalidates any previous scans. */ @@ -688,7 +686,6 @@ static int receive_data(int fd, int revents, void *cb_data) { struct timeval tv; - /* Avoid compiler warnings. */ (void)fd; (void)revents; (void)cb_data; @@ -973,8 +970,10 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi, const size_t size = get_buffer_size(devc); devc->transfers = g_try_malloc0(sizeof(*devc->transfers) * num_transfers); - if (!devc->transfers) - return SR_ERR; + if (!devc->transfers) { + sr_err("fx2lafw: USB transfers malloc failed."); + return SR_ERR_MALLOC; + } devc->num_transfers = num_transfers; @@ -1026,11 +1025,8 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi, } /* TODO: This stops acquisition on ALL devices, ignoring dev_index. */ -static int hw_dev_acquisition_stop(const struct sr_dev_inst *sdi, - void *cb_data) +static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data) { - - /* Avoid compiler warnings. */ (void)cb_data; abort_acquisition(sdi->priv);