]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/hameg-hmo/protocol.c
drivers: Reduce unnecessarily high indentation in some places.
[libsigrok.git] / src / hardware / hameg-hmo / protocol.c
index 0c4d57f3f6cf465ba34ff17b590a2924192e944c..1306338200699532af3a7e5eda3686b75322f730 100644 (file)
@@ -495,8 +495,21 @@ SR_PRIV int hmo_update_sample_rate(const struct sr_dev_inst *sdi)
        channel_found = FALSE;
 
        for (i = 0; i < config->analog_channels; i++) {
-               if (state->analog_channels[i].state) {
-                       g_snprintf(chan_name, sizeof(chan_name), "CHAN%d", i + 1);
+               if (!state->analog_channels[i].state)
+                       continue;
+               g_snprintf(chan_name, sizeof(chan_name), "CHAN%d", i + 1);
+               g_snprintf(tmp_str, sizeof(tmp_str),
+                          (*config->scpi_dialect)[SCPI_CMD_GET_SAMPLE_RATE_LIVE],
+                          chan_name);
+               channel_found = TRUE;
+               break;
+       }
+
+       if (!channel_found) {
+               for (i = 0; i < config->digital_pods; i++) {
+                       if (!state->digital_pods[i])
+                               continue;
+                       g_snprintf(chan_name, sizeof(chan_name), "POD%d", i);
                        g_snprintf(tmp_str, sizeof(tmp_str),
                                   (*config->scpi_dialect)[SCPI_CMD_GET_SAMPLE_RATE_LIVE],
                                   chan_name);
@@ -505,19 +518,6 @@ SR_PRIV int hmo_update_sample_rate(const struct sr_dev_inst *sdi)
                }
        }
 
-       if (!channel_found) {
-               for (i = 0; i < config->digital_pods; i++) {
-                       if (state->digital_pods[i]) {
-                               g_snprintf(chan_name, sizeof(chan_name), "POD%d", i);
-                               g_snprintf(tmp_str, sizeof(tmp_str),
-                                          (*config->scpi_dialect)[SCPI_CMD_GET_SAMPLE_RATE_LIVE],
-                                          chan_name);
-                               channel_found = TRUE;
-                               break;
-                       }
-               }
-       }
-
        /* No channel is active, ask the instrument for the sample rate
         * in single shot mode */
        if (!channel_found) {