netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] phylib: unsigneds go unnoticed
@ 2009-01-18 22:57 Roel Kluin
  2009-01-19  5:25 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Roel Kluin @ 2009-01-18 22:57 UTC (permalink / raw)
  To: paulius.zaleckas, David S. Miller; +Cc: netdev

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

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;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] phylib: unsigneds go unnoticed
  2009-01-18 22:57 [PATCH] phylib: unsigneds go unnoticed Roel Kluin
@ 2009-01-19  5:25 ` David Miller
  2009-01-19  9:41   ` Roel Kluin
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2009-01-19  5:25 UTC (permalink / raw)
  To: roel.kluin; +Cc: paulius.zaleckas, netdev

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] phylib: unsigneds go unnoticed
  2009-01-19  5:25 ` David Miller
@ 2009-01-19  9:41   ` Roel Kluin
  2009-01-20  1:14     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Roel Kluin @ 2009-01-19  9:41 UTC (permalink / raw)
  To: David Miller; +Cc: paulius.zaleckas, netdev

David Miller wrote:
> 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.

thanks, here it is, also with a signoff:

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

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c
index a439ebe..3f460c5 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,
 {
 	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"))

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] phylib: unsigneds go unnoticed
  2009-01-19  9:41   ` Roel Kluin
@ 2009-01-20  1:14     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2009-01-20  1:14 UTC (permalink / raw)
  To: roel.kluin; +Cc: paulius.zaleckas, netdev

From: Roel Kluin <roel.kluin@gmail.com>
Date: Mon, 19 Jan 2009 10:41:58 +0100

> David Miller wrote:
> > 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.
> 
> thanks, here it is, also with a signoff:
> 
> both pdata->mdc and pdata->mdio are unsigned. Notice a negative
> return value.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>

Applied, thanks Roel.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-01-20  1:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-18 22:57 [PATCH] phylib: unsigneds go unnoticed Roel Kluin
2009-01-19  5:25 ` David Miller
2009-01-19  9:41   ` Roel Kluin
2009-01-20  1:14     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).