Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752879AbcLCNYs (ORCPT ); Sat, 3 Dec 2016 08:24:48 -0500 Received: from m50-132.163.com ([123.125.50.132]:57576 "EHLO m50-132.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751066AbcLCNYq (ORCPT ); Sat, 3 Dec 2016 08:24:46 -0500 From: Pan Bian To: David Dillow , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Pan Bian Subject: [PATCH 1/1] net: ethernet: 3com: set error code on failures Date: Sat, 3 Dec 2016 21:24:30 +0800 Message-Id: <1480771470-6404-1-git-send-email-bianpan201602@163.com> X-Mailer: git-send-email 1.9.1 X-CM-TRANSID: DNGowADXOuyNx0JYqXcrIQ--.7303S3 X-Coremail-Antispam: 1Uf129KBjvJXoWrtw47ZF47WFWDCw15Ww15Jwb_yoW8Jr47pr W29348ur1Sgr4UJrWUJ348u3Z8ua1YqFsYgFZ3C3ya93WYyryUJFyUtFyUWFWUKrWUAa9I yw4j93sxAFs8AwUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07b3UUUUUUUU= X-Originating-IP: [222.131.246.88] X-CM-SenderInfo: held01tdqsiiqwqsqiywtou0bp/1tbiKBA14FWBVZMoZQAAsy Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1212 Lines: 42 From: Pan Bian 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 --- 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