diff --git a/src/uwatec_meridian.c b/src/uwatec_meridian.c index 077ec31..d59b855 100644 --- a/src/uwatec_meridian.c +++ b/src/uwatec_meridian.c @@ -228,7 +228,11 @@ uwatec_meridian_device_open (dc_device_t **out, dc_context_t *context, const cha dc_serial_purge (device->port, DC_DIRECTION_ALL); // Perform the handshaking. - uwatec_meridian_handshake (device); + status = uwatec_meridian_handshake (device); + if (status != DC_STATUS_SUCCESS) { + ERROR (context, "Failed to handshake with the device."); + goto error_close; + } *out = (dc_device_t*) device; diff --git a/src/uwatec_smart.c b/src/uwatec_smart.c index 2b94a3b..425e76e 100644 --- a/src/uwatec_smart.c +++ b/src/uwatec_smart.c @@ -191,7 +191,11 @@ uwatec_smart_device_open (dc_device_t **out, dc_context_t *context) } // Perform the handshaking. - uwatec_smart_handshake (device); + status = uwatec_smart_handshake (device); + if (status != DC_STATUS_SUCCESS) { + ERROR (context, "Failed to handshake with the device."); + goto error_close; + } *out = (dc_device_t*) device;