summaryrefslogtreecommitdiffstats
path: root/drivers/block/skd_main.c
diff options
context:
space:
mode:
authorArnd Bergmann2016-11-09 13:55:34 +0100
committerJens Axboe2016-11-10 06:53:45 +0100
commit3bc8492f009c76a9e77cad6e200b0748d3972fa0 (patch)
tree6c359501445272e2b60dc139ac51f888f6173599 /drivers/block/skd_main.c
parentblock: set REQ_SYNC if we clear REQ_FUA|REQ_PREFLUSH (diff)
downloadkernel-qcow2-linux-3bc8492f009c76a9e77cad6e200b0748d3972fa0.tar.gz
kernel-qcow2-linux-3bc8492f009c76a9e77cad6e200b0748d3972fa0.tar.xz
kernel-qcow2-linux-3bc8492f009c76a9e77cad6e200b0748d3972fa0.zip
skd: fix msix error handling
As reported by gcc -Wmaybe-uninitialized, the cleanup path for skd_acquire_msix tries to free the already allocated msi-x vectors in reverse order, but the index variable may not have been used yet: drivers/block/skd_main.c: In function ‘skd_acquire_irq’: drivers/block/skd_main.c:3890:8: error: ‘i’ may be used uninitialized in this function [-Werror=maybe-uninitialized] This changes the failure path to skip releasing the interrupts if we have not started requesting them yet. Fixes: 180b0ae77d49 ("skd: use pci_alloc_irq_vectors") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/block/skd_main.c')
-rw-r--r--drivers/block/skd_main.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
index a58256cd94d7..66146b349229 100644
--- a/drivers/block/skd_main.c
+++ b/drivers/block/skd_main.c
@@ -3849,7 +3849,7 @@ static int skd_acquire_msix(struct skd_device *skdev)
if (rc < 0) {
pr_err("(%s): failed to enable MSI-X %d\n",
skd_name(skdev), rc);
- goto msix_out;
+ goto out;
}
skdev->msix_entries = kcalloc(SKD_MAX_MSIX_COUNT,
@@ -3858,7 +3858,7 @@ static int skd_acquire_msix(struct skd_device *skdev)
rc = -ENOMEM;
pr_err("(%s): msix table allocation error\n",
skd_name(skdev));
- goto msix_out;
+ goto out;
}
/* Enable MSI-X vectors for the base queue */
@@ -3889,6 +3889,7 @@ static int skd_acquire_msix(struct skd_device *skdev)
msix_out:
while (--i >= 0)
devm_free_irq(&pdev->dev, pci_irq_vector(pdev, i), skdev);
+out:
kfree(skdev->msix_entries);
skdev->msix_entries = NULL;
return rc;