diff options
author | Kulikov Vasiliy <segooon@gmail.com> | 2010-06-27 17:20:47 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-07-08 13:16:43 -0700 |
commit | 78af7f826b2bf19bce0adb458da19dabfee1a0aa (patch) | |
tree | 5c78dccdfbcbbb7f446a961540106291bd949d5d /drivers/staging/slicoss | |
parent | 3746bfd51d8108d43c06064481065afc07bbcc1d (diff) | |
download | blackbird-op-linux-78af7f826b2bf19bce0adb458da19dabfee1a0aa.tar.gz blackbird-op-linux-78af7f826b2bf19bce0adb458da19dabfee1a0aa.zip |
staging: slicoss: error handling with goto
This patch makes error handling more readable due to 'goto err' pattern.
Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Cc: Denis Kirjanov <kirjanov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/slicoss')
-rw-r--r-- | drivers/staging/slicoss/slicoss.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 51ca17c1f483..d3fc5770e558 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -1451,7 +1451,7 @@ static int slic_if_init(struct adapter *adapter) struct net_device *dev = adapter->netdev; __iomem struct slic_regs *slic_regs = adapter->slic_regs; struct slic_shmem *pshmem; - int status = 0; + int rc; ASSERT(card); @@ -1459,7 +1459,8 @@ static int slic_if_init(struct adapter *adapter) if (adapter->state != ADAPT_DOWN) { dev_err(&dev->dev, "%s: adapter->state != ADAPT_DOWN\n", __func__); - return -EIO; + rc = -EIO; + goto err; } ASSERT(adapter->linkstate == LINK_DOWN); @@ -1475,22 +1476,22 @@ static int slic_if_init(struct adapter *adapter) if (dev->flags & IFF_MULTICAST) adapter->macopts |= MAC_MCAST; } - status = slic_adapter_allocresources(adapter); - if (status != 0) { + rc = slic_adapter_allocresources(adapter); + if (rc) { dev_err(&dev->dev, "%s: slic_adapter_allocresources FAILED %x\n", - __func__, status); + __func__, rc); slic_adapter_freeresources(adapter); - return status; + goto err; } if (!adapter->queues_initialized) { - if (slic_rspqueue_init(adapter)) - return -ENOMEM; - if (slic_cmdq_init(adapter)) - return -ENOMEM; - if (slic_rcvqueue_init(adapter)) - return -ENOMEM; + if ((rc = slic_rspqueue_init(adapter))) + goto err; + if ((rc = slic_cmdq_init(adapter))) + goto err; + if ((rc = slic_rcvqueue_init(adapter))) + goto err; adapter->queues_initialized = 1; } @@ -1553,7 +1554,8 @@ static int slic_if_init(struct adapter *adapter) slic_link_config(adapter, LINK_AUTOSPEED, LINK_AUTOD); slic_link_event_handler(adapter); - return 0; +err: + return rc; } static void slic_unmap_mmio_space(struct adapter *adapter) |