beaglelogic: silence compiler warning
Explicitly assign NULL to param to avoid the "may be used uninitialized" warning reported in bug #1094. Behaviour remains unchanged. All references to the variable were under "if (!conn)", and the assigning arm of the branch checked for "if (!param)" after assignment. So the error could not happen, but compilers may not have noticed depending on the width of their scope during compilation. Move the initialization of 'conn' closer to the conditional assignment, such that all paths are seen in one spot during maintenance. This fixes bug #1094.
This commit is contained in:
parent
6f63b1ee67
commit
57a88297dd
|
@ -65,11 +65,12 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
|||
struct sr_config *src;
|
||||
struct sr_dev_inst *sdi;
|
||||
struct dev_context *devc;
|
||||
const char *conn = NULL;
|
||||
const char *conn;
|
||||
gchar **params;
|
||||
int i, maxch;
|
||||
|
||||
maxch = NUM_CHANNELS;
|
||||
conn = NULL;
|
||||
for (l = options; l; l = l->next) {
|
||||
src = l->data;
|
||||
if (src->key == SR_CONF_NUM_LOGIC_CHANNELS)
|
||||
|
@ -80,6 +81,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
|||
|
||||
/* Probe for /dev/beaglelogic if not connecting via TCP */
|
||||
if (!conn) {
|
||||
params = NULL;
|
||||
if (!g_file_test(BEAGLELOGIC_DEV_NODE, G_FILE_TEST_EXISTS))
|
||||
return NULL;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue