Consistently don't check sdi->priv in dev_acquisition_start().
Most drivers already assume this to be != NULL anyway, and the check should probably be in the API wrappers anyway.
This commit is contained in:
parent
1c47e0da8f
commit
208c1d3543
|
@ -235,11 +235,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
|||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
if (!(devc = sdi->priv)) {
|
||||
sr_err("sdi->priv was NULL.");
|
||||
return SR_ERR_BUG;
|
||||
}
|
||||
|
||||
devc = sdi->priv;
|
||||
devc->cb_data = cb_data;
|
||||
|
||||
std_session_send_df_header(cb_data, LOG_PREFIX);
|
||||
|
|
|
@ -225,8 +225,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int dev_acquisition_start(const struct sr_dev_inst *sdi,
|
||||
void *cb_data)
|
||||
static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
||||
{
|
||||
struct sr_serial_dev_inst *serial;
|
||||
struct dev_context *devc;
|
||||
|
@ -235,11 +234,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi,
|
|||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
if (!(devc = sdi->priv)) {
|
||||
sr_err("sdi->priv was NULL.");
|
||||
return SR_ERR_BUG;
|
||||
}
|
||||
|
||||
devc = sdi->priv;
|
||||
devc->session_cb_data = cb_data;
|
||||
|
||||
/*
|
||||
|
|
|
@ -352,7 +352,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
|||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
devc = sdi->priv;
|
||||
|
||||
serial = sdi->conn;
|
||||
|
||||
/* Send the 'monitor <ms>' command (doesn't have a reply). */
|
||||
|
|
|
@ -460,8 +460,7 @@ static int dev_close(struct sr_dev_inst *sdi)
|
|||
return std_serial_dev_close(sdi);
|
||||
}
|
||||
|
||||
static int dev_acquisition_start(const struct sr_dev_inst *sdi,
|
||||
void *cb_data)
|
||||
static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
struct sr_serial_dev_inst *serial;
|
||||
|
|
|
@ -337,13 +337,13 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
|
|||
#define BUFUNIT_TIMEOUT_MS(devc) (100 + ((devc->bufunitsize * 1000) / \
|
||||
(uint32_t)(devc->cur_samplerate)))
|
||||
|
||||
static int dev_acquisition_start(const struct sr_dev_inst *sdi,
|
||||
void *cb_data)
|
||||
static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
||||
{
|
||||
(void)cb_data;
|
||||
struct dev_context *devc = sdi->priv;
|
||||
struct sr_trigger *trigger;
|
||||
|
||||
(void)cb_data;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
|
|
|
@ -249,8 +249,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int dev_acquisition_start(const struct sr_dev_inst *sdi,
|
||||
void *cb_data)
|
||||
static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
|
|
|
@ -202,11 +202,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
|||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
if (!(devc = sdi->priv)) {
|
||||
sr_err("sdi->priv was NULL.");
|
||||
return SR_ERR_BUG;
|
||||
}
|
||||
|
||||
devc = sdi->priv;
|
||||
devc->cb_data = cb_data;
|
||||
|
||||
/*
|
||||
|
|
|
@ -386,11 +386,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
|||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
if (!(devc = sdi->priv)) {
|
||||
sr_err("sdi->priv was NULL.");
|
||||
return SR_ERR_BUG;
|
||||
}
|
||||
|
||||
devc = sdi->priv;
|
||||
devc->cb_data = cb_data;
|
||||
devc->state = ST_INIT;
|
||||
devc->num_samples = 0;
|
||||
|
|
|
@ -515,10 +515,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
|||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
if (!(devc = sdi->priv)) {
|
||||
sr_err("sdi->priv was NULL.");
|
||||
return SR_ERR_BUG;
|
||||
}
|
||||
devc = sdi->priv;
|
||||
|
||||
if (!devc->ftdic) {
|
||||
sr_err("devc->ftdic was NULL.");
|
||||
|
|
|
@ -179,11 +179,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
|||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
if (!(devc = sdi->priv)) {
|
||||
sr_err("sdi->priv was NULL.");
|
||||
return SR_ERR_BUG;
|
||||
}
|
||||
|
||||
devc = sdi->priv;
|
||||
devc->cb_data = cb_data;
|
||||
|
||||
std_session_send_df_header(cb_data, LOG_PREFIX);
|
||||
|
|
|
@ -259,11 +259,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
|||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
if (!(devc = sdi->priv)) {
|
||||
sr_err("sdi->priv was NULL.");
|
||||
return SR_ERR_BUG;
|
||||
}
|
||||
|
||||
devc = sdi->priv;
|
||||
devc->cb_data = cb_data;
|
||||
|
||||
std_session_send_df_header(cb_data, LOG_PREFIX);
|
||||
|
|
|
@ -466,12 +466,10 @@ static int dev_acquisition_start_1x_2x_rs232(const struct sr_dev_inst *sdi,
|
|||
struct dev_context *devc;
|
||||
struct sr_serial_dev_inst *serial;
|
||||
|
||||
if (!sdi || !cb_data || !(devc = sdi->priv))
|
||||
return SR_ERR_BUG;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
devc = sdi->priv;
|
||||
devc->cb_data = cb_data;
|
||||
devc->settings_ok = FALSE;
|
||||
devc->buflen = 0;
|
||||
|
@ -496,12 +494,10 @@ static int dev_acquisition_start_2x_bd232(const struct sr_dev_inst *sdi,
|
|||
struct dev_context *devc;
|
||||
struct sr_serial_dev_inst *serial;
|
||||
|
||||
if (!sdi || !cb_data || !(devc = sdi->priv))
|
||||
return SR_ERR_BUG;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
devc = sdi->priv;
|
||||
devc->cb_data = cb_data;
|
||||
devc->settings_ok = FALSE;
|
||||
devc->buflen = 0;
|
||||
|
|
|
@ -686,8 +686,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int dev_acquisition_start(const struct sr_dev_inst *sdi,
|
||||
void *cb_data)
|
||||
static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
||||
{
|
||||
struct dev_context *devc = sdi->priv;
|
||||
int ret;
|
||||
|
|
|
@ -358,8 +358,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
|||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
if (!(devc = sdi->priv))
|
||||
return SR_ERR_BUG;
|
||||
devc = sdi->priv;
|
||||
|
||||
if (!devc->ftdic)
|
||||
return SR_ERR_BUG;
|
||||
|
|
|
@ -413,8 +413,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int dev_acquisition_start(const struct sr_dev_inst *sdi,
|
||||
void *cb_data)
|
||||
static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
||||
{
|
||||
struct sr_dev_driver *di = sdi->driver;
|
||||
struct drv_context *drvc;
|
||||
|
|
|
@ -191,11 +191,8 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
|||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
if (!(devc = sdi->priv))
|
||||
return SR_ERR_BUG;
|
||||
|
||||
devc = sdi->priv;
|
||||
devc->cb_data = cb_data;
|
||||
|
||||
serial = sdi->conn;
|
||||
|
||||
sr_spew("Set O1 mode (continuous values, stable and unstable ones).");
|
||||
|
|
|
@ -453,8 +453,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int dev_acquisition_start(const struct sr_dev_inst *sdi,
|
||||
void *cb_data)
|
||||
static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
struct sr_modbus_dev_inst *modbus;
|
||||
|
|
|
@ -254,12 +254,10 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
|||
struct dev_context *devc;
|
||||
struct sr_serial_dev_inst *serial;
|
||||
|
||||
if (!sdi || !cb_data || !(devc = sdi->priv))
|
||||
return SR_ERR_BUG;
|
||||
|
||||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
devc = sdi->priv;
|
||||
devc->cb_data = cb_data;
|
||||
|
||||
std_session_send_df_header(cb_data, LOG_PREFIX);
|
||||
|
|
|
@ -463,8 +463,7 @@ static int set_trigger(const struct sr_dev_inst *sdi, int stage)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int dev_acquisition_start(const struct sr_dev_inst *sdi,
|
||||
void *cb_data)
|
||||
static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
struct sr_serial_dev_inst *serial;
|
||||
|
|
|
@ -535,8 +535,7 @@ static int disable_trigger(const struct sr_dev_inst *sdi, int stage)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int dev_acquisition_start(const struct sr_dev_inst *sdi,
|
||||
void *cb_data)
|
||||
static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
uint32_t samplecount, readcount, delaycount;
|
||||
|
|
|
@ -219,11 +219,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
|||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
if (!(devc = sdi->priv)) {
|
||||
sr_err("sdi->priv was NULL.");
|
||||
return SR_ERR_BUG;
|
||||
}
|
||||
|
||||
devc = sdi->priv;
|
||||
devc->cb_data = cb_data;
|
||||
|
||||
/*
|
||||
|
|
|
@ -202,11 +202,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
|||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
if (!(devc = sdi->priv)) {
|
||||
sr_err("sdi->priv was NULL.");
|
||||
return SR_ERR_BUG;
|
||||
}
|
||||
|
||||
devc = sdi->priv;
|
||||
devc->session_cb_data = cb_data;
|
||||
|
||||
/*
|
||||
|
|
|
@ -161,8 +161,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int dev_acquisition_start(const struct sr_dev_inst *sdi,
|
||||
void *cb_data)
|
||||
static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
struct sr_serial_dev_inst *serial;
|
||||
|
|
|
@ -194,9 +194,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
|||
struct dev_context *devc;
|
||||
|
||||
devc = sdi->priv;
|
||||
|
||||
devc->cb_data = cb_data;
|
||||
|
||||
devc->starttime = g_get_monotonic_time();
|
||||
|
||||
std_session_send_df_header(sdi, LOG_PREFIX);
|
||||
|
|
|
@ -271,8 +271,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int dev_acquisition_start(const struct sr_dev_inst *sdi,
|
||||
void *cb_data)
|
||||
static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
||||
{
|
||||
struct sr_dev_driver *di = sdi->driver;
|
||||
struct drv_context *drvc;
|
||||
|
|
|
@ -512,8 +512,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int dev_acquisition_start(const struct sr_dev_inst *sdi,
|
||||
void *cb_data)
|
||||
static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
struct sr_usb_dev_inst *usb;
|
||||
|
@ -538,10 +537,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi,
|
|||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
if (!(devc = sdi->priv)) {
|
||||
sr_err("%s: sdi->priv was NULL", __func__);
|
||||
return SR_ERR_ARG;
|
||||
}
|
||||
devc = sdi->priv;
|
||||
|
||||
if (analyzer_add_triggers(sdi) != SR_OK) {
|
||||
sr_err("Failed to configure triggers.");
|
||||
|
|
Loading…
Reference in New Issue