phy_reg = get_phy_c45_devs_in_pkg(bus, addr, i, devs);
                if (phy_reg < 0)
                        return -EIO;
+       }
+
+       if ((*devs & 0x1fffffff) == 0x1fffffff) {
+               /* If mostly Fs, there is no device there, then let's probe
+                * MMD 0, as some 10G PHYs have zero Devices In package,
+                * e.g. Cortina CS4315/CS4340 PHY.
+                */
+               phy_reg = get_phy_c45_devs_in_pkg(bus, addr, 0, devs);
+               if (phy_reg < 0)
+                       return -EIO;
 
+               /* no device there, let's get out of here */
                if ((*devs & 0x1fffffff) == 0x1fffffff) {
-                       /*  If mostly Fs, there is no device there,
-                        *  then let's continue to probe more, as some
-                        *  10G PHYs have zero Devices In package,
-                        *  e.g. Cortina CS4315/CS4340 PHY.
-                        */
-                       phy_reg = get_phy_c45_devs_in_pkg(bus, addr, 0, devs);
-                       if (phy_reg < 0)
-                               return -EIO;
-                       /* no device there, let's get out of here */
-                       if ((*devs & 0x1fffffff) == 0x1fffffff) {
-                               *phy_id = 0xffffffff;
-                               return 0;
-                       } else {
-                               break;
-                       }
+                       *phy_id = 0xffffffff;
+                       return 0;
                }
        }