aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/mdio-gpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/phy/mdio-gpio.c')
-rw-r--r--drivers/net/phy/mdio-gpio.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c
index a439ebeb4319..3f460c564927 100644
--- a/drivers/net/phy/mdio-gpio.c
+++ b/drivers/net/phy/mdio-gpio.c
@@ -200,16 +200,21 @@ static int __devinit mdio_ofgpio_probe(struct of_device *ofdev,
200{ 200{
201 struct device_node *np = NULL; 201 struct device_node *np = NULL;
202 struct mdio_gpio_platform_data *pdata; 202 struct mdio_gpio_platform_data *pdata;
203 int ret;
203 204
204 pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); 205 pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
205 if (!pdata) 206 if (!pdata)
206 return -ENOMEM; 207 return -ENOMEM;
207 208
208 pdata->mdc = of_get_gpio(ofdev->node, 0); 209 ret = of_get_gpio(ofdev->node, 0);
209 pdata->mdio = of_get_gpio(ofdev->node, 1); 210 if (ret < 0)
210
211 if (pdata->mdc < 0 || pdata->mdio < 0)
212 goto out_free; 211 goto out_free;
212 pdata->mdc = ret;
213
214 ret = of_get_gpio(ofdev->node, 1);
215 if (ret < 0)
216 goto out_free;
217 pdata->mdio = ret;
213 218
214 while ((np = of_get_next_child(ofdev->node, np))) 219 while ((np = of_get_next_child(ofdev->node, np)))
215 if (!strcmp(np->type, "ethernet-phy")) 220 if (!strcmp(np->type, "ethernet-phy"))