linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] skd: fix msix error handling
@ 2016-11-09 12:55 Arnd Bergmann
  2016-11-09 12:55 ` [PATCH 2/2] skd: fix function prototype Arnd Bergmann
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Arnd Bergmann @ 2016-11-09 12:55 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Christoph Hellwig, Arnd Bergmann, Mike Christie, Hannes Reinecke,
	Ming Lin, linux-kernel

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>
---
 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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] skd: fix function prototype
  2016-11-09 12:55 [PATCH 1/2] skd: fix msix error handling Arnd Bergmann
@ 2016-11-09 12:55 ` Arnd Bergmann
  2016-11-14  8:10   ` Johannes Thumshirn
  2016-11-09 15:07 ` [PATCH 1/2] skd: fix msix error handling Christoph Hellwig
  2016-11-10  5:54 ` Jens Axboe
  2 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2016-11-09 12:55 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Christoph Hellwig, Arnd Bergmann, Johannes Thumshirn, Ming Lin,
	linux-kernel

Building with W=1 shows a harmless warning for the skd driver:

drivers/block/skd_main.c:2959:1: error: ‘static’ is not at beginning of declaration [-Werror=old-style-declaration]

This changes the prototype to the expected formatting.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/block/skd_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
index 66146b349229..1e536b97f802 100644
--- a/drivers/block/skd_main.c
+++ b/drivers/block/skd_main.c
@@ -2945,8 +2945,8 @@ static void skd_completion_worker(struct work_struct *work)
 
 static void skd_isr_msg_from_dev(struct skd_device *skdev);
 
-irqreturn_t
-static skd_isr(int irq, void *ptr)
+static irqreturn_t
+skd_isr(int irq, void *ptr)
 {
 	struct skd_device *skdev;
 	u32 intstat;
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] skd: fix msix error handling
  2016-11-09 12:55 [PATCH 1/2] skd: fix msix error handling Arnd Bergmann
  2016-11-09 12:55 ` [PATCH 2/2] skd: fix function prototype Arnd Bergmann
@ 2016-11-09 15:07 ` Christoph Hellwig
  2016-11-10  5:54 ` Jens Axboe
  2 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2016-11-09 15:07 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Jens Axboe, Christoph Hellwig, Mike Christie, Hannes Reinecke,
	Ming Lin, linux-kernel

Thanks Arnd,

this looks fine:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] skd: fix msix error handling
  2016-11-09 12:55 [PATCH 1/2] skd: fix msix error handling Arnd Bergmann
  2016-11-09 12:55 ` [PATCH 2/2] skd: fix function prototype Arnd Bergmann
  2016-11-09 15:07 ` [PATCH 1/2] skd: fix msix error handling Christoph Hellwig
@ 2016-11-10  5:54 ` Jens Axboe
  2 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2016-11-10  5:54 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Christoph Hellwig, Mike Christie, Hannes Reinecke, Ming Lin,
	linux-kernel

On 11/09/2016 05:55 AM, Arnd Bergmann wrote:
> 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.

Applied both patches, thanks Arnd.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] skd: fix function prototype
  2016-11-09 12:55 ` [PATCH 2/2] skd: fix function prototype Arnd Bergmann
@ 2016-11-14  8:10   ` Johannes Thumshirn
  0 siblings, 0 replies; 5+ messages in thread
From: Johannes Thumshirn @ 2016-11-14  8:10 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Jens Axboe, Christoph Hellwig, Ming Lin, linux-kernel

On Wed, Nov 09, 2016 at 01:55:35PM +0100, Arnd Bergmann wrote:
> Building with W=1 shows a harmless warning for the skd driver:
> 
> drivers/block/skd_main.c:2959:1: error: ‘static’ is not at beginning of declaration [-Werror=old-style-declaration]
> 
> This changes the prototype to the expected formatting.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

Looks good,
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>

-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-11-14  8:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-09 12:55 [PATCH 1/2] skd: fix msix error handling Arnd Bergmann
2016-11-09 12:55 ` [PATCH 2/2] skd: fix function prototype Arnd Bergmann
2016-11-14  8:10   ` Johannes Thumshirn
2016-11-09 15:07 ` [PATCH 1/2] skd: fix msix error handling Christoph Hellwig
2016-11-10  5:54 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).