Commit b7b9a5a9 authored by Daniel Scheller's avatar Daniel Scheller Committed by Mauro Carvalho Chehab

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: default avatarDaniel Scheller <d.scheller@gmx.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent b5472c12
...@@ -3279,7 +3279,7 @@ int ddb_init(struct ddb *dev) ...@@ -3279,7 +3279,7 @@ int ddb_init(struct ddb *dev)
ddb_init_boards(dev); ddb_init_boards(dev);
if (ddb_i2c_init(dev) < 0) if (ddb_i2c_init(dev) < 0)
goto fail; goto fail1;
ddb_ports_init(dev); ddb_ports_init(dev);
if (ddb_buffers_alloc(dev) < 0) { if (ddb_buffers_alloc(dev) < 0) {
dev_info(dev->dev, "Could not allocate buffer memory\n"); dev_info(dev->dev, "Could not allocate buffer memory\n");
...@@ -3297,14 +3297,14 @@ int ddb_init(struct ddb *dev) ...@@ -3297,14 +3297,14 @@ int ddb_init(struct ddb *dev)
return 0; return 0;
fail3: fail3:
ddb_ports_detach(dev);
dev_err(dev->dev, "fail3\n"); dev_err(dev->dev, "fail3\n");
ddb_ports_release(dev); ddb_ports_detach(dev);
ddb_buffers_free(dev);
fail2: fail2:
dev_err(dev->dev, "fail2\n"); dev_err(dev->dev, "fail2\n");
ddb_buffers_free(dev); ddb_ports_release(dev);
ddb_i2c_release(dev); ddb_i2c_release(dev);
fail: fail1:
dev_err(dev->dev, "fail1\n"); dev_err(dev->dev, "fail1\n");
return -1; return -1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment