linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] net: ethernet: 3com: set error code on failures
@ 2016-12-03 13:24 Pan Bian
  2016-12-03 13:53 ` Lino Sanfilippo
  0 siblings, 1 reply; 3+ messages in thread
From: Pan Bian @ 2016-12-03 13:24 UTC (permalink / raw)
  To: David Dillow, netdev; +Cc: linux-kernel, Pan Bian

From: Pan Bian <bianpan2016@163.com>

In function typhoon_init_one(), returns the value of variable err on
errors. However, on some error paths, variable err is not set to a
negative errno. This patch assigns "-EIO" to err on those paths.

Signed-off-by: Pan Bian <bianpan2016@163.com>
---
 drivers/net/ethernet/3com/typhoon.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/3com/typhoon.c b/drivers/net/ethernet/3com/typhoon.c
index 8f8418d..9a477fc 100644
--- a/drivers/net/ethernet/3com/typhoon.c
+++ b/drivers/net/ethernet/3com/typhoon.c
@@ -2400,6 +2400,7 @@ enum state_values {
 
 	if(!is_valid_ether_addr(dev->dev_addr)) {
 		err_msg = "Could not obtain valid ethernet address, aborting";
+		err = -EIO;
 		goto error_out_reset;
 	}
 
@@ -2409,6 +2410,7 @@ enum state_values {
 	INIT_COMMAND_WITH_RESPONSE(&xp_cmd, TYPHOON_CMD_READ_VERSIONS);
 	if(typhoon_issue_command(tp, 1, &xp_cmd, 3, xp_resp) < 0) {
 		err_msg = "Could not get Sleep Image version";
+		err = -EIO;
 		goto error_out_reset;
 	}
 
@@ -2451,6 +2453,7 @@ enum state_values {
 
 	if(register_netdev(dev) < 0) {
 		err_msg = "unable to register netdev";
+		err = -EIO;
 		goto error_out_reset;
 	}
 
-- 
1.9.1

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

* Re: [PATCH 1/1] net: ethernet: 3com: set error code on failures
  2016-12-03 13:24 [PATCH 1/1] net: ethernet: 3com: set error code on failures Pan Bian
@ 2016-12-03 13:53 ` Lino Sanfilippo
  2016-12-03 15:23   ` Pan Bian
  0 siblings, 1 reply; 3+ messages in thread
From: Lino Sanfilippo @ 2016-12-03 13:53 UTC (permalink / raw)
  To: Pan Bian, David Dillow, netdev; +Cc: linux-kernel, Pan Bian

Hi,

On 03.12.2016 14:24, Pan Bian wrote:
> From: Pan Bian <bianpan2016@163.com>
> 
> In function typhoon_init_one(), returns the value of variable err on
> errors. However, on some error paths, variable err is not set to a
> negative errno. This patch assigns "-EIO" to err on those paths.
> 
> Signed-off-by: Pan Bian <bianpan2016@163.com>

>  
> @@ -2409,6 +2410,7 @@ enum state_values {
>  	INIT_COMMAND_WITH_RESPONSE(&xp_cmd, TYPHOON_CMD_READ_VERSIONS);
>  	if(typhoon_issue_command(tp, 1, &xp_cmd, 3, xp_resp) < 0) {
>  		err_msg = "Could not get Sleep Image version";
> +		err = -EIO;
>  		goto error_out_reset;
>  	}
>  
> @@ -2451,6 +2453,7 @@ enum state_values {
>  
>  	if(register_netdev(dev) < 0) {
>  		err_msg = "unable to register netdev";
> +		err = -EIO;
>  		goto error_out_reset;
>  	}
>  
> 

Why not return the error value provided by the called functions? Is there a reason
to map different errors to -EIO?

Regards,
Lino

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

* Re: [PATCH 1/1] net: ethernet: 3com: set error code on failures
  2016-12-03 13:53 ` Lino Sanfilippo
@ 2016-12-03 15:23   ` Pan Bian
  0 siblings, 0 replies; 3+ messages in thread
From: Pan Bian @ 2016-12-03 15:23 UTC (permalink / raw)
  To: Lino Sanfilippo, David Dillow, netdev; +Cc: PanBian, linux-kernel

From: PanBian <bianpan2016@163.com>

Hi, Lino,

There is no special reason to map different errors to -EIO. In the
original source code, err is set to -EIO on most error paths. I copied 
that. I guess it has no difference with the error value provided by the 
called functions in the view of callers of typhoon_init_one().

Thanks!

Best regards,
Pan

On Sat, Dec 03, 2016 at 02:53:07PM +0100, Lino Sanfilippo wrote:
> Hi,
> 
> On 03.12.2016 14:24, Pan Bian wrote:
> > From: Pan Bian <bianpan2016@163.com>
> > 
> > In function typhoon_init_one(), returns the value of variable err on
> > errors. However, on some error paths, variable err is not set to a
> > negative errno. This patch assigns "-EIO" to err on those paths.
> > 
> > Signed-off-by: Pan Bian <bianpan2016@163.com>
> 
> >  
> > @@ -2409,6 +2410,7 @@ enum state_values {
> >  	INIT_COMMAND_WITH_RESPONSE(&xp_cmd, TYPHOON_CMD_READ_VERSIONS);
> >  	if(typhoon_issue_command(tp, 1, &xp_cmd, 3, xp_resp) < 0) {
> >  		err_msg = "Could not get Sleep Image version";
> > +		err = -EIO;
> >  		goto error_out_reset;
> >  	}
> >  
> > @@ -2451,6 +2453,7 @@ enum state_values {
> >  
> >  	if(register_netdev(dev) < 0) {
> >  		err_msg = "unable to register netdev";
> > +		err = -EIO;
> >  		goto error_out_reset;
> >  	}
> >  
> > 
> 
> Why not return the error value provided by the called functions? Is there a reason
> to map different errors to -EIO?
> 
> Regards,
> Lino

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

end of thread, other threads:[~2016-12-03 15:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-03 13:24 [PATCH 1/1] net: ethernet: 3com: set error code on failures Pan Bian
2016-12-03 13:53 ` Lino Sanfilippo
2016-12-03 15:23   ` Pan Bian

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).