summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Scheller <d.scheller@gmx.net>2017-12-17 10:40:47 -0500
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-12-19 07:17:28 -0500
commitb7b9a5a93b7d859dacc3dff312346b4ab23fa60d (patch)
tree14b153acda262f84f4f4407f2e0c7830cf46dc0d
parentb5472c12facb001145ade0bd69c80def36331f28 (diff)
downloadlinux-b7b9a5a93b7d859dacc3dff312346b4ab23fa60d.tar.bz2
media: ddbridge: fix deinit order in case of failure in ddb_init()
In ddb_init(), the deinitialization sequence isn't correct when handling errors, and could even lead to a memleak depending on where things failed. Fix the deinit order. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r--drivers/media/pci/ddbridge/ddbridge-core.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c
index c2013d170c99..e68ca00e73d8 100644
--- a/drivers/media/pci/ddbridge/ddbridge-core.c
+++ b/drivers/media/pci/ddbridge/ddbridge-core.c
@@ -3279,7 +3279,7 @@ int ddb_init(struct ddb *dev)
ddb_init_boards(dev);
if (ddb_i2c_init(dev) < 0)
- goto fail;
+ goto fail1;
ddb_ports_init(dev);
if (ddb_buffers_alloc(dev) < 0) {
dev_info(dev->dev, "Could not allocate buffer memory\n");
@@ -3297,14 +3297,14 @@ int ddb_init(struct ddb *dev)
return 0;
fail3:
- ddb_ports_detach(dev);
dev_err(dev->dev, "fail3\n");
- ddb_ports_release(dev);
+ ddb_ports_detach(dev);
+ ddb_buffers_free(dev);
fail2:
dev_err(dev->dev, "fail2\n");
- ddb_buffers_free(dev);
+ ddb_ports_release(dev);
ddb_i2c_release(dev);
-fail:
+fail1:
dev_err(dev->dev, "fail1\n");
return -1;
}