mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: alexander.levin@verizon.com
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Cc: Thomas Preisner <thomas.preisner+linux@fau.de>,
	Milan Stephan <milan.stephan+linux@fau.de>,
	"David S . Miller" <davem@davemloft.net>,
	alexander.levin@verizon.com
Subject: [PATCH AUTOSEL for 3.18 04/16] net: 3com: typhoon: typhoon_init_one: make return values more specific
Date: Wed, 15 Nov 2017 02:46:14 +0000	[thread overview]
Message-ID: <20171115024607.6064-4-alexander.levin@verizon.com> (raw)
In-Reply-To: <20171115024607.6064-1-alexander.levin@verizon.com>

From: Thomas Preisner <thomas.preisner+linux@fau.de>

[ Upstream commit 6b6bbb5922a4b1d4b58125a572da91010295fba3 ]

In some cases the return value of a failing function is not being used
and the function typhoon_init_one() returns another negative error code
instead.

Signed-off-by: Thomas Preisner <thomas.preisner+linux@fau.de>
Signed-off-by: Milan Stephan <milan.stephan+linux@fau.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 drivers/net/ethernet/3com/typhoon.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/3com/typhoon.c b/drivers/net/ethernet/3com/typhoon.c
index 48775b88bac7..0f55088d18c4 100644
--- a/drivers/net/ethernet/3com/typhoon.c
+++ b/drivers/net/ethernet/3com/typhoon.c
@@ -2366,9 +2366,9 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	 * 4) Get the hardware address.
 	 * 5) Put the card to sleep.
 	 */
-	if (typhoon_reset(ioaddr, WaitSleep) < 0) {
+	err = typhoon_reset(ioaddr, WaitSleep);
+	if (err < 0) {
 		err_msg = "could not reset 3XP";
-		err = -EIO;
 		goto error_out_dma;
 	}
 
@@ -2382,16 +2382,16 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	typhoon_init_interface(tp);
 	typhoon_init_rings(tp);
 
-	if(typhoon_boot_3XP(tp, TYPHOON_STATUS_WAITING_FOR_HOST) < 0) {
+	err = typhoon_boot_3XP(tp, TYPHOON_STATUS_WAITING_FOR_HOST);
+	if (err < 0) {
 		err_msg = "cannot boot 3XP sleep image";
-		err = -EIO;
 		goto error_out_reset;
 	}
 
 	INIT_COMMAND_WITH_RESPONSE(&xp_cmd, TYPHOON_CMD_READ_MAC_ADDRESS);
-	if(typhoon_issue_command(tp, 1, &xp_cmd, 1, xp_resp) < 0) {
+	err = typhoon_issue_command(tp, 1, &xp_cmd, 1, xp_resp);
+	if (err < 0) {
 		err_msg = "cannot read MAC address";
-		err = -EIO;
 		goto error_out_reset;
 	}
 
@@ -2424,9 +2424,9 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if(xp_resp[0].numDesc != 0)
 		tp->capabilities |= TYPHOON_WAKEUP_NEEDS_RESET;
 
-	if(typhoon_sleep(tp, PCI_D3hot, 0) < 0) {
+	err = typhoon_sleep(tp, PCI_D3hot, 0);
+	if (err < 0) {
 		err_msg = "cannot put adapter to sleep";
-		err = -EIO;
 		goto error_out_reset;
 	}
 
-- 
2.11.0

  parent reply	other threads:[~2017-11-15  3:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-15  2:46 [PATCH AUTOSEL for 3.18 01/16] ACPICA: Resources: Not a valid resource if buffer length too long alexander.levin
2017-11-15  2:46 ` [PATCH AUTOSEL for 3.18 03/16] PCI: Apply _HPX settings only to relevant devices alexander.levin
2017-11-15  2:46 ` [PATCH AUTOSEL for 3.18 02/16] RDS: RDMA: return appropriate error on rdma map failures alexander.levin
2017-11-15  2:46 ` [PATCH AUTOSEL for 3.18 05/16] net: 3com: typhoon: typhoon_init_one: fix incorrect return values alexander.levin
2017-11-15  2:46 ` [PATCH AUTOSEL for 3.18 06/16] drm/armada: Fix compile fail alexander.levin
2017-11-15  2:46 ` alexander.levin [this message]
2017-11-15  2:46 ` [PATCH AUTOSEL for 3.18 07/16] ALSA: hda - Apply ALC269_FIXUP_NO_SHUTUP on HDA_FIXUP_ACT_PROBE alexander.levin
2017-11-15  2:46 ` [PATCH AUTOSEL for 3.18 11/16] netfilter: nft_queue: use raw_smp_processor_id() alexander.levin
2017-11-15  2:46 ` [PATCH AUTOSEL for 3.18 09/16] mac80211: Suppress NEW_PEER_CANDIDATE event if no room alexander.levin
2017-11-15  2:46 ` [PATCH AUTOSEL for 3.18 12/16] netfilter: nf_tables: fix oob access alexander.levin
2017-11-15  2:46 ` [PATCH AUTOSEL for 3.18 08/16] mac80211: Remove invalid flag operations in mesh TSF synchronization alexander.levin
2017-11-15  2:46 ` [PATCH AUTOSEL for 3.18 10/16] staging: iio: cdc: fix improper return value alexander.levin
2017-11-15  2:46 ` [PATCH AUTOSEL for 3.18 15/16] s390/kbuild: enable modversions for symbols exported from asm alexander.levin
2017-11-15  2:46 ` [PATCH AUTOSEL for 3.18 14/16] ASoC: wm_adsp: Don't overrun firmware file buffer when reading region data alexander.levin
2017-11-15  2:46 ` [PATCH AUTOSEL for 3.18 13/16] btrfs: return the actual error value from from btrfs_uuid_tree_iterate alexander.levin
2017-11-15  2:46 ` [PATCH AUTOSEL for 3.18 16/16] xen: xenbus driver must not accept invalid transaction ids alexander.levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171115024607.6064-4-alexander.levin@verizon.com \
    --to=alexander.levin@verizon.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=milan.stephan+linux@fau.de \
    --cc=stable@vger.kernel.org \
    --cc=thomas.preisner+linux@fau.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®