scpi-pps: silence potential NULL dereference compiler warning
Check pointers' validity before dereferencing them. This was reported by clang's scan-build.
This commit is contained in:
parent
6a821db6f2
commit
08eba2d301
|
@ -525,10 +525,12 @@ static int config_list(uint32_t key, GVariant **data,
|
||||||
return std_opts_config_list(key, data, sdi, cg,
|
return std_opts_config_list(key, data, sdi, cg,
|
||||||
ARRAY_AND_SIZE(scanopts),
|
ARRAY_AND_SIZE(scanopts),
|
||||||
ARRAY_AND_SIZE(drvopts),
|
ARRAY_AND_SIZE(drvopts),
|
||||||
(devc) ? devc->device->devopts : NULL,
|
(devc && devc->device) ? devc->device->devopts : NULL,
|
||||||
(devc) ? devc->device->num_devopts : 0);
|
(devc && devc->device) ? devc->device->num_devopts : 0);
|
||||||
break;
|
break;
|
||||||
case SR_CONF_CHANNEL_CONFIG:
|
case SR_CONF_CHANNEL_CONFIG:
|
||||||
|
if (!devc || !devc->device)
|
||||||
|
return SR_ERR_ARG;
|
||||||
/* Not used. */
|
/* Not used. */
|
||||||
i = 0;
|
i = 0;
|
||||||
if (devc->device->features & PPS_INDEPENDENT)
|
if (devc->device->features & PPS_INDEPENDENT)
|
||||||
|
@ -557,6 +559,8 @@ static int config_list(uint32_t key, GVariant **data,
|
||||||
* specification for use in series or parallel mode.
|
* specification for use in series or parallel mode.
|
||||||
*/
|
*/
|
||||||
ch = cg->channels->data;
|
ch = cg->channels->data;
|
||||||
|
if (!devc || !devc->device)
|
||||||
|
return SR_ERR_ARG;
|
||||||
ch_spec = &(devc->device->channels[ch->index]);
|
ch_spec = &(devc->device->channels[ch->index]);
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
|
Loading…
Reference in New Issue