Re: [PATCH 11/11] media: exynos4-is: Correct parallel port probing

From: Tomasz Figa
Date: Tue Jul 07 2020 - 14:48:14 EST


Hi Jonathan,

On Sat, Apr 25, 2020 at 07:26:50PM -0700, Jonathan Bakker wrote:
> According to the binding doc[1], port A should be reg = 0
> and port B reg = 1. Unfortunately, the driver was treating 0
> as invalid and 1 as camera port A. Match the binding doc and
> make 0=A and 1=B.
>
> [1] Documentation/devicetree/bindings/media/samsung-fimc.txt
>
> Signed-off-by: Jonathan Bakker <xc-racer2@xxxxxxx>
> ---
> drivers/media/platform/exynos4-is/media-dev.c | 18 +++++++++++++-----
> drivers/media/platform/exynos4-is/media-dev.h | 1 +
> include/media/drv-intf/exynos-fimc.h | 2 +-
> 3 files changed, 15 insertions(+), 6 deletions(-)
>

Thank you for the patch. Please see my comments inline.

> diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c
> index a87ebd7913be..9c4fdf726b92 100644
> --- a/drivers/media/platform/exynos4-is/media-dev.c
> +++ b/drivers/media/platform/exynos4-is/media-dev.c
> @@ -418,13 +418,21 @@ static int fimc_md_parse_port_node(struct fimc_md *fmd,
> return ret;
> }
>
> - if (WARN_ON(endpoint.base.port == 0) || *index >= FIMC_MAX_SENSORS) {
> - of_node_put(ep);
> - return -EINVAL;
> + if (fimc_input_is_parallel(endpoint.base.port)) {
> + if (WARN_ON(*index >= FIMC_MAX_PARALLEL)) {
> + of_node_put(ep);
> + return -EINVAL;
> + }

This check seems to be generic, so could we just move it above the
if/else block?

> + pd->mux_id = endpoint.base.port;
> + } else {
> + if (WARN_ON(endpoint.base.port == 0 ||

Isn't this impossible, since if port == 0, the 'then' branch would've been
taken instead?

Best regards,
Tomasz