realtek: pcs: Reduce nesting during calibration
authorSven Eckelmann <[email protected]>
Sun, 23 Nov 2025 14:17:52 +0000 (15:17 +0100)
committerHauke Mehrtens <[email protected]>
Mon, 24 Nov 2025 23:28:50 +0000 (00:28 +0100)
It is preferred in the kernel to have less nesting of scopes. More common
is to perform pre-condition checks (like error handlers) and then react to
them.

Signed-off-by: Sven Eckelmann <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <[email protected]>
target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c

index 200475d56b8d058b584e3e2f1f2f0f3e63f61de2..cced6d5168d36b4b67d97d8f2c5fd8c1aba9e0b2 100644 (file)
@@ -1259,18 +1259,17 @@ static void rtpcs_930x_sds_do_rx_calibration_2_3(struct rtpcs_ctrl *ctrl,
 
                offset_range = rtpcs_sds_read_bits(ctrl, sds_num, 0x2e, 0x15, 15, 14);
 
-               if (fgcal_binary > 60 || fgcal_binary < 3) {
-                       if (offset_range == 3) {
-                               pr_info("%s: Foreground Calibration result marginal!", __func__);
-                               break;
-                       } else {
-                               offset_range++;
-                               rtpcs_sds_write_bits(ctrl, sds_num, 0x2e, 0x15, 15, 14, offset_range);
-                               rtpcs_930x_sds_do_rx_calibration_2_2(ctrl, sds_num);
-                       }
-               } else {
+               if (fgcal_binary <= 60 && fgcal_binary >= 3)
+                       break;
+
+               if (offset_range == 3) {
+                       pr_info("%s: Foreground Calibration result marginal!", __func__);
                        break;
                }
+
+               offset_range++;
+               rtpcs_sds_write_bits(ctrl, sds_num, 0x2e, 0x15, 15, 14, offset_range);
+               rtpcs_930x_sds_do_rx_calibration_2_2(ctrl, sds_num);
        }
        pr_info("%s: end_1.2.3\n", __func__);
 }