Moved the code for freeing the ring of I/O context structures to a separate function.

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@875 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2009-05-21 06:54:42 +00:00
parent 2959a19435
commit b2d0960b57

View File

@@ -582,6 +582,17 @@ err:
return -ENOMEM;
}
/* Free the ring of SRPT I/O context structures. */
static void srpt_free_ioctx_ring(struct srpt_device *sdev)
{
int i;
for (i = 0; i < SRPT_SRQ_SIZE; ++i) {
srpt_free_ioctx(sdev, sdev->ioctx_ring[i]);
sdev->ioctx_ring[i] = NULL;
}
}
/*
* Post a receive request on the work queue of InfiniBand device 'sdev'.
*/
@@ -2473,10 +2484,9 @@ free_dev:
static void srpt_remove_one(struct ib_device *device)
{
struct srpt_device *sdev;
int i;
sdev = ib_get_client_data(device, &srpt_client);
if (!sdev)
if (!WARN_ON(sdev))
return;
wait_for_completion(&sdev->scst_released);
@@ -2492,9 +2502,7 @@ static void srpt_remove_one(struct ib_device *device)
device_unregister(&sdev->dev);
#endif
for (i = 0; i < SRPT_SRQ_SIZE; ++i)
srpt_free_ioctx(sdev, sdev->ioctx_ring[i]);
srpt_free_ioctx_ring(sdev);
list_del(&sdev->list);
kfree(sdev);
}