Re: [PATCH 1/1] net: ethernet: 3com: set error code on failures

From: Lino Sanfilippo
Date: Sat Dec 03 2016 - 08:53:25 EST


Hi,

On 03.12.2016 14:24, Pan Bian wrote:
> From: Pan Bian <bianpan2016@xxxxxxx>
>
> 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@xxxxxxx>

>
> @@ -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