diff options
author | Bart Van Assche <bart.vanassche@wdc.com> | 2017-08-17 22:13:30 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2017-08-18 16:45:29 +0200 |
commit | 5d003240fdbaa59b6746f5d47b31da6864888205 (patch) | |
tree | aebc6e0239ead2194113a28f3346480396585a04 /drivers/block/skd_main.c | |
parent | skd: Split skd_recover_requests() (diff) | |
download | linux-5d003240fdbaa59b6746f5d47b31da6864888205.tar.xz linux-5d003240fdbaa59b6746f5d47b31da6864888205.zip |
skd: Move skd_free_sg_list() up
Issue a warning if a NULL argument is passed to skd_free_sg_list().
Move this function up to make the blk-mq conversion patch easier
to read.
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to '')
-rw-r--r-- | drivers/block/skd_main.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c index 451974138b32..b69b1a041c8f 100644 --- a/drivers/block/skd_main.c +++ b/drivers/block/skd_main.c @@ -2850,6 +2850,18 @@ static struct fit_sg_descriptor *skd_cons_sg_list(struct skd_device *skdev, return sg_list; } +static void skd_free_sg_list(struct skd_device *skdev, + struct fit_sg_descriptor *sg_list, u32 n_sg, + dma_addr_t dma_addr) +{ + u32 nbytes = sizeof(*sg_list) * n_sg; + + if (WARN_ON_ONCE(!sg_list)) + return; + + pci_free_consistent(skdev->pdev, nbytes, sg_list, dma_addr); +} + static int skd_cons_skreq(struct skd_device *skdev) { int rc = 0; @@ -3105,19 +3117,6 @@ static void skd_free_skmsg(struct skd_device *skdev) skdev->skmsg_table = NULL; } -static void skd_free_sg_list(struct skd_device *skdev, - struct fit_sg_descriptor *sg_list, - u32 n_sg, dma_addr_t dma_addr) -{ - if (sg_list != NULL) { - u32 nbytes; - - nbytes = sizeof(*sg_list) * n_sg; - - pci_free_consistent(skdev->pdev, nbytes, sg_list, dma_addr); - } -} - static void skd_free_skreq(struct skd_device *skdev) { u32 i; |