From patchwork Wed Nov 9 12:55:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101544 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp179360qge; Wed, 9 Nov 2016 04:57:37 -0800 (PST) X-Received: by 10.98.75.11 with SMTP id y11mr32909480pfa.30.1478696257359; Wed, 09 Nov 2016 04:57:37 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n28si42034699pgd.281.2016.11.09.04.57.37; Wed, 09 Nov 2016 04:57:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753885AbcKIM5Z (ORCPT + 27 others); 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 Received: from wuerfel.lan. ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue001) with ESMTPA (Nemesis) id 0Lq1ku-1ciAsp3Ubw-00djZw; Wed, 09 Nov 2016 13:55:59 +0100 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 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.9.0 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;