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-Url: https://git.stricted.de/?a=commitdiff_plain;h=ce16294fda230c787ce5c35f61b2f80d14d70a72;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git net: ethernet: cpsw: fix erroneous condition in error check 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 --- diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 75c48558e6fd..df32a090d08e 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -1364,7 +1364,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;