Skip to content

Commit 3bc8492

Browse files
arndbaxboe
authored andcommitted
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: 180b0ae ("skd: use pci_alloc_irq_vectors") Signed-off-by: Arnd Bergmann <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent ae5b2ec commit 3bc8492

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/block/skd_main.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3849,7 +3849,7 @@ static int skd_acquire_msix(struct skd_device *skdev)
38493849
if (rc < 0) {
38503850
pr_err("(%s): failed to enable MSI-X %d\n",
38513851
skd_name(skdev), rc);
3852-
goto msix_out;
3852+
goto out;
38533853
}
38543854

38553855
skdev->msix_entries = kcalloc(SKD_MAX_MSIX_COUNT,
@@ -3858,7 +3858,7 @@ static int skd_acquire_msix(struct skd_device *skdev)
38583858
rc = -ENOMEM;
38593859
pr_err("(%s): msix table allocation error\n",
38603860
skd_name(skdev));
3861-
goto msix_out;
3861+
goto out;
38623862
}
38633863

38643864
/* Enable MSI-X vectors for the base queue */
@@ -3889,6 +3889,7 @@ static int skd_acquire_msix(struct skd_device *skdev)
38893889
msix_out:
38903890
while (--i >= 0)
38913891
devm_free_irq(&pdev->dev, pci_irq_vector(pdev, i), skdev);
3892+
out:
38923893
kfree(skdev->msix_entries);
38933894
skdev->msix_entries = NULL;
38943895
return rc;

0 commit comments

Comments
 (0)