Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753880AbcKIM5Z (ORCPT ); Wed, 9 Nov 2016 07:57:25 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:49850 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753797AbcKIM5W (ORCPT ); Wed, 9 Nov 2016 07:57:22 -0500 From: Arnd Bergmann To: Jens Axboe Cc: Christoph Hellwig , Arnd Bergmann , Mike Christie , Hannes Reinecke , Ming Lin , linux-kernel@vger.kernel.org Subject: [PATCH 1/2] skd: fix msix error handling Date: Wed, 9 Nov 2016 13:55:34 +0100 Message-Id: <20161109125555.1440353-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:SK9WgnAmhwsipKGX9zRjj5hvqL3fy6AnfSzKn4p80auKcP4pPV4 +HaA0BcccM740RxMQmTavZjsMhVsxd2FO6MbhYejKvWJDEKfm+4O9a8zx9GeWlZOWs7sUH3 S8F9m9P9hM9bhqKOFa5D1MR6NLm/FFfNDn0ozgvtFE64fzqNA1l6pY8161NijLXo+gMlvtV HB9NkIhUJ9Mf0AsFBqrNg== X-UI-Out-Filterresults: notjunk:1;V01:K0:u9oeYotezaA=:s42flFuY8dcnpCEPWWJTW7 myLVjNjyRYRJTHEoMpWN0kqaJiXx//6AOfiSFI4YhVu/F2ss1rkjwhxEnt0LQRKJBEaqQtl+r lUjB1FX2nqpxcUMVWvrKBf5K4gEsxySv2GIWtuSJ0JcYa7F2IEsOrXlxBRkqRqJxeHk/VM0Br usGP6DqOXGlEiA5lY3kkdAvQvVwUioi0nll84l7cM0YOR5l01p1e3GSD9pdjdykWESTw9X830 21UyrZ30WFeqfAy4NSzLeVGOVNqEBKa6hwV4H+YL3hIzFu5LO2c9I5Dt1TfISH7MlwaSy5o/R rVQN5HWODoFBXL4c0r3ltdCx/lBQa1gk7sPT/TZ02GkRx8qMJETwj23SrYn5jRPNxd55M1ES1 bpuQYyC8KH3e9xpUqzoxhwYSNpeg8RcWgPomSskoU54FfnUm5CT/D9ni6JAVrG/sk36qdM8+V sUNiiMfXAipGxBPWBpENJkEZnn04oi/NcxPT1nHlQ4ocPbWGLmRsG1lCNC9XnAxzP3Ffzq095 YKxHJTS+YZigm7GJfhFXZYvusCX+U3qsyCjKUDWDr7vOj3j8A3u3ALydY0Z7ru4s3ZjAx7caQ MkUB/IVWS+EXamVmr3WXfKrlIUVcfYXws806o2FYDewuwMkGCCzCuaE13NvStI18/TsgoIroU /JaInOj/39S0UR+RwaBdstkiv72Pw7HsB6URu8nzH1L15+bLVZWpCKtoF2sREjM1UnTUJUg1G /45IgX8+PFgPEmKN Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1620 Lines: 49 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 --- drivers/block/skd_main.c | 5 +++-- 1 file 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; -- 2.9.0