[PATCH] media: cx88: Add vp3054_i2c_remove() in the error path of cx8802_dvb_probe()

Haoxiang Li posted 1 patch 21 hours ago
drivers/media/pci/cx88/cx88-dvb.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
[PATCH] media: cx88: Add vp3054_i2c_remove() in the error path of cx8802_dvb_probe()
Posted by Haoxiang Li 21 hours ago
The resources allocated in vp3054_i2c_probe() is not cleaned in the
error path. Add vp3054_i2c_remove() in the error path. Also add a
goto if dvb_register() fails.

Since if dvb_register() fails, vb2_dvb_dealloc_frontends() has been
called, thus there is no need to goto fail_probe label.

Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
---
 drivers/media/pci/cx88/cx88-dvb.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/media/pci/cx88/cx88-dvb.c b/drivers/media/pci/cx88/cx88-dvb.c
index c9cfceed2f1b..b94e4741fd39 100644
--- a/drivers/media/pci/cx88/cx88-dvb.c
+++ b/drivers/media/pci/cx88/cx88-dvb.c
@@ -1758,7 +1758,7 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv)
 
 	err = cx8802_alloc_frontends(dev);
 	if (err)
-		goto fail_core;
+		goto fail_free;
 
 	for (i = 1; i <= core->board.num_frontends; i++) {
 		struct vb2_queue *q;
@@ -1792,12 +1792,17 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv)
 	}
 
 	err = dvb_register(dev);
-	if (err)
+	if (err) {
 		/* frontends/adapter de-allocated in dvb_register */
 		pr_err("dvb_register failed (err = %d)\n", err);
+		goto fail_free;
+	}
+
 	return err;
 fail_probe:
 	vb2_dvb_dealloc_frontends(&core->dvbdev->frontends);
+fail_free:
+	vp3054_i2c_remove(dev);
 fail_core:
 	return err;
 }
-- 
2.25.1