From: Gerhard Sittig Date: Fri, 9 Feb 2018 18:23:31 +0000 (+0100) Subject: ols, pipistrello-ols: silence "assigned, not used" compiler warning X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=b04cbd0ba3301396bd9e1e31c6f462087caf1de8;p=libsigrok.git ols, pipistrello-ols: silence "assigned, not used" compiler warning Each code path either assigns to 'flags', or leaves the routine. There is no potential path that leaves the variable at the initially assigned value, so the assignment took no effect. Remove it. Nit: Trim the source code line length while we are here. This was reported by clang's scan-build. --- diff --git a/src/hardware/openbench-logic-sniffer/api.c b/src/hardware/openbench-logic-sniffer/api.c index d15cb12c..fc0d9ebd 100644 --- a/src/hardware/openbench-logic-sniffer/api.c +++ b/src/hardware/openbench-logic-sniffer/api.c @@ -265,7 +265,6 @@ static int config_set(uint32_t key, GVariant *data, break; case SR_CONF_PATTERN_MODE: stropt = g_variant_get_string(data, NULL); - flag = 0xffff; if (!strcmp(stropt, STR_PATTERN_NONE)) { sr_info("Disabling test modes."); flag = 0x0000; @@ -278,10 +277,9 @@ static int config_set(uint32_t key, GVariant *data, } else { return SR_ERR; } - if (flag != 0xffff) { - devc->flag_reg &= ~(FLAG_INTERNAL_TEST_MODE | FLAG_EXTERNAL_TEST_MODE); - devc->flag_reg |= flag; - } + devc->flag_reg &= ~FLAG_INTERNAL_TEST_MODE; + devc->flag_reg &= ~FLAG_EXTERNAL_TEST_MODE; + devc->flag_reg |= flag; break; case SR_CONF_SWAP: if (g_variant_get_boolean(data)) { diff --git a/src/hardware/pipistrello-ols/api.c b/src/hardware/pipistrello-ols/api.c index 1d1388ba..33339d6b 100644 --- a/src/hardware/pipistrello-ols/api.c +++ b/src/hardware/pipistrello-ols/api.c @@ -276,7 +276,6 @@ static int config_set(uint32_t key, GVariant *data, break; case SR_CONF_PATTERN_MODE: stropt = g_variant_get_string(data, NULL); - flag = 0xffff; if (!strcmp(stropt, STR_PATTERN_NONE)) { sr_info("Disabling test modes."); flag = 0x0000; @@ -289,10 +288,9 @@ static int config_set(uint32_t key, GVariant *data, } else { return SR_ERR; } - if (flag != 0xffff) { - devc->flag_reg &= ~(FLAG_INTERNAL_TEST_MODE | FLAG_EXTERNAL_TEST_MODE); - devc->flag_reg |= flag; - } + devc->flag_reg &= ~FLAG_INTERNAL_TEST_MODE; + devc->flag_reg &= ~FLAG_EXTERNAL_TEST_MODE; + devc->flag_reg |= flag; break; case SR_CONF_SWAP: if (g_variant_get_boolean(data)) {