* [PATCH v3] media: i2c: imx219: Drop manual fwnode_handle_put() via scope-based cleanup
[not found] <20260616081517.44685-4-birenpandya@gmail.com>
@ 2026-07-08 13:17 ` Biren Pandya
0 siblings, 0 replies; only message in thread
From: Biren Pandya @ 2026-07-08 13:17 UTC (permalink / raw)
To: sakari.ailus, dave.stevenson, mchehab, linux-media, linux-kernel
Cc: Biren Pandya
Utilize the __free(fwnode_handle) scoped guard macro from
<linux/cleanup.h> to automate the lifecycle management of the endpoint
fwnode in imx219_check_hwcfg().
This inherently guarantees that the endpoint node is released when it
goes out of scope. Consequently, the manual fwnode_handle_put() call
in the error_out label is no longer needed and has been removed.
Signed-off-by: Biren Pandya <birenpandya@gmail.com>
v3: picked up Reviewed-by tag.
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
v3: picked up Reviewed-by tag.
---
drivers/media/i2c/imx219.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c
index 7da02ce5da154..d76eae880d730 100644
--- a/drivers/media/i2c/imx219.c
+++ b/drivers/media/i2c/imx219.c
@@ -14,6 +14,7 @@
*
*/
+#include <linux/cleanup.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
@@ -1110,7 +1111,7 @@ static int imx219_identify_module(struct imx219 *imx219)
static int imx219_check_hwcfg(struct device *dev, struct imx219 *imx219)
{
- struct fwnode_handle *endpoint;
+ struct fwnode_handle *endpoint __free(fwnode_handle) = NULL;
struct v4l2_fwnode_endpoint ep_cfg = {
.bus_type = V4L2_MBUS_CSI2_DPHY
};
@@ -1172,7 +1173,6 @@ static int imx219_check_hwcfg(struct device *dev, struct imx219 *imx219)
error_out:
v4l2_fwnode_endpoint_free(&ep_cfg);
- fwnode_handle_put(endpoint);
return ret;
}
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] only message in thread