diff mbox series

[2/6] media: ivsc: csi: Clean up V4L2 async notifier on error

Message ID 20231026081346.958238-3-sakari.ailus@linux.intel.com
State Accepted
Commit e34660972b88e8d27f17e220fe13609b5cd52ec2
Headers show
Series IVSC CSI fwnode parsing fixes and cleanups | expand

Commit Message

Sakari Ailus Oct. 26, 2023, 8:13 a.m. UTC
Clean up the V4L2 async notifier in error handling path, and add label to
unify handling.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Wentong Wu <wentong.wu@intel.com>
---
 drivers/media/pci/intel/ivsc/mei_csi.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/drivers/media/pci/intel/ivsc/mei_csi.c b/drivers/media/pci/intel/ivsc/mei_csi.c
index b04847e30213..281d7f5e18f9 100644
--- a/drivers/media/pci/intel/ivsc/mei_csi.c
+++ b/drivers/media/pci/intel/ivsc/mei_csi.c
@@ -672,16 +672,20 @@  static int mei_csi_parse_firmware(struct mei_csi *csi)
 
 	asd = v4l2_async_nf_add_fwnode(&csi->notifier, fwnode,
 				       struct v4l2_async_connection);
+	fwnode_handle_put(fwnode);
 	if (IS_ERR(asd)) {
-		fwnode_handle_put(fwnode);
-		return PTR_ERR(asd);
+		ret = PTR_ERR(asd);
+		goto out_nf_cleanup;
 	}
 
-	fwnode_handle_put(fwnode);
-
 	ret = v4l2_async_nf_register(&csi->notifier);
 	if (ret)
-		v4l2_async_nf_cleanup(&csi->notifier);
+		goto out_nf_cleanup;
+
+	return 0;
+
+out_nf_cleanup:
+	v4l2_async_nf_cleanup(&csi->notifier);
 
 	return ret;
 }