lkml.org 
[lkml]   [2017]   [Sep]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] scsi: fdomain: Fix a resource leak in an error handling path in '__fdomain_16x0_detect()'
Date
All error handling paths 'goto fail' in this function.
If 'scsi_register()' fails, we should also go there, otherwise a
'pci_dev_put(pdev)' will be missing.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
In order to keep consistance with the rest of the file, I've ignored
checkpatch warnings about spaces vs tabs and indent.
---
drivers/scsi/fdomain.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c
index ebbe5a3e665d..0dac03a9c6ed 100644
--- a/drivers/scsi/fdomain.c
+++ b/drivers/scsi/fdomain.c
@@ -960,10 +960,9 @@ struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt )
get resources. */

shpnt = scsi_register( tpnt, 0 );
- if(shpnt == NULL) {
- release_region(port_base, 0x10);
- return NULL;
- }
+ if (shpnt == NULL)
+ goto fail;
+
shpnt->irq = interrupt_level;
shpnt->io_port = port_base;
shpnt->n_io_port = 0x10;
--
2.11.0
\
 
 \ /
  Last update: 2017-09-15 21:57    [W:0.054 / U:0.532 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site