ath79: fix unaligned access panic in ag71xx_mdio_probe
authorMatt Merhar <mattmerhar@protonmail.com>
Thu, 30 Aug 2018 12:58:26 +0000 (08:58 -0400)
committerMathias Kresin <dev@kresin.me>
Thu, 6 Sep 2018 19:35:53 +0000 (21:35 +0200)
Without "syscon" being present in an ag71xx ethernet DT node's
compatible property, a panic occurs at boot during probe citing
"Unhandled kernel unaligned access".

With this modification, the panic no longer occurs and instead the probe
simply fails, allowing the boot process to continue.

Signed-off-by: Matt Merhar <mattmerhar@protonmail.com>
target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_mdio.c

index 0bfc1546cd9be3b778d6417d5b4302955ee812b8..58aef748724ae85e4d3b91e291b32869becd35fa 100644 (file)
@@ -183,8 +183,8 @@ static int ag71xx_mdio_probe(struct platform_device *pdev)
                return -ENOMEM;
 
        am->mii_regmap = syscon_regmap_lookup_by_phandle(np, "regmap");
-       if (!am->mii_regmap)
-               return -ENOENT;
+       if (IS_ERR(am->mii_regmap))
+               return PTR_ERR(am->mii_regmap);
 
        mii_bus = devm_mdiobus_alloc(amdev);
        if (!mii_bus)