* @param[in] enabled @copydoc sr_channel::enabled
* @param[in] name @copydoc sr_channel::name
*
- * @return NULL (failure) or new struct sr_channel*.
+ * @return A new struct sr_channel*.
*/
SR_PRIV struct sr_channel *sr_channel_new(int index, int type,
gboolean enabled, const char *name)
{
struct sr_channel *ch;
- if (!(ch = g_try_malloc0(sizeof(struct sr_channel)))) {
- sr_err("Channel malloc failed.");
- return NULL;
- }
-
+ ch = g_malloc0(sizeof(struct sr_channel));
ch->index = index;
ch->type = type;
ch->enabled = enabled;
return SR_ERR_ARG;
ch = sr_channel_new(index, type, TRUE, name);
- if (!ch)
- return SR_ERR;
-
sdi->channels = g_slist_append(sdi->channels, ch);
return SR_OK;
sdi->conn = serial;
sdi->priv = devc;
sdi->driver = di;
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1")))
- return NULL;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1");
sdi->channels = g_slist_append(sdi->channels, ch);
drvc->instances = g_slist_append(drvc->instances, sdi);
devices = g_slist_append(devices, sdi);
sdi->priv = devc;
sdi->driver = di;
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "T1")))
- goto scan_cleanup;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "T1");
sdi->channels = g_slist_append(sdi->channels, ch);
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "T2")))
- goto scan_cleanup;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "T2");
sdi->channels = g_slist_append(sdi->channels, ch);
drvc->instances = g_slist_append(drvc->instances, sdi);
for (i = 0; i < ARRAY_SIZE(channel_names); i++) {
ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE,
channel_names[i]);
- if (!ch)
- return NULL;
sdi->channels = g_slist_append(sdi->channels, ch);
}
/* Fill the channels */
for (i = 0; i < maxch; i++) {
- if (!(ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE,
- beaglelogic_channel_names[i])))
- return NULL;
+ ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE,
+ beaglelogic_channel_names[i]);
sdi->channels = g_slist_append(sdi->channels, ch);
}
devc = g_malloc0(sizeof(struct dev_context));
sdi->priv = devc;
sdi->driver = di;
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1")))
- return NULL;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1");
sdi->channels = g_slist_append(sdi->channels, ch);
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P2")))
- return NULL;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P2");
sdi->channels = g_slist_append(sdi->channels, ch);
sdi->inst_type = SR_INST_USB;
drvc = di->priv;
sdi->priv = devc;
sdi->driver = di;
-
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1")))
- goto scan_cleanup;
-
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1");
sdi->channels = g_slist_append(sdi->channels, ch);
drvc->instances = g_slist_append(drvc->instances, sdi);
devices = g_slist_append(devices, sdi);
sdi->inst_type = SR_INST_SERIAL;
sdi->priv = devc;
sdi->driver = di;
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "SPL")))
- return NULL;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "SPL");
sdi->channels = g_slist_append(sdi->channels, ch);
drvc->instances = g_slist_append(drvc->instances, sdi);
devices = g_slist_append(devices, sdi);
sdi->driver = center_devs[idx].di;
for (i = 0; i < center_devs[idx].num_channels; i++) {
- if (!(ch = sr_channel_new(i, SR_CHANNEL_ANALOG,
- TRUE, channel_names[i])))
- goto scan_cleanup;
+ ch = sr_channel_new(i, SR_CHANNEL_ANALOG,
+ TRUE, channel_names[i]);
sdi->channels = g_slist_append(sdi->channels, ch);
}
drvc->instances = g_slist_append(drvc->instances, sdi);
devices = g_slist_append(devices, sdi);
-scan_cleanup:
serial_close(serial);
return devices;
sdi->priv = devc;
for (i = 0; i < devc->prof->num_channels; i++) {
- if (!(ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE,
- cv_channel_names[i]))) {
- ret = SR_ERR;
- goto err_free_dev_inst;
- }
+ ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE,
+ cv_channel_names[i]);
sdi->channels = g_slist_append(sdi->channels, ch);
}
if (ret == SR_OK)
return SR_OK;
-err_free_dev_inst:
- sr_dev_inst_free(sdi);
- g_free(devc->final_buf);
err_free_devc:
g_free(devc);
sdi->inst_type = SR_INST_SERIAL;
sdi->priv = devc;
sdi->driver = di;
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1")))
- return NULL;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1");
sdi->channels = g_slist_append(sdi->channels, ch);
drvc->instances = g_slist_append(drvc->instances, sdi);
devices = g_slist_append(devices, sdi);
sdi->conn = serial;
sdi->priv = NULL;
sdi->driver = di;
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "CH1")))
- return NULL;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "CH1");
sdi->channels = g_slist_append(sdi->channels, ch);
-
drvc->instances = g_slist_append(drvc->instances, sdi);
devices = g_slist_append(devices, sdi);
cg->name = g_strdup("Logic");
for (i = 0; i < num_logic_channels; i++) {
sprintf(channel_name, "D%d", i);
- if (!(ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE, channel_name)))
- return NULL;
+ ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE, channel_name);
sdi->channels = g_slist_append(sdi->channels, ch);
cg->channels = g_slist_append(cg->channels, ch);
}
sdi->conn = serial;
sdi->priv = devc;
sdi->driver = di;
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1")))
- return NULL;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1");
sdi->channels = g_slist_append(sdi->channels, ch);
drvc->instances = g_slist_append(drvc->instances, sdi);
devices = g_slist_append(devices, sdi);
/* Fill in channellist according to this device's profile. */
num_logic_channels = prof->dev_caps & DEV_CAPS_16BIT ? 16 : 8;
for (j = 0; j < num_logic_channels; j++) {
- if (!(ch = sr_channel_new(j, SR_CHANNEL_LOGIC, TRUE,
- channel_names[j])))
- return NULL;
+ ch = sr_channel_new(j, SR_CHANNEL_LOGIC, TRUE,
+ channel_names[j]);
sdi->channels = g_slist_append(sdi->channels, ch);
}
sdi->conn = serial;
sdi->priv = devc;
sdi->driver = &gmc_mh_1x_2x_rs232_driver_info;
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1")))
- return NULL;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1");
sdi->channels = g_slist_append(sdi->channels, ch);
drvc->instances = g_slist_append(drvc->instances, sdi);
devices = g_slist_append(devices, sdi);
if (devc->model != METRAHIT_NONE) {
sr_spew("%s %s detected!", VENDOR_GMC, gmc_model_str(devc->model));
-
devc->elapsed_msec = g_timer_new();
-
sdi->model = g_strdup(gmc_model_str(devc->model));
sdi->version = g_strdup_printf("Firmware %d.%d", devc->fw_ver_maj, devc->fw_ver_min);
sdi->conn = serial;
sdi->priv = devc;
sdi->driver = &gmc_mh_2x_bd232_driver_info;
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1")))
- goto exit_err;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1");
sdi->channels = g_slist_append(sdi->channels, ch);
drvc->instances = g_slist_append(drvc->instances, sdi);
devices = g_slist_append(devices, sdi);
-
devc = g_malloc0(sizeof(struct dev_context));
-
sdi = g_malloc0(sizeof(struct sr_dev_inst));
sdi->status = SR_ST_INACTIVE;
sdi->vendor = g_strdup(VENDOR_GMC);
/* Add analog channels. */
for (i = 0; i < scope_models[model_index].analog_channels; i++) {
- if (!(ch = sr_channel_new(i, SR_CHANNEL_ANALOG, TRUE,
- (*scope_models[model_index].analog_names)[i])))
- return SR_ERR_MALLOC;
+ ch = sr_channel_new(i, SR_CHANNEL_ANALOG, TRUE,
+ (*scope_models[model_index].analog_names)[i]);
sdi->channels = g_slist_append(sdi->channels, ch);
devc->analog_groups[i] = g_malloc0(sizeof(struct sr_channel_group));
/* Add digital channels. */
for (i = 0; i < scope_models[model_index].digital_channels; i++) {
- if (!(ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE,
- (*scope_models[model_index].digital_names)[i])))
- return SR_ERR_MALLOC;
+ ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE,
+ (*scope_models[model_index].digital_names)[i]);
sdi->channels = g_slist_append(sdi->channels, ch);
devc->digital_groups[i < 8 ? 0 : 1]->channels = g_slist_append(
sdi->priv = devc;
for (i = 0; channel_names[i]; i++) {
- if (!(ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE,
- channel_names[i])))
- return NULL;
+ ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE,
+ channel_names[i]);
sdi->channels = g_slist_append(sdi->channels, ch);
}
sdi->driver = di;
sdi->inst_type = SR_INST_USB;
sdi->conn = l->data;
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "SPL")))
- return NULL;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "SPL");
sdi->channels = g_slist_append(sdi->channels, ch);
devc = g_malloc0(sizeof(struct dev_context));
sdi->priv = devc;
if (profile->logformat == LOG_TEMP_RH) {
/* Model this as two channels: temperature and humidity. */
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "Temp")))
- return NULL;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "Temp");
sdi->channels = g_slist_append(NULL, ch);
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "Hum")))
- return NULL;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "Hum");
sdi->channels = g_slist_append(sdi->channels, ch);
} else if (profile->logformat == LOG_CO) {
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "CO")))
- return NULL;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "CO");
sdi->channels = g_slist_append(NULL, ch);
} else {
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1")))
- return NULL;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1");
sdi->channels = g_slist_append(NULL, ch);
}
for (i = 0; i < NUM_CHANNELS; i++) {
struct sr_channel *ch;
chtype = (i == 0) ? SR_CHANNEL_ANALOG : SR_CHANNEL_LOGIC;
- if (!(ch = sr_channel_new(i, chtype, TRUE,
- mso19_channel_names[i])))
- return 0;
+ ch = sr_channel_new(i, chtype, TRUE,
+ mso19_channel_names[i]);
sdi->channels = g_slist_append(sdi->channels, ch);
}
sdi->conn = serial;
sdi->driver = di;
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "CH1"))) {
- sr_err("Failed to create channel.");
- goto exit_err;
- }
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "CH1");
sdi->channels = g_slist_append(sdi->channels, ch);
devc = g_malloc0(sizeof(struct dev_context));
sdi->priv = devc;
sdi->driver = mic_devs[idx].di;
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "Temperature")))
- goto scan_cleanup;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "Temperature");
sdi->channels = g_slist_append(sdi->channels, ch);
if (mic_devs[idx].has_humidity) {
- if (!(ch = sr_channel_new(1, SR_CHANNEL_ANALOG, TRUE, "Humidity")))
- goto scan_cleanup;
+ ch = sr_channel_new(1, SR_CHANNEL_ANALOG, TRUE, "Humidity");
sdi->channels = g_slist_append(sdi->channels, ch);
}
drvc->instances = g_slist_append(drvc->instances, sdi);
devices = g_slist_append(devices, sdi);
-scan_cleanup:
serial_close(serial);
return devices;
sdi->conn = serial;
sdi->priv = devc;
sdi->driver = drv;
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE,
- "P1")))
- return NULL;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1");
sdi->channels = g_slist_append(sdi->channels, ch);
drvc->instances = g_slist_append(drvc->instances, sdi);
devices = g_slist_append(devices, sdi);
sdi->version = g_strdup("v1.0");
sdi->driver = di;
for (i = 0; i < 32; i++) {
- if (!(ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE,
- ols_channel_names[i])))
- return 0;
+ ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE,
+ ols_channel_names[i]);
sdi->channels = g_slist_append(sdi->channels, ch);
}
devc = ols_dev_new();
case 0x00:
/* Number of usable channels */
for (ui = 0; ui < tmp_int; ui++) {
- if (!(ch = sr_channel_new(ui, SR_CHANNEL_LOGIC, TRUE,
- ols_channel_names[ui])))
- return 0;
+ ch = sr_channel_new(ui, SR_CHANNEL_LOGIC, TRUE,
+ ols_channel_names[ui]);
sdi->channels = g_slist_append(sdi->channels, ch);
}
break;
case 0x00:
/* Number of usable channels */
for (ui = 0; ui < tmp_c; ui++) {
- if (!(ch = sr_channel_new(ui, SR_CHANNEL_LOGIC, TRUE,
- ols_channel_names[ui])))
- return 0;
+ ch = sr_channel_new(ui, SR_CHANNEL_LOGIC, TRUE,
+ ols_channel_names[ui]);
sdi->channels = g_slist_append(sdi->channels, ch);
}
break;
case 0x00:
/* Number of usable channels */
for (ui = 0; ui < tmp_int; ui++) {
- if (!(ch = sr_channel_new(ui, SR_CHANNEL_LOGIC, TRUE,
- p_ols_channel_names[ui])))
- return 0;
+ ch = sr_channel_new(ui, SR_CHANNEL_LOGIC, TRUE,
+ p_ols_channel_names[ui]);
sdi->channels = g_slist_append(sdi->channels, ch);
}
break;
case 0x00:
/* Number of usable channels */
for (ui = 0; ui < tmp_c; ui++) {
- if (!(ch = sr_channel_new(ui, SR_CHANNEL_LOGIC, TRUE,
- p_ols_channel_names[ui])))
- return 0;
+ ch = sr_channel_new(ui, SR_CHANNEL_LOGIC, TRUE,
+ p_ols_channel_names[ui]);
sdi->channels = g_slist_append(sdi->channels, ch);
}
break;
return NULL;
ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE, channel_name);
g_free(channel_name);
- if (!ch)
- return NULL;
sdi->channels = g_slist_append(sdi->channels, ch);
devc->digital_group->channels = g_slist_append(
devc->digital_group->channels, ch);
sdi->connection_id = g_strdup(connection_id);
for (j = 0; channel_names[j]; j++) {
- if (!(ch = sr_channel_new(j, SR_CHANNEL_LOGIC, TRUE,
- channel_names[j])))
- return NULL;
+ ch = sr_channel_new(j, SR_CHANNEL_LOGIC, TRUE,
+ channel_names[j]);
sdi->channels = g_slist_append(sdi->channels, ch);
}
sdi->conn = serial;
sdi->priv = devc;
sdi->driver = dmms[dmm].di;
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1")))
- goto scan_cleanup;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1");
sdi->channels = g_slist_append(sdi->channels, ch);
drvc->instances = g_slist_append(drvc->instances, sdi);
devices = g_slist_append(devices, sdi);
sdi->priv = devc;
sdi->driver = di;
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P")))
- goto scan_cleanup;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P");
sdi->channels = g_slist_append(sdi->channels, ch);
if (devc->optarif == OPTARIF_BASE) {
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "BASE")))
- goto scan_cleanup;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "BASE");
sdi->channels = g_slist_append(sdi->channels, ch);
} else if (devc->optarif == OPTARIF_HC) {
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HP")))
- goto scan_cleanup;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HP");
sdi->channels = g_slist_append(sdi->channels, ch);
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HC")))
- goto scan_cleanup;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HC");
sdi->channels = g_slist_append(sdi->channels, ch);
} else if (devc->optarif == OPTARIF_EJP) {
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HN")))
- goto scan_cleanup;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HN");
sdi->channels = g_slist_append(sdi->channels, ch);
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HPM")))
- goto scan_cleanup;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HPM");
sdi->channels = g_slist_append(sdi->channels, ch);
} else if (devc->optarif == OPTARIF_BBR) {
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HPJB")))
- goto scan_cleanup;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HPJB");
sdi->channels = g_slist_append(sdi->channels, ch);
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HPJW")))
- goto scan_cleanup;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HPJW");
sdi->channels = g_slist_append(sdi->channels, ch);
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HPJR")))
- goto scan_cleanup;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HPJR");
sdi->channels = g_slist_append(sdi->channels, ch);
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HCJB")))
- goto scan_cleanup;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HCJB");
sdi->channels = g_slist_append(sdi->channels, ch);
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HCJW")))
- goto scan_cleanup;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HCJW");
sdi->channels = g_slist_append(sdi->channels, ch);
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HCJR")))
- goto scan_cleanup;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HCJR");
sdi->channels = g_slist_append(sdi->channels, ch);
}
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "IINST")))
- goto scan_cleanup;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "IINST");
sdi->channels = g_slist_append(sdi->channels, ch);
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "PAPP")))
- goto scan_cleanup;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "PAPP");
sdi->channels = g_slist_append(sdi->channels, ch);
drvc->instances = g_slist_append(drvc->instances, sdi);
sdi->priv = devc;
sdi->driver = di;
ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1");
- if (!ch) {
- sr_err("Failed to create channel.");
- return NULL;
- }
sdi->channels = g_slist_append(sdi->channels, ch);
drvc->instances = g_slist_append(drvc->instances, sdi);
devices = g_slist_append(devices, sdi);
for (l = usb_devices; l; l = l->next) {
usb = l->data;
-
devc = g_malloc0(sizeof(struct dev_context));
-
devc->first_run = TRUE;
-
sdi = g_malloc0(sizeof(struct sr_dev_inst));
sdi->status = SR_ST_INACTIVE;
sdi->vendor = g_strdup(udmms[dmm].vendor);
sdi->model = g_strdup(udmms[dmm].device);
sdi->priv = devc;
sdi->driver = udmms[dmm].di;
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1")))
- return NULL;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1");
sdi->channels = g_slist_append(sdi->channels, ch);
-
sdi->inst_type = SR_INST_USB;
sdi->conn = usb;
-
drvc->instances = g_slist_append(drvc->instances, sdi);
devices = g_slist_append(devices, sdi);
}
sdi->inst_type = SR_INST_USB;
sdi->conn = l->data;
for (i = 0; i < 3; i++) {
- if (!(ch = sr_channel_new(i, SR_CHANNEL_ANALOG, TRUE,
- channels[i]))) {
- sr_dbg("Channel malloc failed.");
- return NULL;
- }
+ ch = sr_channel_new(i, SR_CHANNEL_ANALOG, TRUE,
+ channels[i]);
sdi->channels = g_slist_append(sdi->channels, ch);
}
devc = g_malloc0(sizeof(struct dev_context));
devc = g_malloc0(sizeof(struct dev_context));
sdi->priv = devc;
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1")))
- return NULL;
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1");
sdi->channels = g_slist_append(NULL, ch);
if (!(sdi->conn = sr_usb_dev_inst_new(libusb_get_bus_number(devlist[i]),
/* Add analog channels. */
for (i = 0; i < scope_models[model_index].analog_channels; i++) {
- if (!(ch = sr_channel_new(i, SR_CHANNEL_ANALOG, TRUE,
- (*scope_models[model_index].analog_names)[i])))
- return SR_ERR_MALLOC;
+ ch = sr_channel_new(i, SR_CHANNEL_ANALOG, TRUE,
+ (*scope_models[model_index].analog_names)[i]);
sdi->channels = g_slist_append(sdi->channels, ch);
devc->analog_groups[i] = g_malloc0(sizeof(struct sr_channel_group));
/* Add digital channels. */
for (i = 0; i < scope_models[model_index].digital_channels; i++) {
- if (!(ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE,
- (*scope_models[model_index].digital_names)[i])))
- return SR_ERR_MALLOC;
+ ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE,
+ (*scope_models[model_index].digital_names)[i]);
sdi->channels = g_slist_append(sdi->channels, ch);
devc->digital_groups[i / 8]->channels = g_slist_append(
/* 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;
+ ch = sr_channel_new(j, SR_CHANNEL_LOGIC, TRUE,
+ channel_names[j]);
sdi->channels = g_slist_append(sdi->channels, ch);
}
{
struct sr_channel *ch;
- if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, name)))
- return SR_ERR;
-
+ ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, name);
sdi->channels = g_slist_append(sdi->channels, ch);
return SR_OK;
g_variant_new_uint64(total_channels), sdi, NULL);
for (p = 0; p < total_channels; p++) {
snprintf(channelname, SR_MAX_CHANNELNAME_LEN, "%" PRIu64, p);
- if (!(ch = sr_channel_new(p, SR_CHANNEL_LOGIC, TRUE,
- channelname)))
- return SR_ERR;
+ ch = sr_channel_new(p, SR_CHANNEL_LOGIC, TRUE,
+ channelname);
sdi->channels = g_slist_append(sdi->channels, ch);
}
} else if (!strncmp(keys[j], "probe", 5)) {