mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-18 15:51:20 -04:00
media: nxp: Add dev_err_probe() to all error paths in *async_register() helpers
Add dev_err_probe() to all error branches in the *async_register() helpers to provide clearer diagnostic information when device registration fails. Drop the explicit error message after returning from mipi_csis_async_register(), as the error is already reported by this helper. Signed-off-by: Frank Li <Frank.Li@nxp.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Link: https://patch.msgid.link/20260121-cam_cleanup-v5-1-01d1ab38db9d@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:
@@ -1359,18 +1359,18 @@ static int mipi_csis_async_register(struct mipi_csis_device *csis)
|
||||
fwnode_graph_get_endpoint_by_id(dev_fwnode(csis->dev), 0, 0,
|
||||
FWNODE_GRAPH_ENDPOINT_NEXT);
|
||||
if (!ep)
|
||||
return -ENOTCONN;
|
||||
return dev_err_probe(csis->dev, -ENOTCONN,
|
||||
"failed to get local endpoint\n");
|
||||
|
||||
ret = v4l2_fwnode_endpoint_parse(ep, &vep);
|
||||
if (ret)
|
||||
return ret;
|
||||
return dev_err_probe(csis->dev, ret,
|
||||
"failed to parse endpoint\n");
|
||||
|
||||
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");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (vep.bus.mipi_csi2.data_lanes[i] != i + 1)
|
||||
return dev_err_probe(csis->dev, -EINVAL,
|
||||
"data lanes reordering is not supported\n");
|
||||
}
|
||||
|
||||
csis->bus = vep.bus.mipi_csi2;
|
||||
@@ -1382,15 +1382,22 @@ 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))
|
||||
return PTR_ERR(asd);
|
||||
return dev_err_probe(csis->dev, PTR_ERR(asd),
|
||||
"failed to add remote fwnode to notifier\n");
|
||||
|
||||
csis->notifier.ops = &mipi_csis_notify_ops;
|
||||
|
||||
ret = v4l2_async_nf_register(&csis->notifier);
|
||||
if (ret)
|
||||
return ret;
|
||||
return dev_err_probe(csis->dev, ret,
|
||||
"failed to register notifier\n");
|
||||
|
||||
return v4l2_async_register_subdev(&csis->sd);
|
||||
ret = v4l2_async_register_subdev(&csis->sd);
|
||||
if (ret)
|
||||
return dev_err_probe(csis->dev, ret,
|
||||
"failed to register subdev\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
@@ -1549,10 +1556,8 @@ static int mipi_csis_probe(struct platform_device *pdev)
|
||||
platform_set_drvdata(pdev, &csis->sd);
|
||||
|
||||
ret = mipi_csis_async_register(csis);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "async register failed: %d\n", ret);
|
||||
if (ret < 0)
|
||||
goto err_cleanup;
|
||||
}
|
||||
|
||||
/* Initialize debugfs. */
|
||||
mipi_csis_debugfs_init(csis);
|
||||
|
||||
@@ -727,18 +727,18 @@ static int imx8mq_mipi_csi_async_register(struct csi_state *state)
|
||||
fwnode_graph_get_endpoint_by_id(dev_fwnode(state->dev), 0, 0,
|
||||
FWNODE_GRAPH_ENDPOINT_NEXT);
|
||||
if (!ep)
|
||||
return -ENOTCONN;
|
||||
return dev_err_probe(state->dev, -ENOTCONN,
|
||||
"failed to get local endpoint fwnode\n");
|
||||
|
||||
ret = v4l2_fwnode_endpoint_parse(ep, &vep);
|
||||
if (ret)
|
||||
return ret;
|
||||
return dev_err_probe(state->dev, ret,
|
||||
"failed to parse endpoint\n");
|
||||
|
||||
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");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (vep.bus.mipi_csi2.data_lanes[i] != i + 1)
|
||||
return dev_err_probe(state->dev, -EINVAL,
|
||||
"data lanes reordering is not supported");
|
||||
}
|
||||
|
||||
state->bus = vep.bus.mipi_csi2;
|
||||
@@ -750,15 +750,22 @@ 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))
|
||||
return PTR_ERR(asd);
|
||||
return dev_err_probe(state->dev, PTR_ERR(asd),
|
||||
"failed to add fwnode to notifier\n");
|
||||
|
||||
state->notifier.ops = &imx8mq_mipi_csi_notify_ops;
|
||||
|
||||
ret = v4l2_async_nf_register(&state->notifier);
|
||||
if (ret)
|
||||
return ret;
|
||||
return dev_err_probe(state->dev, ret,
|
||||
"failed to register notifier\n");
|
||||
|
||||
return v4l2_async_register_subdev(&state->sd);
|
||||
ret = v4l2_async_register_subdev(&state->sd);
|
||||
if (ret)
|
||||
return dev_err_probe(state->dev, ret,
|
||||
"failed to register subdev\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user