Skip to content

Commit

Permalink
net: ethernet: cpsw: fix erroneous condition in error check
Browse files Browse the repository at this point in the history
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 <LW@KARO-electronics.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Lothar Waßmann authored and David S. Miller committed Mar 21, 2013
1 parent cb0e51d commit ce16294
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/ti/cpsw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ce16294

Please sign in to comment.