diff options
| author | André Apitzsch <git@apitzsch.eu> | 2025-06-30 21:05:23 +0200 |
|---|---|---|
| committer | Hans Verkuil <hverkuil+cisco@kernel.org> | 2025-08-25 15:40:39 +0200 |
| commit | 8bd24a43ccb719d26f7af4a2935a9228a68f785e (patch) | |
| tree | dc4b86c9bb53416c76183018022c9ae71a7335ae | |
| parent | 84aa4d2f59d2db4d96ec633bc4197f2b08d4f14f (diff) | |
media: i2c: imx214: Use __free(fwnode_handle)
Use the __free(fwnode_handle) hook to free the endpoint when the
function exits to simplify the error path.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: André Apitzsch <git@apitzsch.eu>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
| -rw-r--r-- | drivers/media/i2c/imx214.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c index 2baee25368c4..4157f142b59b 100644 --- a/drivers/media/i2c/imx214.c +++ b/drivers/media/i2c/imx214.c @@ -1326,8 +1326,8 @@ static int imx214_identify_module(struct imx214 *imx214) static int imx214_parse_fwnode(struct imx214 *imx214) { + struct fwnode_handle *endpoint __free(fwnode_handle) = NULL; struct v4l2_fwnode_endpoint *bus_cfg = &imx214->bus_cfg; - struct fwnode_handle *endpoint; struct device *dev = imx214->dev; unsigned int i; int ret; @@ -1338,11 +1338,8 @@ static int imx214_parse_fwnode(struct imx214 *imx214) bus_cfg->bus_type = V4L2_MBUS_CSI2_DPHY; ret = v4l2_fwnode_endpoint_alloc_parse(endpoint, bus_cfg); - fwnode_handle_put(endpoint); - if (ret) { - dev_err_probe(dev, ret, "parsing endpoint node failed\n"); - goto error; - } + if (ret) + return dev_err_probe(dev, ret, "parsing endpoint node failed\n"); /* Check the number of MIPI CSI2 data lanes */ if (bus_cfg->bus.mipi_csi2.num_data_lanes != 4) { |