lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260123000047.GG215800@killaraus>
Date: Fri, 23 Jan 2026 02:00:47 +0200
From: Laurent Pinchart <laurent.pinchart@...asonboard.com>
To: Frank Li <Frank.Li@....com>
Cc: Philipp Zabel <p.zabel@...gutronix.de>,
	Mauro Carvalho Chehab <mchehab@...nel.org>,
	Shawn Guo <shawnguo@...nel.org>,
	Sascha Hauer <s.hauer@...gutronix.de>,
	Pengutronix Kernel Team <kernel@...gutronix.de>,
	Fabio Estevam <festevam@...il.com>,
	Rui Miguel Silva <rmfrfs@...il.com>,
	Martin Kepplinger-Novakovic <martink@...teo.de>,
	Purism Kernel Team <kernel@...i.sm>, linux-media@...r.kernel.org,
	imx@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5] media: nxp: Add dev_err_probe() to all error paths in
 *async_register() helpers

Hi Frank,

Thank you for the patch.

On Wed, Jan 21, 2026 at 03:42:03PM -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.
> 
> Signed-off-by: Frank Li <Frank.Li@....com>
> ---
> Some trivial patch to reduce goto at probe functions.
> ---
> Changes in v5:
> - rebase to https://gitlab.freedesktop.org/linux-media/users/pinchartl.git tags/next-media-nxp-20260120
> - Link to v4: https://lore.kernel.org/r/20260116-cam_cleanup-v4-0-29ce01640443@nxp.com
> 
> Changes in v4:
> - collect alex's review tag
> - fix grammer in error message
> - Link to v3: https://lore.kernel.org/r/20251215-cam_cleanup-v3-0-a61995068f38@nxp.com
> 
> Changes in v3:
> - rebase to v6.19-rc1
> - avoid use __free() == NULL according to cleanup.h
> - Link to v2: https://lore.kernel.org/r/20251119-cam_cleanup-v2-0-df732cc83ff1@nxp.com
> 
> Changes in v2:
> - add new patch media: nxp: Add dev_err_probe() to all error paths in *async_register() helpers
> - detail change see each patch's change log.
> - Link to v1: https://lore.kernel.org/r/20251117-cam_cleanup-v1-0-6cd42872db79@nxp.com
> ---
> Change in v5
> - remove "no functional change" in commit message
> - fix error message.
> 
> 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..06ea96b8eaf61058d6979b7be747496480c4bc69 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 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 fnnode to notifier\n");

s/fnnode/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..8304b3d3a338394d6325929d28aa69d865ac8a92 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");

s/remote/local/

>  
>  	ret = v4l2_fwnode_endpoint_parse(ep, &vep);
>  	if (ret)
> -		return ret;
> +		return dev_err_probe(state->dev, ret,
> +				     "failed to parse endpoint fwnode\n");

s/ fwnode//

to match the message above.

With that,

Reviewed-by: Laurent Pinchart <laurent.pinchart@...asonboard.com>

I'll apply the changes locally, no need to submit a v6.

>  
>  	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;
>  }
>  
>  /* -----------------------------------------------------------------------------
> 
> ---
> base-commit: b7af7c950e1076a9e3d855045571be2de4ce9f2c
> change-id: 20250807-cam_cleanup-b6d90ba9dac3

-- 
Regards,

Laurent Pinchart

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ