Fix a few "value never read" scan-build warnings.

This fixes parts of bug #423.

The list of fixed warnings:

src/output/srzip.c:285:3: warning: Value stored to 'ret' is never read
                ret = zip_append(o, logic->data, logic->unitsize, logic->length);
                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/scpi/scpi.c:610:2: warning: Value stored to 'ret' is never read
        ret = SR_OK;
        ^     ~~~~~
src/scpi/scpi.c:667:2: warning: Value stored to 'ret' is never read
        ret = SR_OK;
        ^     ~~~~~
src/dmm/vc870.c:410:2: warning: Value stored to 'info_local' is never read
        info_local = (struct vc870_info *)info;
        ^            ~~~~~~~~~~~~~~~~~~~~~~~~~
src/hardware/conrad-digi-35-cpu/api.c:130:2: warning: Value stored to 'ret' is never read
        ret = SR_OK;
        ^     ~~~~~
src/hardware/fx2lafw/api.c:658:2: warning: Value stored to 'timeout' is never read
        timeout = fx2lafw_get_timeout(devc);
        ^         ~~~~~~~~~~~~~~~~~~~~~~~~~
src/hardware/gmc-mh-1x-2x/protocol.c:941:3: warning: Value stored to 'retc' is never read
                retc = SR_ERR_ARG;
                ^      ~~~~~~~~~~
src/hardware/gmc-mh-1x-2x/api.c:168:2: warning: Value stored to 'model' is never read
        model = METRAHIT_NONE;
        ^       ~~~~~~~~~~~~~
src/hardware/ikalogic-scanalogic2/api.c:325:2: warning: Value stored to 'ret' is never read
        ret = SR_OK;
        ^     ~~~~~
src/hardware/openbench-logic-sniffer/api.c:185:3: warning: Value stored to 'devc' is never read
                devc = sdi->priv;
                ^      ~~~~~~~~~
src/hardware/rigol-ds/api.c:813:3: warning: Value stored to 'devc' is never read
                devc = sdi->priv;
                ^      ~~~~~~~~~
src/hardware/scpi-pps/api.c:405:2: warning: Value stored to 'ret' is never read
        ret = SR_OK;
        ^     ~~~~~
src/hardware/yokogawa-dlm/api.c:239:2: warning: Value stored to 'ret' is never read
        ret = SR_ERR_NA;
        ^     ~~~~~~~~~
This commit is contained in:
Uwe Hermann 2015-09-25 08:52:58 +02:00
parent 36cbd69e12
commit e57057aee7
12 changed files with 4 additions and 20 deletions

View File

@ -407,8 +407,6 @@ SR_PRIV int sr_vc870_parse(const uint8_t *buf, float *floatval,
int ret;
struct vc870_info *info_local;
info_local = (struct vc870_info *)info;
info_local = (struct vc870_info *)info;
memset(info_local, 0, sizeof(struct vc870_info));

View File

@ -127,7 +127,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
ret = SR_OK;
switch (key) {
case SR_CONF_VOLTAGE:
dblval = g_variant_get_double(data);

View File

@ -655,8 +655,6 @@ static int start_transfers(const struct sr_dev_inst *sdi)
} else
devc->trigger_fired = TRUE;
timeout = fx2lafw_get_timeout(devc);
num_transfers = fx2lafw_get_number_of_transfers(devc);
size = fx2lafw_get_buffer_size(devc);
devc->submitted_transfers = 0;

View File

@ -165,7 +165,6 @@ static GSList *scan_1x_2x_rs232(struct sr_dev_driver *di, GSList *options)
drvc = di->context;
drvc->instances = NULL;
conn = serialcomm = NULL;
model = METRAHIT_NONE;
serialcomm_given = FALSE;
sr_spew("scan_1x_2x_rs232() called!");

View File

@ -938,7 +938,6 @@ static int chk_msg14(struct sr_dev_inst *sdi)
}
if (devc->buf[1] == 0) { /* Error msg from device! */
retc = SR_ERR_ARG;
switch (devc->buf[2]) {
case 1: /* Not used */
sr_err("Device: Illegal error code!");

View File

@ -322,8 +322,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
ret = SR_OK;
switch (key) {
case SR_CONF_LIMIT_SAMPLES:
limit_samples = g_variant_get_uint64(data);

View File

@ -97,7 +97,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
struct sr_config *src;
struct sr_dev_inst *sdi;
struct drv_context *drvc;
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
GSList *l, *devices;
int ret;
@ -182,7 +181,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
if (sp_input_waiting(serial->data) != 0) {
/* Got metadata. */
sdi = get_metadata(serial);
devc = sdi->priv;
} else {
/* Not an OLS -- some other board that uses the sump protocol. */
sr_info("Device does not support metadata.");
@ -195,8 +193,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
for (i = 0; i < ARRAY_SIZE(ols_channel_names); i++)
sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE,
ols_channel_names[i]);
devc = ols_dev_new();
sdi->priv = devc;
sdi->priv = ols_dev_new();
}
/* Configure samplerate and divider. */
if (ols_set_samplerate(sdi, DEFAULT_SAMPLERATE) != SR_OK)

View File

@ -809,9 +809,6 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
unsigned int i;
struct dev_context *devc = NULL;
if (sdi)
devc = sdi->priv;
if (key == SR_CONF_SCAN_OPTIONS) {
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
scanopts, ARRAY_SIZE(scanopts), sizeof(uint32_t));

View File

@ -402,7 +402,7 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
select_channel(sdi, cg->channels->data);
devc = sdi->priv;
ret = SR_OK;
switch (key) {
case SR_CONF_ENABLED:
if (g_variant_get_boolean(data))

View File

@ -236,7 +236,6 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s
if ((cg_type = check_channel_group(devc, cg)) == CG_INVALID)
return SR_ERR;
ret = SR_ERR_NA;
model = devc->model_config;
state = devc->model_state;

View File

@ -283,6 +283,8 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p
}
logic = packet->payload;
ret = zip_append(o, logic->data, logic->unitsize, logic->length);
if (ret != SR_OK)
return ret;
break;
}

View File

@ -607,7 +607,6 @@ SR_PRIV int sr_scpi_get_floatv(struct sr_scpi_dev_inst *scpi,
gchar **ptr, **tokens;
GArray *response_array;
ret = SR_OK;
response = NULL;
tokens = NULL;
@ -664,7 +663,6 @@ SR_PRIV int sr_scpi_get_uint8v(struct sr_scpi_dev_inst *scpi,
gchar **ptr, **tokens;
GArray *response_array;
ret = SR_OK;
response = NULL;
tokens = NULL;