Fix Shearwater breakage caused by bad merging
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
6c6752d87e
commit
ecebda3b19
@ -116,13 +116,14 @@ error_free:
|
|||||||
dc_status_t
|
dc_status_t
|
||||||
shearwater_petrel_device_custom_open (dc_device_t **out, dc_context_t *context, dc_serial_t *serial)
|
shearwater_petrel_device_custom_open (dc_device_t **out, dc_context_t *context, dc_serial_t *serial)
|
||||||
{
|
{
|
||||||
dc_status_t rc = DC_STATUS_SUCCESS;
|
dc_status_t status = DC_STATUS_SUCCESS;
|
||||||
|
shearwater_petrel_device_t *device = NULL;
|
||||||
|
|
||||||
if (out == NULL || serial == NULL || serial->port == NULL)
|
if (out == NULL || serial == NULL || serial->port == NULL)
|
||||||
return DC_STATUS_INVALIDARGS;
|
return DC_STATUS_INVALIDARGS;
|
||||||
|
|
||||||
// Allocate memory.
|
// Allocate memory.
|
||||||
shearwater_petrel_device_t *device = (shearwater_petrel_device_t *) malloc (sizeof (shearwater_petrel_device_t));
|
device = (shearwater_petrel_device_t *) dc_device_allocate (context, &shearwater_petrel_device_vtable);
|
||||||
if (device == NULL) {
|
if (device == NULL) {
|
||||||
ERROR (context, "Failed to allocate memory.");
|
ERROR (context, "Failed to allocate memory.");
|
||||||
return DC_STATUS_NOMEMORY;
|
return DC_STATUS_NOMEMORY;
|
||||||
@ -132,15 +133,18 @@ shearwater_petrel_device_custom_open (dc_device_t **out, dc_context_t *context,
|
|||||||
memset (device->fingerprint, 0, sizeof (device->fingerprint));
|
memset (device->fingerprint, 0, sizeof (device->fingerprint));
|
||||||
|
|
||||||
// Open the device.
|
// Open the device.
|
||||||
rc = shearwater_common_custom_open (&device->base, context, serial);
|
status = shearwater_common_custom_open (&device->base, context, serial);
|
||||||
if (rc != DC_STATUS_SUCCESS) {
|
if (status != DC_STATUS_SUCCESS) {
|
||||||
free (device);
|
goto error_free;
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*out = (dc_device_t *) device;
|
*out = (dc_device_t *) device;
|
||||||
|
|
||||||
return DC_STATUS_SUCCESS;
|
return DC_STATUS_SUCCESS;
|
||||||
|
|
||||||
|
error_free:
|
||||||
|
dc_device_deallocate ((dc_device_t *) device);
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -102,13 +102,14 @@ error_free:
|
|||||||
dc_status_t
|
dc_status_t
|
||||||
shearwater_predator_device_custom_open (dc_device_t **out, dc_context_t *context, dc_serial_t *serial)
|
shearwater_predator_device_custom_open (dc_device_t **out, dc_context_t *context, dc_serial_t *serial)
|
||||||
{
|
{
|
||||||
dc_status_t rc = DC_STATUS_SUCCESS;
|
dc_status_t status = DC_STATUS_SUCCESS;
|
||||||
|
shearwater_predator_device_t *device = NULL;
|
||||||
|
|
||||||
if (out == NULL || serial == NULL || serial->port == NULL)
|
if (out == NULL || serial == NULL || serial->port == NULL)
|
||||||
return DC_STATUS_INVALIDARGS;
|
return DC_STATUS_INVALIDARGS;
|
||||||
|
|
||||||
// Allocate memory.
|
// Allocate memory.
|
||||||
shearwater_predator_device_t *device = (shearwater_predator_device_t *) malloc (sizeof (shearwater_predator_device_t));
|
device = (shearwater_predator_device_t *) dc_device_allocate (context, &shearwater_predator_device_vtable);
|
||||||
if (device == NULL) {
|
if (device == NULL) {
|
||||||
ERROR (context, "Failed to allocate memory.");
|
ERROR (context, "Failed to allocate memory.");
|
||||||
return DC_STATUS_NOMEMORY;
|
return DC_STATUS_NOMEMORY;
|
||||||
@ -118,15 +119,18 @@ shearwater_predator_device_custom_open (dc_device_t **out, dc_context_t *context
|
|||||||
memset (device->fingerprint, 0, sizeof (device->fingerprint));
|
memset (device->fingerprint, 0, sizeof (device->fingerprint));
|
||||||
|
|
||||||
// Open the device.
|
// Open the device.
|
||||||
rc = shearwater_common_custom_open (&device->base, context, serial);
|
status = shearwater_common_custom_open (&device->base, context, serial);
|
||||||
if (rc != DC_STATUS_SUCCESS) {
|
if (status != DC_STATUS_SUCCESS) {
|
||||||
free (device);
|
goto error_free;
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*out = (dc_device_t *) device;
|
*out = (dc_device_t *) device;
|
||||||
|
|
||||||
return DC_STATUS_SUCCESS;
|
return DC_STATUS_SUCCESS;
|
||||||
|
|
||||||
|
error_free:
|
||||||
|
dc_device_deallocate ((dc_device_t *) device);
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user