Skip to content

Commit 6097976

Browse files
preisigregkh
authored andcommitted
net: 3com: typhoon: typhoon_init_one: make return values more specific
[ 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent d7c3d53 commit 6097976

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

drivers/net/ethernet/3com/typhoon.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2366,9 +2366,9 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
23662366
* 4) Get the hardware address.
23672367
* 5) Put the card to sleep.
23682368
*/
2369-
if (typhoon_reset(ioaddr, WaitSleep) < 0) {
2369+
err = typhoon_reset(ioaddr, WaitSleep);
2370+
if (err < 0) {
23702371
err_msg = "could not reset 3XP";
2371-
err = -EIO;
23722372
goto error_out_dma;
23732373
}
23742374

@@ -2382,16 +2382,16 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
23822382
typhoon_init_interface(tp);
23832383
typhoon_init_rings(tp);
23842384

2385-
if(typhoon_boot_3XP(tp, TYPHOON_STATUS_WAITING_FOR_HOST) < 0) {
2385+
err = typhoon_boot_3XP(tp, TYPHOON_STATUS_WAITING_FOR_HOST);
2386+
if (err < 0) {
23862387
err_msg = "cannot boot 3XP sleep image";
2387-
err = -EIO;
23882388
goto error_out_reset;
23892389
}
23902390

23912391
INIT_COMMAND_WITH_RESPONSE(&xp_cmd, TYPHOON_CMD_READ_MAC_ADDRESS);
2392-
if(typhoon_issue_command(tp, 1, &xp_cmd, 1, xp_resp) < 0) {
2392+
err = typhoon_issue_command(tp, 1, &xp_cmd, 1, xp_resp);
2393+
if (err < 0) {
23932394
err_msg = "cannot read MAC address";
2394-
err = -EIO;
23952395
goto error_out_reset;
23962396
}
23972397

@@ -2424,9 +2424,9 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
24242424
if(xp_resp[0].numDesc != 0)
24252425
tp->capabilities |= TYPHOON_WAKEUP_NEEDS_RESET;
24262426

2427-
if(typhoon_sleep(tp, PCI_D3hot, 0) < 0) {
2427+
err = typhoon_sleep(tp, PCI_D3hot, 0);
2428+
if (err < 0) {
24282429
err_msg = "cannot put adapter to sleep";
2429-
err = -EIO;
24302430
goto error_out_reset;
24312431
}
24322432

0 commit comments

Comments
 (0)