From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Frank Li <Frank.Li@nxp.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
Rui Miguel Silva <rmfrfs@gmail.com>,
Martin Kepplinger-Novakovic <martink@posteo.de>,
Purism Kernel Team <kernel@puri.sm>,
linux-media@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 4/4] media: nxp: Add dev_err_probe() to all error paths in *async_register() helpers
Date: Wed, 21 Jan 2026 03:51:27 +0200 [thread overview]
Message-ID: <20260121015127.GC403250@killaraus> (raw)
In-Reply-To: <20260116-cam_cleanup-v4-4-29ce01640443@nxp.com>
Hi Frank,
Thank you for the patch.
On Fri, Jan 16, 2026 at 11:29:22AM -0500, Frank Li wrote:
> 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.
>
> No functional change.
That's not quite exact, there are functional changes.
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
> ---
> change in v2
> - new patch
> ---
> drivers/media/platform/nxp/imx-mipi-csis.c | 31 ++++++++++++++++-----------
> drivers/media/platform/nxp/imx8mq-mipi-csi2.c | 27 ++++++++++++++---------
> 2 files changed, 35 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c
> index 9a43fd1eb0bcee7ac0c47f28ad89012de45a70d9..85098824f4917b3cda3aa71c4ed0a41939283e12 100644
> --- a/drivers/media/platform/nxp/imx-mipi-csis.c
> +++ b/drivers/media/platform/nxp/imx-mipi-csis.c
> @@ -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 remote endpoint\n");
It's not the remote endpoint, but the local endpoint.
>
> 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");
Missing \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 fwmode to notifier\n");
s/fwmode/fwnode/
>
> 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);
> diff --git a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c
> index 9d946b68cf59d9f4fb3413fc90219efd380d9d95..b3b9e9dc8a95c76628d573824c12f9391fb7b4a0 100644
> --- a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c
> +++ b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c
> @@ -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 remote endpoint fwnode\n");
>
> ret = v4l2_fwnode_endpoint_parse(ep, &vep);
> if (ret)
> - return ret;
> + return dev_err_probe(state->dev, ret,
> + "failed parse endpoint fwnode\n");
I'd write
+ "failed to parse endpoint\n");
to match the imx-mipi-csis.c driver.
>
> 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 add fwnode to notifier\n");
s/failed add/failed to add/
>
> 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;
> }
>
> /* -----------------------------------------------------------------------------
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2026-01-21 1:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-16 16:29 [PATCH v4 0/4] media: platform: nxp: Trivial cleanup pathces Frank Li
2026-01-16 16:29 ` [PATCH v4 1/4] media: nxp: use dev_err_probe() to simplify code Frank Li
2026-01-16 16:29 ` [PATCH v4 2/4] media: nxp: imx8-isi: use devm_pm_runtime_enable() " Frank Li
2026-01-21 1:43 ` Laurent Pinchart
2026-01-16 16:29 ` [PATCH v4 3/4] media: nxp: use cleanup __free(fwnode_handle) " Frank Li
2026-01-21 1:45 ` Laurent Pinchart
2026-01-16 16:29 ` [PATCH v4 4/4] media: nxp: Add dev_err_probe() to all error paths in *async_register() helpers Frank Li
2026-01-21 1:51 ` Laurent Pinchart [this message]
2026-01-21 1:55 ` [PATCH v4 0/4] media: platform: nxp: Trivial cleanup pathces Laurent Pinchart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260121015127.GC403250@killaraus \
--to=laurent.pinchart@ideasonboard.com \
--cc=Frank.Li@nxp.com \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=kernel@puri.sm \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=martink@posteo.de \
--cc=mchehab@kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=rmfrfs@gmail.com \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox