if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- if (!(devc = sdi->priv)) {
- sr_err("sdi->priv was NULL.");
- return SR_ERR_BUG;
- }
+ devc = sdi->priv;
switch (key) {
case SR_CONF_LIMIT_MSEC:
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- if (!(devc = sdi->priv)) {
- sr_err("sdi->priv was NULL.");
- return SR_ERR_BUG;
- }
+ devc = sdi->priv;
switch (key) {
case SR_CONF_LIMIT_SAMPLES:
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- if (!(devc = sdi->priv)) {
- sr_err("sdi->priv was NULL.");
- return SR_ERR_BUG;
- }
+ devc = sdi->priv;
return sr_sw_limits_config_set(&devc->sw_limits, key, data);
}
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- if (!(devc = sdi->priv)) {
- sr_err("sdi->priv was NULL.");
- return SR_ERR_BUG;
- }
+ devc = sdi->priv;
return sr_sw_limits_config_set(&devc->sw_limits, key, data);
}
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- if (!(devc = sdi->priv)) {
- sr_err("sdi->priv was NULL.");
- return SR_ERR_BUG;
- }
+ devc = sdi->priv;
ret = SR_OK;
switch (key) {
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- if (!(devc = sdi->priv))
- return SR_ERR_BUG;
+ devc = sdi->priv;
switch (key) {
case SR_CONF_SAMPLERATE:
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- if (!(devc = sdi->priv)) {
- sr_err("sdi->priv was NULL.");
- return SR_ERR_BUG;
- }
+ devc = sdi->priv;
return sr_sw_limits_config_set(&devc->limits, key, data);
}
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- if (!(devc = sdi->priv)) {
- sr_err("sdi->priv was NULL.");
- return SR_ERR_BUG;
- }
+ devc = sdi->priv;
switch (key) {
case SR_CONF_LIMIT_MSEC:
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- if (!(devc = sdi->priv)) {
- sr_err("sdi->priv was NULL.");
- return SR_ERR_BUG;
- }
+ devc = sdi->priv;
switch (key) {
case SR_CONF_POWER_OFF:
(void)cg;
- if (!sdi || !(devc = sdi->priv))
+ if (!sdi)
return SR_ERR_ARG;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
+ devc = sdi->priv;
+
switch (key) {
case SR_CONF_LIMIT_FRAMES:
devc->frame_limit = g_variant_get_uint64(data);
double tmp_d;
gboolean update_sample_rate;
- if (!sdi || !(devc = sdi->priv))
+ if (!sdi)
return SR_ERR_ARG;
+ devc = sdi->priv;
+
if ((cg_type = check_channel_group(devc, cg)) == CG_INVALID)
return SR_ERR;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- if (!(devc = sdi->priv))
- return SR_ERR_BUG;
+ devc = sdi->priv;
return sr_sw_limits_config_set(&devc->limits, key, data);
}
double pos;
(void)cg;
+
devc = sdi->priv;
if (sdi->status != SR_ST_ACTIVE)
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- if (!(devc = sdi->priv)) {
- sr_err("sdi->priv was NULL.");
- return SR_ERR_BUG;
- }
+ devc = sdi->priv;
return sr_sw_limits_config_set(&devc->limits, key, data);
}
const char *tmp_str;
char buffer[16];
- if (!(devc = sdi->priv))
- return SR_ERR_ARG;
+ devc = sdi->priv;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- if (!(devc = sdi->priv)) {
- sr_err("sdi->priv was NULL.");
- return SR_ERR_BUG;
- }
+ devc = sdi->priv;
return sr_sw_limits_config_set(&devc->limits, key, data);
}
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- if (!(devc = sdi->priv)) {
- sr_err("sdi->priv was NULL.");
- return SR_ERR_BUG;
- }
+ devc = sdi->priv;
return sr_sw_limits_config_set(&devc->sw_limits, key, data);
}
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- if (!(devc = sdi->priv)) {
- sr_err("%s: sdi->priv was NULL", __func__);
- return SR_ERR_ARG;
- }
+ devc = sdi->priv;
switch (key) {
case SR_CONF_SAMPLERATE:
/**
* Set value of a configuration key in a device instance.
*
- * @param[in] sdi The device instance.
+ * @param[in] sdi The device instance. Must not be NULL. sdi->driver and
+ * sdi->priv must not be NULL either.
* @param[in] cg The channel group on the device for which to list the
* values, or NULL.
* @param[in] key The configuration key (SR_CONF_*).
g_variant_ref_sink(data);
- if (!sdi || !sdi->driver || !data)
+ if (!sdi || !sdi->driver || !sdi->priv || !data)
ret = SR_ERR;
else if (!sdi->driver->config_set)
ret = SR_ERR_ARG;