X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fopenbench-logic-sniffer%2Fols.c;h=e9f0c2d34aa49808cbff9cdb179f161c44c05bec;hb=8e49cebd10a1f34e9d5cdafeebc4c59a5c3c563c;hp=d4d17688c92bf72f298fe03057b857a11fb17630;hpb=4af22da5950cf490f2300199dfacd705e1d220b3;p=libsigrok.git diff --git a/hardware/openbench-logic-sniffer/ols.c b/hardware/openbench-logic-sniffer/ols.c index d4d17688..e9f0c2d3 100644 --- a/hardware/openbench-logic-sniffer/ols.c +++ b/hardware/openbench-logic-sniffer/ols.c @@ -458,18 +458,23 @@ static int hw_opendev(int device_index) return SR_OK; } -static void hw_closedev(int device_index) +static int hw_closedev(int device_index) { struct sr_device_instance *sdi; - if (!(sdi = sr_get_device_instance(device_instances, device_index))) - return; + if (!(sdi = sr_get_device_instance(device_instances, device_index))) { + sr_err("ols: %s: sdi was NULL", __func__); + return SR_ERR; /* TODO: SR_ERR_ARG? */ + } + /* TODO */ if (sdi->serial->fd != -1) { serial_close(sdi->serial->fd); sdi->serial->fd = -1; sdi->status = SR_ST_INACTIVE; } + + return SR_OK; } static void hw_cleanup(void) @@ -477,7 +482,7 @@ static void hw_cleanup(void) GSList *l; struct sr_device_instance *sdi; - /* Properly close all devices. */ + /* Properly close and free all devices. */ for (l = device_instances; l; l = l->next) { sdi = l->data; if (sdi->serial->fd != -1) @@ -952,8 +957,8 @@ struct sr_device_plugin ols_plugin_info = { .api_version = 1, .init = hw_init, .cleanup = hw_cleanup, - .open = hw_opendev, - .close = hw_closedev, + .opendev = hw_opendev, + .closedev = hw_closedev, .get_device_info = hw_get_device_info, .get_status = hw_get_status, .get_capabilities = hw_get_capabilities,