Fix cppcheck warning in xg3.c

pull/174/head
Michael Black 2020-01-12 11:39:57 -06:00
rodzic e108de4515
commit 26b6113203
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6599353EC683404D
1 zmienionych plików z 8 dodań i 7 usunięć

Wyświetl plik

@ -511,20 +511,21 @@ int xg3_get_powerstat(RIG *rig, powerstat_t *status)
struct rig_state *rs = &rig->state;
struct xg3_priv_data *priv = (struct xg3_priv_data *)rig->state.priv;
retval = read_string(&rs->rigport, reply, sizeof(reply), ";", 1);
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (retval != RIG_OK)
if (retval == RIG_OK)
{
retval = read_string(&rs->rigport, reply, sizeof(reply), ";", 1);
*status = RIG_POWER_ON;
priv->powerstat = RIG_POWER_ON;
}
else if (retval != RIG_OK)
{
*status = RIG_POWER_OFF; // Error indicates power is off
rig_debug(RIG_DEBUG_VERBOSE, "%s read_string failed\n", __func__);
priv->powerstat = RIG_POWER_OFF;
}
else
{
*status = RIG_POWER_ON;
priv->powerstat = RIG_POWER_ON;
}
return RIG_OK; // Always OK since it's a binary state
}