Skip to content

Commit d7d94b2

Browse files
cappe987davem330
authored andcommitted
net: microchip: sparx5: fix PTP init/deinit not checking all ports
Check all ports instead of just port_count ports. PTP init was only checking ports 0 to port_count. If the hardware ports are not mapped starting from 0 then they would be missed, e.g. if only ports 20-30 were mapped it would attempt to init ports 0-10, resulting in NULL pointers when attempting to timestamp. Now it will init all mapped ports. Fixes: 70dfe25 ("net: sparx5: Update extraction/injection for timestamping") Signed-off-by: Casper Andersson <[email protected]> Reviewed-by: Horatiu Vultur <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 03702d4 commit d7d94b2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ int sparx5_ptp_init(struct sparx5 *sparx5)
633633
/* Enable master counters */
634634
spx5_wr(PTP_PTP_DOM_CFG_PTP_ENA_SET(0x7), sparx5, PTP_PTP_DOM_CFG);
635635

636-
for (i = 0; i < sparx5->port_count; i++) {
636+
for (i = 0; i < SPX5_PORTS; i++) {
637637
port = sparx5->ports[i];
638638
if (!port)
639639
continue;
@@ -649,7 +649,7 @@ void sparx5_ptp_deinit(struct sparx5 *sparx5)
649649
struct sparx5_port *port;
650650
int i;
651651

652-
for (i = 0; i < sparx5->port_count; i++) {
652+
for (i = 0; i < SPX5_PORTS; i++) {
653653
port = sparx5->ports[i];
654654
if (!port)
655655
continue;

0 commit comments

Comments
 (0)