phylib: unsigneds go unnoticed
diff mbox

Message ID 4973B3E7.6080203@gmail.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

roel kluin Jan. 18, 2009, 10:57 p.m. UTC
both pdata->mdc and pdata->mdio are unsigned. Notice a negative
return value.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller Jan. 19, 2009, 5:25 a.m. UTC | #1
From: Roel Kluin <roel.kluin@gmail.com>
Date: Sun, 18 Jan 2009 23:57:43 +0100

> both pdata->mdc and pdata->mdio are unsigned. Notice a negative
> return value.

You left the unsigned tests in there:

>  	if (pdata->mdc < 0 || pdata->mdio < 0)
>  		goto out_free;

Please remove them.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c
index a439ebe..9b1dcd6 100644
--- a/drivers/net/phy/mdio-gpio.c
+++ b/drivers/net/phy/mdio-gpio.c
@@ -200,13 +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);
+	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;
 
 	if (pdata->mdc < 0 || pdata->mdio < 0)
 		goto out_free;