return dir;
 
                if (dir == ACPI_CORESIGHT_LINK_MASTER) {
-                       if (ptr->outport > pdata->nr_outport)
-                               pdata->nr_outport = ptr->outport;
+                       if (ptr->outport >= pdata->nr_outport)
+                               pdata->nr_outport = ptr->outport + 1;
                        ptr++;
                } else {
-                       WARN_ON(pdata->nr_inport == ptr->child_port);
+                       WARN_ON(pdata->nr_inport == ptr->child_port + 1);
                        /*
                         * We do not track input port connections for a device.
                         * However we need the highest port number described,
                         * record for an output connection. Hence, do not move
                         * the ptr for input connections
                         */
-                       if (ptr->child_port > pdata->nr_inport)
-                               pdata->nr_inport = ptr->child_port;
+                       if (ptr->child_port >= pdata->nr_inport)
+                               pdata->nr_inport = ptr->child_port + 1;
                }
        }