Fix OSTC3 merge errors
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
ecebda3b19
commit
480e54ace7
@ -379,18 +379,20 @@ dc_status_t
|
|||||||
hw_ostc3_device_custom_open (dc_device_t **out, dc_context_t *context, dc_serial_t *serial)
|
hw_ostc3_device_custom_open (dc_device_t **out, dc_context_t *context, dc_serial_t *serial)
|
||||||
{
|
{
|
||||||
dc_status_t status = DC_STATUS_SUCCESS;
|
dc_status_t status = DC_STATUS_SUCCESS;
|
||||||
|
hw_ostc3_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.
|
||||||
hw_ostc3_device_t *device = (hw_ostc3_device_t *) malloc (sizeof (hw_ostc3_device_t));
|
device = (hw_ostc3_device_t *) dc_device_allocate (context, &hw_ostc3_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;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the default values.
|
// Set the default values.
|
||||||
|
device->hardware = INVALID;
|
||||||
memset (device->fingerprint, 0, sizeof (device->fingerprint));
|
memset (device->fingerprint, 0, sizeof (device->fingerprint));
|
||||||
|
|
||||||
// Set the serial reference
|
// Set the serial reference
|
||||||
@ -401,7 +403,6 @@ hw_ostc3_device_custom_open (dc_device_t **out, dc_context_t *context, dc_serial
|
|||||||
int rc = serial_configure (device->serial->port, 115200, 8, SERIAL_PARITY_NONE, 1, SERIAL_FLOWCONTROL_NONE);
|
int rc = serial_configure (device->serial->port, 115200, 8, SERIAL_PARITY_NONE, 1, SERIAL_FLOWCONTROL_NONE);
|
||||||
if (rc == -1) {
|
if (rc == -1) {
|
||||||
ERROR (context, "Failed to set the terminal attributes.");
|
ERROR (context, "Failed to set the terminal attributes.");
|
||||||
free (device);
|
|
||||||
status = DC_STATUS_IO;
|
status = DC_STATUS_IO;
|
||||||
goto error_close;
|
goto error_close;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user