Skip to content

Commit

Permalink
phylib: unsigneds go unnoticed
Browse files Browse the repository at this point in the history
both pdata->mdc and pdata->mdio are unsigned. Notice a negative
return value.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Roel Kluin authored and David S. Miller committed Jan 21, 2009
1 parent 9f4d26d commit 57a5749
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions drivers/net/phy/mdio-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,16 +200,21 @@ static int __devinit mdio_ofgpio_probe(struct of_device *ofdev,
{
struct device_node *np = NULL;
struct mdio_gpio_platform_data *pdata;
int ret;

pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
if (!pdata)
return -ENOMEM;

pdata->mdc = of_get_gpio(ofdev->node, 0);
pdata->mdio = of_get_gpio(ofdev->node, 1);

if (pdata->mdc < 0 || pdata->mdio < 0)
ret = of_get_gpio(ofdev->node, 0);
if (ret < 0)
goto out_free;
pdata->mdc = ret;

ret = of_get_gpio(ofdev->node, 1);
if (ret < 0)
goto out_free;
pdata->mdio = ret;

while ((np = of_get_next_child(ofdev->node, np)))
if (!strcmp(np->type, "ethernet-phy"))
Expand Down

0 comments on commit 57a5749

Please sign in to comment.