This patch causes a kernel WARN stacktrace and falls back to a default 100mbit, instead of a BUG and panicing the kernel, when an invalid speed is pased to ath79_mii_ctrl_set_speed() via incorrect platform data settings. This makes debugging slightly easier when working with a board (such as the dir632a1) for which u-boot has broken TFTP and you dont have nearby a suitable browser/operating system combination for restoring the firmware via the factory recovery mechanism.
Signed-off-by: Andrew McDonnell <b...@andrewmcdonnell.net> --- .../linux/ar71xx/files/arch/mips/ath79/dev-eth.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c index d7f3595..47e1350 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c @@ -134,7 +134,9 @@ static void ath79_mii_ctrl_set_speed(unsigned int reg, unsigned int speed) mii_speed = AR71XX_MII_CTRL_SPEED_1000; break; default: - BUG(); + WARN(1, "ath79_mii_ctrl_set_speed(): invalid speed (%d), fallback to %d\n", speed, SPEED_100); + mii_speed = AR71XX_MII_CTRL_SPEED_100; + break; } base = ioremap(AR71XX_MII_BASE, AR71XX_MII_SIZE); _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel