diff mbox series

[5/5] media: i2c: imx335: Improve configuration error reporting

Message ID 20231010005126.3425444-6-kieran.bingham@ideasonboard.com (mailing list archive)
State New, archived
Headers show
Series media: Sony IMX335 improvements | expand

Commit Message

Kieran Bingham Oct. 10, 2023, 12:51 a.m. UTC
The existing imx335_parse_hw_config function has two paths
that can be taken without reporting to the user the reason
for failing to accept the hardware configuration.

Extend the error reporting paths to identify failures when
probing the device.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 drivers/media/i2c/imx335.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Umang Jain Oct. 10, 2023, 3:36 a.m. UTC | #1
Hi Kieran,

Thank you for the patch.

On 10/10/23 6:21 AM, Kieran Bingham wrote:
> The existing imx335_parse_hw_config function has two paths
> that can be taken without reporting to the user the reason
> for failing to accept the hardware configuration.
>
> Extend the error reporting paths to identify failures when
> probing the device.
>
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> ---
>   drivers/media/i2c/imx335.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/i2c/imx335.c b/drivers/media/i2c/imx335.c
> index 1a34b2a43718..753e5c39e0fa 100644
> --- a/drivers/media/i2c/imx335.c
> +++ b/drivers/media/i2c/imx335.c
> @@ -864,8 +864,10 @@ static int imx335_parse_hw_config(struct imx335 *imx335)
>   	}
>   
>   	ep = fwnode_graph_get_next_endpoint(fwnode, NULL);
> -	if (!ep)
> +	if (!ep) {
> +		dev_err(imx335->dev, "Failed to get next endpoint");

missing '\n' at the end.
>   		return -ENXIO;
> +	}
>   
>   	ret = v4l2_fwnode_endpoint_alloc_parse(ep, &bus_cfg);
>   	fwnode_handle_put(ep);
> @@ -890,6 +892,8 @@ static int imx335_parse_hw_config(struct imx335 *imx335)
>   		if (bus_cfg.link_frequencies[i] == IMX335_LINK_FREQ)
>   			goto done_endpoint_free;
>   
> +	dev_err(imx335->dev, "no compatible link frequencies found");

Ditto.

Other than that,

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>

> +
>   	ret = -EINVAL;
>   
>   done_endpoint_free:
diff mbox series

Patch

diff --git a/drivers/media/i2c/imx335.c b/drivers/media/i2c/imx335.c
index 1a34b2a43718..753e5c39e0fa 100644
--- a/drivers/media/i2c/imx335.c
+++ b/drivers/media/i2c/imx335.c
@@ -864,8 +864,10 @@  static int imx335_parse_hw_config(struct imx335 *imx335)
 	}
 
 	ep = fwnode_graph_get_next_endpoint(fwnode, NULL);
-	if (!ep)
+	if (!ep) {
+		dev_err(imx335->dev, "Failed to get next endpoint");
 		return -ENXIO;
+	}
 
 	ret = v4l2_fwnode_endpoint_alloc_parse(ep, &bus_cfg);
 	fwnode_handle_put(ep);
@@ -890,6 +892,8 @@  static int imx335_parse_hw_config(struct imx335 *imx335)
 		if (bus_cfg.link_frequencies[i] == IMX335_LINK_FREQ)
 			goto done_endpoint_free;
 
+	dev_err(imx335->dev, "no compatible link frequencies found");
+
 	ret = -EINVAL;
 
 done_endpoint_free: