Skip to contentSkip to conversation

phylib: unsigneds go unnoticed

PATCH Applied Roel Kluin 2 participants 4 messages Jan 18, 2009 – Jan 20, 2009

Subsystems (3)
lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 phylib: unsigneds go unnoticed

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

drivers/net/phy/mdio-gpio.c +10 -2
index a439ebe..9b1dcd6 100644
@@ -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;
maintainer
#1 lore raw

From: Roel Kluin <[email protected]>
Date: Sun, 18 Jan 2009 23:57:43 +0100

Quoted 2 lines

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

You left the unsigned tests in there:

drivers/net/phy/mdio-gpio.c static int __devinit mdio_ofgpio_probe(struct of_device *ofdev, · line 220

Quoted 2 lines
drivers/net/phy/mdio-gpio.c +0 -0
 	if (pdata->mdc < 0 || pdata->mdio < 0)
 		goto out_free;

Please remove them.

author
#2 lore raw
Quoted 6 lines · David Miller

From: Roel Kluin <[email protected]>
Date: Sun, 18 Jan 2009 23:57:43 +0100

Quoted 2 lines

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

Quoted 6 lines

You left the unsigned tests in there:

Review

Quoted 2 lines
(quoted diff) +0 -0
 	if (pdata->mdc < 0 || pdata->mdio < 0)
 		goto out_free;

Please remove them.

thanks, here it is, also with a signoff:

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

---

drivers/net/phy/mdio-gpio.c +9 -4
index a439ebe..3f460c5 100644
@@ -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"))
maintainer Applied
#3 lore raw

From: Roel Kluin <[email protected]>
Date: Mon, 19 Jan 2009 10:41:58 +0100

Quoted 12 lines
Quoted 11 lines · David Miller

From: Roel Kluin <[email protected]>
Date: Sun, 18 Jan 2009 23:57:43 +0100

Quoted 2 lines

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

You left the unsigned tests in there:

Quoted 2 lines
(quoted diff) +0 -0
 	if (pdata->mdc < 0 || pdata->mdio < 0)
 		goto out_free;
Quoted 8 lines
Quoted 1 line

Please remove them.

thanks, here it is, also with a signoff:

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

Applied, thanks Roel.