X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fhantek-dso%2Fapi.c;h=0847da558aabbacb361a4b6db3538514a199aecf;hb=47f4f073e0a7fe68a55001180c3c9092551f2108;hp=e35dacbdd310193c8b786a62c4a8521aac925611;hpb=545f9786390a89b8bb6868907afa555fc0a6ece4;p=libsigrok.git diff --git a/hardware/hantek-dso/api.c b/hardware/hantek-dso/api.c index e35dacbd..0847da55 100644 --- a/hardware/hantek-dso/api.c +++ b/hardware/hantek-dso/api.c @@ -145,8 +145,7 @@ static const char *coupling[] = { SR_PRIV struct sr_dev_driver hantek_dso_driver_info; static struct sr_dev_driver *hdi = &hantek_dso_driver_info; -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); static struct sr_dev_inst *dso_dev_new(int index, const struct dso_profile *prof) { @@ -258,7 +257,7 @@ static int hw_init(void) if (!(drvc = g_try_malloc0(sizeof(struct drv_context)))) { sr_err("hantek-dso: driver context malloc failed."); - return SR_ERR; + return SR_ERR_MALLOC; } if (libusb_init(NULL) != 0) { @@ -602,6 +601,7 @@ static void send_chunk(struct dev_context *devc, unsigned char *buf, analog.num_samples = num_samples; analog.mq = SR_MQ_VOLTAGE; analog.unit = SR_UNIT_VOLT; + /* TODO: Check malloc return value. */ analog.data = g_try_malloc(analog.num_samples * sizeof(float) * num_probes); data_offset = 0; for (i = 0; i < analog.num_samples; i++) { @@ -804,6 +804,7 @@ static int handle_event(int fd, int revents, void *cb_data) devc->trigger_offset = trigger_offset; num_probes = (devc->ch1_enabled && devc->ch2_enabled) ? 2 : 1; + /* TODO: Check malloc return value. */ devc->framebuf = g_try_malloc(devc->framesize * num_probes * 2); devc->samp_buffered = devc->samp_received = 0; @@ -884,8 +885,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi, return SR_OK; } -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) { struct dev_context *devc;