mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 23:52:08 +02:00
media: nxp: use cleanup __free(fwnode_handle) simplify code
Use cleanup __free(fwnode_handle) simplify code. No functional change. Signed-off-by: Frank Li <Frank.Li@nxp.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Link: https://patch.msgid.link/20260116-cam_cleanup-v4-3-29ce01640443@nxp.com Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
parent
078161dd44
commit
e001b3b1cd
|
|
@ -12,6 +12,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <linux/cleanup.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/delay.h>
|
||||
|
|
@ -1349,27 +1350,26 @@ static int mipi_csis_async_register(struct mipi_csis_device *csis)
|
|||
.bus_type = V4L2_MBUS_CSI2_DPHY,
|
||||
};
|
||||
struct v4l2_async_connection *asd;
|
||||
struct fwnode_handle *ep;
|
||||
unsigned int i;
|
||||
int ret;
|
||||
|
||||
v4l2_async_subdev_nf_init(&csis->notifier, &csis->sd);
|
||||
|
||||
ep = fwnode_graph_get_endpoint_by_id(dev_fwnode(csis->dev), 0, 0,
|
||||
FWNODE_GRAPH_ENDPOINT_NEXT);
|
||||
struct fwnode_handle *ep __free(fwnode_handle) =
|
||||
fwnode_graph_get_endpoint_by_id(dev_fwnode(csis->dev), 0, 0,
|
||||
FWNODE_GRAPH_ENDPOINT_NEXT);
|
||||
if (!ep)
|
||||
return -ENOTCONN;
|
||||
|
||||
ret = v4l2_fwnode_endpoint_parse(ep, &vep);
|
||||
if (ret)
|
||||
goto err_parse;
|
||||
return ret;
|
||||
|
||||
for (i = 0; i < vep.bus.mipi_csi2.num_data_lanes; ++i) {
|
||||
if (vep.bus.mipi_csi2.data_lanes[i] != i + 1) {
|
||||
dev_err(csis->dev,
|
||||
"data lanes reordering is not supported");
|
||||
ret = -EINVAL;
|
||||
goto err_parse;
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1381,12 +1381,8 @@ static int mipi_csis_async_register(struct mipi_csis_device *csis)
|
|||
|
||||
asd = v4l2_async_nf_add_fwnode_remote(&csis->notifier, ep,
|
||||
struct v4l2_async_connection);
|
||||
if (IS_ERR(asd)) {
|
||||
ret = PTR_ERR(asd);
|
||||
goto err_parse;
|
||||
}
|
||||
|
||||
fwnode_handle_put(ep);
|
||||
if (IS_ERR(asd))
|
||||
return PTR_ERR(asd);
|
||||
|
||||
csis->notifier.ops = &mipi_csis_notify_ops;
|
||||
|
||||
|
|
@ -1395,11 +1391,6 @@ static int mipi_csis_async_register(struct mipi_csis_device *csis)
|
|||
return ret;
|
||||
|
||||
return v4l2_async_register_subdev(&csis->sd);
|
||||
|
||||
err_parse:
|
||||
fwnode_handle_put(ep);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
#include <linux/bitfield.h>
|
||||
#include <linux/cleanup.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/delay.h>
|
||||
|
|
@ -717,27 +718,26 @@ static int imx8mq_mipi_csi_async_register(struct csi_state *state)
|
|||
.bus_type = V4L2_MBUS_CSI2_DPHY,
|
||||
};
|
||||
struct v4l2_async_connection *asd;
|
||||
struct fwnode_handle *ep;
|
||||
unsigned int i;
|
||||
int ret;
|
||||
|
||||
v4l2_async_subdev_nf_init(&state->notifier, &state->sd);
|
||||
|
||||
ep = fwnode_graph_get_endpoint_by_id(dev_fwnode(state->dev), 0, 0,
|
||||
FWNODE_GRAPH_ENDPOINT_NEXT);
|
||||
struct fwnode_handle *ep __free(fwnode_handle) =
|
||||
fwnode_graph_get_endpoint_by_id(dev_fwnode(state->dev), 0, 0,
|
||||
FWNODE_GRAPH_ENDPOINT_NEXT);
|
||||
if (!ep)
|
||||
return -ENOTCONN;
|
||||
|
||||
ret = v4l2_fwnode_endpoint_parse(ep, &vep);
|
||||
if (ret)
|
||||
goto err_parse;
|
||||
return ret;
|
||||
|
||||
for (i = 0; i < vep.bus.mipi_csi2.num_data_lanes; ++i) {
|
||||
if (vep.bus.mipi_csi2.data_lanes[i] != i + 1) {
|
||||
dev_err(state->dev,
|
||||
"data lanes reordering is not supported");
|
||||
ret = -EINVAL;
|
||||
goto err_parse;
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -749,12 +749,8 @@ static int imx8mq_mipi_csi_async_register(struct csi_state *state)
|
|||
|
||||
asd = v4l2_async_nf_add_fwnode_remote(&state->notifier, ep,
|
||||
struct v4l2_async_connection);
|
||||
if (IS_ERR(asd)) {
|
||||
ret = PTR_ERR(asd);
|
||||
goto err_parse;
|
||||
}
|
||||
|
||||
fwnode_handle_put(ep);
|
||||
if (IS_ERR(asd))
|
||||
return PTR_ERR(asd);
|
||||
|
||||
state->notifier.ops = &imx8mq_mipi_csi_notify_ops;
|
||||
|
||||
|
|
@ -763,11 +759,6 @@ static int imx8mq_mipi_csi_async_register(struct csi_state *state)
|
|||
return ret;
|
||||
|
||||
return v4l2_async_register_subdev(&state->sd);
|
||||
|
||||
err_parse:
|
||||
fwnode_handle_put(ep);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user