net: fec: add return value check after calling .of_property_read_u32()
authorFugang Duan <fugang.duan@nxp.com>
Tue, 11 Apr 2017 11:13:03 +0000 (19:13 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 11 Apr 2017 18:36:27 +0000 (14:36 -0400)
Add return value check after calling .of_property_read_u32() to avoid
the warning reported by coverity.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/fec_main.c

index 91a16641e8514b7f1f99be03fe280d71e54de37d..886a9c9fd6283e85734cc5ce41586aa2f4871ecf 100644 (file)
@@ -3197,9 +3197,9 @@ static void fec_reset_phy(struct platform_device *pdev)
        if (!np)
                return;
 
-       of_property_read_u32(np, "phy-reset-duration", &msec);
+       err = of_property_read_u32(np, "phy-reset-duration", &msec);
        /* A sane reset duration should not be longer than 1s */
-       if (msec > 1000)
+       if (!err && msec > 1000)
                msec = 1;
 
        phy_reset = of_get_named_gpio(np, "phy-reset-gpios", 0);