Skip to content

Commit 6be0630

Browse files
Wei Fangkuba-moo
authored andcommitted
net: fec: don't save PTP state if PTP is unsupported
Some platforms (such as i.MX25 and i.MX27) do not support PTP, so on these platforms fec_ptp_init() is not called and the related members in fep are not initialized. However, fec_ptp_save_state() is called unconditionally, which causes the kernel to panic. Therefore, add a condition so that fec_ptp_save_state() is not called if PTP is not supported. Fixes: a1477dc ("net: fec: Restart PPS after link state change") Reported-by: Guenter Roeck <[email protected]> Closes: https://lore.kernel.org/lkml/[email protected]/ Signed-off-by: Wei Fang <[email protected]> Reviewed-by: Csókás, Bence <[email protected]> Reviewed-by: Simon Horman <[email protected]> Tested-by: Guenter Roeck <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 080ddc2 commit 6be0630

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/net/ethernet/freescale/fec_main.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,8 @@ fec_restart(struct net_device *ndev)
10771077
u32 rcntl = OPT_FRAME_SIZE | 0x04;
10781078
u32 ecntl = FEC_ECR_ETHEREN;
10791079

1080-
fec_ptp_save_state(fep);
1080+
if (fep->bufdesc_ex)
1081+
fec_ptp_save_state(fep);
10811082

10821083
/* Whack a reset. We should wait for this.
10831084
* For i.MX6SX SOC, enet use AXI bus, we use disable MAC
@@ -1340,7 +1341,8 @@ fec_stop(struct net_device *ndev)
13401341
netdev_err(ndev, "Graceful transmit stop did not complete!\n");
13411342
}
13421343

1343-
fec_ptp_save_state(fep);
1344+
if (fep->bufdesc_ex)
1345+
fec_ptp_save_state(fep);
13441346

13451347
/* Whack a reset. We should wait for this.
13461348
* For i.MX6SX SOC, enet use AXI bus, we use disable MAC

0 commit comments

Comments
 (0)