Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753425AbcLCPk0 (ORCPT ); Sat, 3 Dec 2016 10:40:26 -0500 Received: from m50-138.163.com ([123.125.50.138]:40855 "EHLO m50-138.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753283AbcLCPkZ (ORCPT ); Sat, 3 Dec 2016 10:40:25 -0500 From: Pan Bian To: Lino Sanfilippo , David Dillow , netdev@vger.kernel.org Cc: PanBian , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] net: ethernet: 3com: set error code on failures Date: Sat, 3 Dec 2016 23:23:12 +0800 Message-Id: <20161203141512.GA7143@bp> X-Mailer: git-send-email 1.9.1 Reply-To: PanBian References: <1480771470-6404-1-git-send-email-bianpan201602@163.com> <06dd8fc8-0c39-e79d-7e34-22bfab17d8a3@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <06dd8fc8-0c39-e79d-7e34-22bfab17d8a3@gmx.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-CM-TRANSID: C9GowAAXDSad40JYNY47IQ--.48985S3 X-Coremail-Antispam: 1Uf129KBjvJXoW7uF15Cr45tFy8Xw47WryUZFb_yoW8GryDpr WIga4kCFyUWr1UJrW0yryUXayrur47tr4j9r4kWrWqq3W5Kwn2qF4DtryjgFyUCryjyw45 u3y8u347Cay5Ar7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07bjrWrUUUUU= X-Originating-IP: [222.131.246.88] X-CM-SenderInfo: held01tdqsiiqwqsqiywtou0bp/1tbiWAs14FUL-BE1vQABs8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1432 Lines: 50 From: PanBian 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 > > > > 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 > > > > > @@ -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