For the few device profiles that probe the device dynamically to determine
channel settings, the results end up in the dynamically-allocated
devc->channels instead of in the statically-configured
devc->device->channels field.
Previously this would crash by dereferencing a null ch_spec for the
device types that do dynamic channel configuration.
[ gsi: address minor style nits ]
if (ret != SR_OK)
return ret;
- ch_spec = &devc->device->channels[pch->hw_output_idx];
+ if (devc->channels) {
+ /* Dynamically-probed devices. */
+ ch_spec = &devc->channels[pch->hw_output_idx];
+ } else {
+ /* Statically-configured devices. */
+ ch_spec = &devc->device->channels[pch->hw_output_idx];
+ }
packet.type = SR_DF_ANALOG;
packet.payload = &analog;
/* Note: digits/spec_digits will be overridden later. */