From: Lothar Waßmann Date: Thu, 21 Mar 2013 02:20:11 +0000 (+0000) Subject: net: ethernet: cpsw: fix erroneous condition in error check X-Git-Tag: v3.8.6~6 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=4a2438e61cf83c3173766d77216b3dba25d65583;p=karo-tx-linux.git net: ethernet: cpsw: fix erroneous condition in error check [ Upstream commit ce16294fda230c787ce5c35f61b2f80d14d70a72 ] The error check in cpsw_probe_dt() has an '&&' where an '||' is meant to be. This causes a NULL pointer dereference when incomplet DT data is passed to the driver ('phy_id' property for cpsw_emac1 missing). Signed-off-by: Lothar Waßmann Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index b85ca6b2c19b..3b1be52ccf8d 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -1111,7 +1111,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, struct platform_device *mdio; parp = of_get_property(slave_node, "phy_id", &lenp); - if ((parp == NULL) && (lenp != (sizeof(void *) * 2))) { + if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) { pr_err("Missing slave[%d] phy_id property\n", i); ret = -EINVAL; goto error_ret;