The hardware driver API specifies that the sdi argument to config_list
is optional and can be NULL. This change handles that case, instead of
dereferencing without a check.
{
struct dev_context *devc;
- devc = sdi->priv;
-
switch (key) {
case SR_CONF_SCAN_OPTIONS:
case SR_CONF_DEVICE_OPTIONS:
return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts);
case SR_CONF_SAMPLERATE:
+ if (!sdi)
+ return SR_ERR_ARG;
+ devc = sdi->priv;
if (devc->max_samplerate == SR_MHZ(200)) {
*data = std_gvar_samplerates(ARRAY_AND_SIZE(samplerates_la2016));
}