This ensures consistent checks and log messages across all drivers
and reduces the per-driver boilerplate.
uint8_t state = hung_chang_dso_2100_read_mbox(sdi->conn, 0.02);
int ret;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
switch (state) {
case 0x03:
case 0x14:
devc = sdi->priv;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
if (devc->acquisition) {
sr_err("Acquisition still in progress?");
return SR_ERR;
ret = SR_ERR;
else if (!sdi->driver->config_commit)
ret = SR_OK;
- else
+ else if (sdi->status != SR_ST_ACTIVE) {
+ sr_err("%s: Device instance not active, can't commit config.",
+ sdi->driver->name);
+ ret = SR_ERR_DEV_CLOSED;
+ } else
ret = sdi->driver->config_commit(sdi);
return ret;