X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fzeroplus-logic-cube%2Fapi.c;h=fd3ef08bcb325578ca66bf0fa502e9f06a4d3fce;hb=16aca7661b7ab34a399c323bb9214721e2b1be0c;hp=b2e7b7f38ce47409bf2ac30bff537d59c6c4480c;hpb=aac29cc192ccf82b64e77b5e6b11b411da32deed;p=libsigrok.git diff --git a/src/hardware/zeroplus-logic-cube/api.c b/src/hardware/zeroplus-logic-cube/api.c index b2e7b7f3..fd3ef08b 100644 --- a/src/hardware/zeroplus-logic-cube/api.c +++ b/src/hardware/zeroplus-logic-cube/api.c @@ -164,7 +164,6 @@ static int init(struct sr_context *sr_ctx) static GSList *scan(GSList *options) { struct sr_dev_inst *sdi; - struct sr_channel *ch; struct drv_context *drvc; struct dev_context *devc; const struct zp_model *prof; @@ -231,11 +230,7 @@ static GSList *scan(GSList *options) sdi->connection_id = g_strdup(connection_id); /* Allocate memory for our private driver context. */ - if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) { - sr_err("Device context malloc failed."); - return NULL; - } - + devc = g_malloc0(sizeof(struct dev_context)); sdi->priv = devc; devc->prof = prof; devc->num_channels = prof->channels; @@ -251,12 +246,9 @@ static GSList *scan(GSList *options) // memset(devc->trigger_buffer, 0, NUM_TRIGGER_STAGES); /* Fill in channellist according to this device's profile. */ - for (j = 0; j < devc->num_channels; j++) { - if (!(ch = sr_channel_new(j, SR_CHANNEL_LOGIC, TRUE, - channel_names[j]))) - return NULL; - sdi->channels = g_slist_append(sdi->channels, ch); - } + for (j = 0; j < devc->num_channels; j++) + sr_channel_new(sdi, j, SR_CHANNEL_LOGIC, TRUE, + channel_names[j]); devices = g_slist_append(devices, sdi); drvc->instances = g_slist_append(drvc->instances, sdi);