devopts, ARRAY_SIZE(devopts), sizeof(uint32_t));
break;
case SR_CONF_SAMPLERATE:
- if (!sdi || !sdi->priv || !(devc = sdi->priv))
+ if (!sdi)
return SR_ERR_BUG;
+ devc = sdi->priv;
cv_fill_samplerates_if_needed(sdi);
g_variant_builder_init(&gvb, G_VARIANT_TYPE("a{sv}"));
gvar = g_variant_new_fixed_array(G_VARIANT_TYPE("t"),
if (check_key(driver, sdi, cg, key, SR_CONF_GET, NULL) != SR_OK)
return SR_ERR_ARG;
- if (sdi && !sdi->priv)
+ if (sdi && !sdi->priv) {
+ sr_err("Can't get config (sdi != NULL, sdi->priv == NULL).");
return SR_ERR;
+ }
if ((ret = driver->config_get(key, data, sdi, cg)) == SR_OK) {
log_key(sdi, cg, key, SR_CONF_GET, *data);
/**
* List all possible values for a configuration key.
*
- * @param[in] driver The sr_dev_driver struct to query.
+ * @param[in] driver The sr_dev_driver struct to query. Must not be NULL.
* @param[in] sdi (optional) If the key is specific to a device, this must
* contain a pointer to the struct sr_dev_inst to be checked.
+ * Otherwise it must be NULL. If sdi is != NULL, sdi->priv must
+ * also be != NULL.
* @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_*).
if (check_key(driver, sdi, cg, key, SR_CONF_LIST, NULL) != SR_OK)
return SR_ERR_ARG;
}
+ if (sdi && !sdi->priv) {
+ sr_err("Can't list config (sdi != NULL, sdi->priv == NULL).");
+ return SR_ERR;
+ }
if ((ret = driver->config_list(key, data, sdi, cg)) == SR_OK) {
log_key(sdi, cg, key, SR_CONF_LIST, *data);
g_variant_ref_sink(*data);