diff --git a/sys/dvb/gstdvbsrc.c b/sys/dvb/gstdvbsrc.c
index 3d34ec4..0621da2 100644
--- a/sys/dvb/gstdvbsrc.c
+++ b/sys/dvb/gstdvbsrc.c
@@ -1326,7 +1326,6 @@ gst_dvbsrc_tune (GstDvbSrc * object)
   fe_sec_voltage_t voltage;
   fe_status_t status;
   int i;
-  int j;
   unsigned int freq = object->freq;
   unsigned int sym_rate = object->sym_rate * 1000;
   int inversion = object->inversion;
@@ -1347,199 +1346,195 @@ gst_dvbsrc_tune (GstDvbSrc * object)
   }
 
   gst_dvbsrc_unset_pes_filters (object);
-  for (j = 0; j < 5; j++) {
 #if DVB_API_VERSION >= 5
-    GST_DEBUG_OBJECT (object, "using s2api");
-    memset (fe_props_array, 0, sizeof (fe_props_array));
-    fe_props_array[0].cmd = DTV_CLEAR;
-    fe_props.num = 1;
-    fe_props.props = fe_props_array;
-    if (ioctl (object->fd_frontend, FE_SET_PROPERTY, &fe_props) < 0) {
-      g_warning ("Error resetting tuner: %s", strerror (errno));
-    }
+  GST_DEBUG_OBJECT (object, "using s2api");
+  memset (fe_props_array, 0, sizeof (fe_props_array));
+  fe_props_array[0].cmd = DTV_CLEAR;
+  fe_props.num = 1;
+  fe_props.props = fe_props_array;
+  if (ioctl (object->fd_frontend, FE_SET_PROPERTY, &fe_props) < 0) {
+    g_warning ("Error resetting tuner: %s", strerror (errno));
+  }
 #endif
-    n = 3;
-    switch (object->adapter_type) {
-      case FE_QPSK:
-        object->tone = SEC_TONE_OFF;
-        if (freq > 2200000) {
-          // this must be an absolute frequency
-          if (freq < SLOF) {
-            freq -= LOF1;
-          } else {
-            freq -= LOF2;
-            object->tone = SEC_TONE_ON;
-          }
+  n = 3;
+  switch (object->adapter_type) {
+    case FE_QPSK:
+      object->tone = SEC_TONE_OFF;
+      if (freq > 2200000) {
+        // this must be an absolute frequency
+        if (freq < SLOF) {
+          freq -= LOF1;
+        } else {
+          freq -= LOF2;
+          object->tone = SEC_TONE_ON;
         }
-        GST_DEBUG_OBJECT (object, "api version %d.%d", DVB_API_VERSION,
-            DVB_API_VERSION_MINOR);
-        inversion = INVERSION_AUTO;
+      }
+      GST_DEBUG_OBJECT (object, "api version %d.%d", DVB_API_VERSION,
+          DVB_API_VERSION_MINOR);
+      inversion = INVERSION_AUTO;
 #if DVB_API_VERSION >= 5
-        set_prop (fe_props_array, &n, DTV_SYMBOL_RATE, sym_rate);
-        set_prop (fe_props_array, &n, DTV_INNER_FEC, object->code_rate_hp);
-        del_sys = SYS_DVBS;
-        if (object->gen2 && object->dvbs2) {
-          del_sys = SYS_DVBS2;
-          set_prop (fe_props_array, &n, DTV_ROLLOFF, object->roll_off);
-          set_prop (fe_props_array, &n, DTV_PILOT, PILOT_AUTO);
-        } else if (object->gen2) {
-          set_prop (fe_props_array, &n, DTV_ROLLOFF, ROLLOFF_35);
-        }
+      set_prop (fe_props_array, &n, DTV_SYMBOL_RATE, sym_rate);
+      set_prop (fe_props_array, &n, DTV_INNER_FEC, object->code_rate_hp);
+      del_sys = SYS_DVBS;
+      if (object->gen2 && object->dvbs2) {
+        del_sys = SYS_DVBS2;
+        set_prop (fe_props_array, &n, DTV_ROLLOFF, object->roll_off);
+        set_prop (fe_props_array, &n, DTV_PILOT, PILOT_AUTO);
+      } else if (object->gen2) {
+        set_prop (fe_props_array, &n, DTV_ROLLOFF, ROLLOFF_35);
+      }
 #elif DVB_API_VERSION == 3 && DVB_API_VERSION_MINOR == 3
-        GST_DEBUG_OBJECT (object, "using multiproto driver");
-        feparams.delsys.dvbs.symbol_rate = sym_rate;
-        feparams.delsys.dvbs.fec = object->code_rate_hp;
+      GST_DEBUG_OBJECT (object, "using multiproto driver");
+      feparams.delsys.dvbs.symbol_rate = sym_rate;
+      feparams.delsys.dvbs.fec = object->code_rate_hp;
 #else
-        feparams.u.qpsk.symbol_rate = sym_rate;
-        feparams.u.qpsk.fec_inner = object->code_rate_hp;
+      feparams.u.qpsk.symbol_rate = sym_rate;
+      feparams.u.qpsk.fec_inner = object->code_rate_hp;
 #endif
-        GST_INFO_OBJECT (object,
-            "tuning DVB-S to L-Band:%u, Pol:%d, srate=%u, 22kHz=%s",
-            freq, object->pol, sym_rate,
-            object->tone == SEC_TONE_ON ? "on" : "off");
+      GST_INFO_OBJECT (object,
+          "tuning DVB-S to L-Band:%u, Pol:%d, srate=%u, 22kHz=%s",
+          freq, object->pol, sym_rate,
+          object->tone == SEC_TONE_ON ? "on" : "off");
 
-        if (object->pol == DVB_POL_H)
-          voltage = SEC_VOLTAGE_18;
-        else
-          voltage = SEC_VOLTAGE_13;
+      if (object->pol == DVB_POL_H)
+        voltage = SEC_VOLTAGE_18;
+      else
+        voltage = SEC_VOLTAGE_13;
 
-        if (object->diseqc_src == -1 || object->send_diseqc == FALSE) {
+      if (object->diseqc_src == -1 || object->send_diseqc == FALSE) {
 #if DVB_API_VERSION >= 5
-          set_prop (fe_props_array, &n, DTV_VOLTAGE, voltage);
-          // DTV_TONE not yet implemented
-          // set_prop (fe_props_array, &n, DTV_TONE, object->tone);
+        set_prop (fe_props_array, &n, DTV_VOLTAGE, voltage);
+        // DTV_TONE not yet implemented
+        // set_prop (fe_props_array, &n, DTV_TONE, object->tone);
 #else
-          if (ioctl (object->fd_frontend, FE_SET_VOLTAGE, voltage) < 0) {
-            g_warning ("Unable to set voltage on dvb frontend device");
-          }
+        if (ioctl (object->fd_frontend, FE_SET_VOLTAGE, voltage) < 0) {
+          g_warning ("Unable to set voltage on dvb frontend device");
+        }
 
 #endif
-          if (ioctl (object->fd_frontend, FE_SET_TONE, object->tone) < 0) {
-            g_warning ("Error setting tone: %s", strerror (errno));
-          }
-        } else {
-          GST_DEBUG_OBJECT (object, "Sending DISEqC");
-          diseqc (object->fd_frontend, object->diseqc_src, voltage,
-              object->tone);
-          /* Once diseqc source is set, do not set it again until
-           * app decides to change it */
-          //object->send_diseqc = FALSE;
+        if (ioctl (object->fd_frontend, FE_SET_TONE, object->tone) < 0) {
+          g_warning ("Error setting tone: %s", strerror (errno));
         }
+      } else {
+        GST_DEBUG_OBJECT (object, "Sending DISEqC");
+        diseqc (object->fd_frontend, object->diseqc_src, voltage,
+            object->tone);
+        /* Once diseqc source is set, do not set it again until
+         * app decides to change it */
+        //object->send_diseqc = FALSE;
+      }
 
-        break;
-      case FE_OFDM:
+      break;
+    case FE_OFDM:
 #if DVB_API_VERSION >= 5
-        del_sys = SYS_DVBT;
-        bandwidth = 0;
-        if (object->bandwidth != BANDWIDTH_AUTO) {
-          /* Presumably not specifying bandwidth with s2api is equivalent
-           * to BANDWIDTH_AUTO.
-           */
-          switch (object->bandwidth) {
-          case BANDWIDTH_8_MHZ:
-            bandwidth = 8000000;
-            break;
-          case BANDWIDTH_7_MHZ:
-            bandwidth = 7000000;
-            break;
-          case BANDWIDTH_6_MHZ:
-            bandwidth = 6000000;
-            break;
-          default:
-            break;
-          }
+      del_sys = SYS_DVBT;
+      bandwidth = 0;
+      if (object->bandwidth != BANDWIDTH_AUTO) {
+        /* Presumably not specifying bandwidth with s2api is equivalent
+         * to BANDWIDTH_AUTO.
+         */
+        switch (object->bandwidth) {
+        case BANDWIDTH_8_MHZ:
+          bandwidth = 8000000;
+          break;
+        case BANDWIDTH_7_MHZ:
+          bandwidth = 7000000;
+          break;
+        case BANDWIDTH_6_MHZ:
+          bandwidth = 6000000;
+          break;
+        default:
+          break;
         }
-        if (bandwidth) {
-          set_prop (fe_props_array, &n, DTV_BANDWIDTH_HZ, bandwidth);
-        }
-        set_prop (fe_props_array, &n, DTV_CODE_RATE_HP, object->code_rate_hp);
-        set_prop (fe_props_array, &n, DTV_CODE_RATE_LP, object->code_rate_lp);
-        set_prop (fe_props_array, &n, DTV_MODULATION, object->modulation);
-        set_prop (fe_props_array, &n, DTV_TRANSMISSION_MODE, object->transmission_mode);
-        set_prop (fe_props_array, &n, DTV_GUARD_INTERVAL, object->guard_interval);
-        set_prop (fe_props_array, &n, DTV_HIERARCHY, object->hierarchy_information);
+      }
+      if (bandwidth) {
+        set_prop (fe_props_array, &n, DTV_BANDWIDTH_HZ, bandwidth);
+      }
+      set_prop (fe_props_array, &n, DTV_CODE_RATE_HP, object->code_rate_hp);
+      set_prop (fe_props_array, &n, DTV_CODE_RATE_LP, object->code_rate_lp);
+      set_prop (fe_props_array, &n, DTV_MODULATION, object->modulation);
+      set_prop (fe_props_array, &n, DTV_TRANSMISSION_MODE, object->transmission_mode);
+      set_prop (fe_props_array, &n, DTV_GUARD_INTERVAL, object->guard_interval);
+      set_prop (fe_props_array, &n, DTV_HIERARCHY, object->hierarchy_information);
 #elif DVB_API_VERSION == 3 && DVB_API_VERSION_MINOR == 3
-        feparams.delsys.dvbs.fec = object->code_rate_hp;
-        feparams.delsys.dvbs.modulation = object->modulation;
-        feparams.delsys.dvbs.symbol_rate = sym_rate;
+      feparams.delsys.dvbs.fec = object->code_rate_hp;
+      feparams.delsys.dvbs.modulation = object->modulation;
+      feparams.delsys.dvbs.symbol_rate = sym_rate;
 #else
-        feparams.u.ofdm.bandwidth = object->bandwidth;
-        feparams.u.ofdm.code_rate_HP = object->code_rate_hp;
-        feparams.u.ofdm.code_rate_LP = object->code_rate_lp;
-        feparams.u.ofdm.constellation = object->modulation;
-        feparams.u.ofdm.transmission_mode = object->transmission_mode;
-        feparams.u.ofdm.guard_interval = object->guard_interval;
-        feparams.u.ofdm.hierarchy_information = object->hierarchy_information;
+      feparams.u.ofdm.bandwidth = object->bandwidth;
+      feparams.u.ofdm.code_rate_HP = object->code_rate_hp;
+      feparams.u.ofdm.code_rate_LP = object->code_rate_lp;
+      feparams.u.ofdm.constellation = object->modulation;
+      feparams.u.ofdm.transmission_mode = object->transmission_mode;
+      feparams.u.ofdm.guard_interval = object->guard_interval;
+      feparams.u.ofdm.hierarchy_information = object->hierarchy_information;
 #endif
 
-        GST_INFO_OBJECT (object, "tuning DVB-T to %d Hz\n", freq);
-        break;
-      case FE_QAM:
-        GST_INFO_OBJECT (object, "Tuning DVB-C to %d, srate=%d", freq,
-            sym_rate);
+      GST_INFO_OBJECT (object, "tuning DVB-T to %d Hz\n", freq);
+      break;
+    case FE_QAM:
+      GST_INFO_OBJECT (object, "Tuning DVB-C to %d, srate=%d", freq,
+          sym_rate);
 #if DVB_API_VERSION >= 5
-        del_sys = SYS_DVBC_ANNEX_AC;
-        set_prop (fe_props_array, &n, DTV_INNER_FEC, object->code_rate_hp);
-        set_prop (fe_props_array, &n, DTV_MODULATION, object->modulation);
-        set_prop (fe_props_array, &n, DTV_SYMBOL_RATE, sym_rate);
+      del_sys = SYS_DVBC_ANNEX_AC;
+      set_prop (fe_props_array, &n, DTV_INNER_FEC, object->code_rate_hp);
+      set_prop (fe_props_array, &n, DTV_MODULATION, object->modulation);
+      set_prop (fe_props_array, &n, DTV_SYMBOL_RATE, sym_rate);
 #elif DVB_API_VERSION == 3 && DVB_API_VERSION_MINOR == 3
-        feparams.delsys.dvbs.fec = object->code_rate_hp;
-        feparams.delsys.dvbs.modulation = object->modulation;
-        feparams.delsys.dvbs.symbol_rate = sym_rate;
+      feparams.delsys.dvbs.fec = object->code_rate_hp;
+      feparams.delsys.dvbs.modulation = object->modulation;
+      feparams.delsys.dvbs.symbol_rate = sym_rate;
 #else
-        feparams.u.qam.fec_inner = object->code_rate_hp;
-        feparams.u.qam.modulation = object->modulation;
-        feparams.u.qam.symbol_rate = sym_rate;
+      feparams.u.qam.fec_inner = object->code_rate_hp;
+      feparams.u.qam.modulation = object->modulation;
+      feparams.u.qam.symbol_rate = sym_rate;
 #endif
-        break;
-      case FE_ATSC:
-        GST_INFO_OBJECT (object, "Tuning ATSC to %d", freq);
+      break;
+    case FE_ATSC:
+      GST_INFO_OBJECT (object, "Tuning ATSC to %d", freq);
 #if DVB_API_VERSION >= 5
-        del_sys = SYS_ATSC;
-        set_prop (fe_props_array, &n, DTV_MODULATION, object->modulation);
+      del_sys = SYS_ATSC;
+      set_prop (fe_props_array, &n, DTV_MODULATION, object->modulation);
 #elif DVB_API_VERSION == 3 && DVB_API_VERSION_MINOR == 3
-        feparams.delsys.atsc.modulation = object->modulation;
+      feparams.delsys.atsc.modulation = object->modulation;
 #else
-        feparams.u.vsb.modulation = object->modulation;
+      feparams.u.vsb.modulation = object->modulation;
 #endif
-        break;
-      default:
-        g_error ("Unknown frontend type: %d", object->adapter_type);
+      break;
+    default:
+      g_error ("Unknown frontend type: %d", object->adapter_type);
 
-    }
-    usleep (100000);
-    /* now tune the frontend */
+  }
+  usleep (100000);
+  /* now tune the frontend */
 #if DVB_API_VERSION >= 5
-    set_prop (fe_props_array, &n, DTV_TUNE, 0);
-    fe_props.num = n;
-    fe_props.props = fe_props_array;
-    n = 0;
-    set_prop (fe_props_array, &n, DTV_DELIVERY_SYSTEM, del_sys);
-    set_prop (fe_props_array, &n, DTV_FREQUENCY, freq);
-    set_prop (fe_props_array, &n, DTV_INVERSION, inversion);
+  set_prop (fe_props_array, &n, DTV_TUNE, 0);
+  fe_props.num = n;
+  fe_props.props = fe_props_array;
+  n = 0;
+  set_prop (fe_props_array, &n, DTV_DELIVERY_SYSTEM, del_sys);
+  set_prop (fe_props_array, &n, DTV_FREQUENCY, freq);
+  set_prop (fe_props_array, &n, DTV_INVERSION, inversion);
 #else
-    feparams.frequency = freq;
-    feparams.inversion = inversion;
+  feparams.frequency = freq;
+  feparams.inversion = inversion;
 #endif
 #if DVB_API_VERSION >= 5
-    if (ioctl (object->fd_frontend, FE_SET_PROPERTY, &fe_props) < 0) {
+  if (ioctl (object->fd_frontend, FE_SET_PROPERTY, &fe_props) < 0) {
 #elif DVB_API_VERSION == 3 && DVB_API_VERSION_MINOR == 3
-    if (ioctl (object->fd_frontend, DVBFE_SET_PARAMS, &feparams) < 0) {
+  if (ioctl (object->fd_frontend, DVBFE_SET_PARAMS, &feparams) < 0) {
 #else
-    if (ioctl (object->fd_frontend, FE_SET_FRONTEND, &feparams) < 0) {
+  if (ioctl (object->fd_frontend, FE_SET_FRONTEND, &feparams) < 0) {
 #endif
-      g_warning ("Error tuning channel: %s", strerror (errno));
-    }
-    for (i = 0; i < 50; i++) {
-      usleep (100000);
-      if (ioctl (object->fd_frontend, FE_READ_STATUS, &status) == -1) {
-        perror ("FE_READ_STATUS");
-        break;
-      }
-      GST_LOG_OBJECT (object, "status == 0x%02x", status);
-      if (status & FE_HAS_LOCK)
-        break;
+    g_warning ("Error tuning channel: %s", strerror (errno));
+  }
+  for (i = 0; i < 50; i++) {
+    usleep (100000);
+    if (ioctl (object->fd_frontend, FE_READ_STATUS, &status) == -1) {
+      perror ("FE_READ_STATUS");
+      break;
     }
+    GST_LOG_OBJECT (object, "status == 0x%02x", status);
     if (status & FE_HAS_LOCK)
       break;
   }
