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>
This commit is contained in:
parent
3746bfd51d
commit
78af7f826b
|
@ -1451,7 +1451,7 @@ static int slic_if_init(struct adapter *adapter)
|
||||||
struct net_device *dev = adapter->netdev;
|
struct net_device *dev = adapter->netdev;
|
||||||
__iomem struct slic_regs *slic_regs = adapter->slic_regs;
|
__iomem struct slic_regs *slic_regs = adapter->slic_regs;
|
||||||
struct slic_shmem *pshmem;
|
struct slic_shmem *pshmem;
|
||||||
int status = 0;
|
int rc;
|
||||||
|
|
||||||
ASSERT(card);
|
ASSERT(card);
|
||||||
|
|
||||||
|
@ -1459,7 +1459,8 @@ static int slic_if_init(struct adapter *adapter)
|
||||||
if (adapter->state != ADAPT_DOWN) {
|
if (adapter->state != ADAPT_DOWN) {
|
||||||
dev_err(&dev->dev, "%s: adapter->state != ADAPT_DOWN\n",
|
dev_err(&dev->dev, "%s: adapter->state != ADAPT_DOWN\n",
|
||||||
__func__);
|
__func__);
|
||||||
return -EIO;
|
rc = -EIO;
|
||||||
|
goto err;
|
||||||
}
|
}
|
||||||
ASSERT(adapter->linkstate == LINK_DOWN);
|
ASSERT(adapter->linkstate == LINK_DOWN);
|
||||||
|
|
||||||
|
@ -1475,22 +1476,22 @@ static int slic_if_init(struct adapter *adapter)
|
||||||
if (dev->flags & IFF_MULTICAST)
|
if (dev->flags & IFF_MULTICAST)
|
||||||
adapter->macopts |= MAC_MCAST;
|
adapter->macopts |= MAC_MCAST;
|
||||||
}
|
}
|
||||||
status = slic_adapter_allocresources(adapter);
|
rc = slic_adapter_allocresources(adapter);
|
||||||
if (status != 0) {
|
if (rc) {
|
||||||
dev_err(&dev->dev,
|
dev_err(&dev->dev,
|
||||||
"%s: slic_adapter_allocresources FAILED %x\n",
|
"%s: slic_adapter_allocresources FAILED %x\n",
|
||||||
__func__, status);
|
__func__, rc);
|
||||||
slic_adapter_freeresources(adapter);
|
slic_adapter_freeresources(adapter);
|
||||||
return status;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!adapter->queues_initialized) {
|
if (!adapter->queues_initialized) {
|
||||||
if (slic_rspqueue_init(adapter))
|
if ((rc = slic_rspqueue_init(adapter)))
|
||||||
return -ENOMEM;
|
goto err;
|
||||||
if (slic_cmdq_init(adapter))
|
if ((rc = slic_cmdq_init(adapter)))
|
||||||
return -ENOMEM;
|
goto err;
|
||||||
if (slic_rcvqueue_init(adapter))
|
if ((rc = slic_rcvqueue_init(adapter)))
|
||||||
return -ENOMEM;
|
goto err;
|
||||||
adapter->queues_initialized = 1;
|
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_config(adapter, LINK_AUTOSPEED, LINK_AUTOD);
|
||||||
slic_link_event_handler(adapter);
|
slic_link_event_handler(adapter);
|
||||||
|
|
||||||
return 0;
|
err:
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void slic_unmap_mmio_space(struct adapter *adapter)
|
static void slic_unmap_mmio_space(struct adapter *adapter)
|
||||||
|
|
Loading…
Reference in New Issue