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: <20181105105841.GJ20885@w540>
Date:   Mon, 5 Nov 2018 11:58:41 +0100
From:   jacopo mondi <jacopo@...ndi.org>
To:     Lubomir Rintel <lkundrak@...sk>
Cc:     Jonathan Corbet <corbet@....net>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
        stable@...r.kernel.org
Subject: Re: [PATCH] [media] ov7670: make "xclk" clock optional

Hi Lubomir,
   +Sakari in Cc

I just noticed this, and the patch is now in v4.20, but let me comment
anyway on this.

On Thu, Oct 04, 2018 at 11:29:03PM +0200, Lubomir Rintel wrote:
> When the "xclk" clock was added, it was made mandatory. This broke the
> driver on an OLPC plaform which doesn't know such clock. Make it
> optional.
>

I don't think this is correct. The sensor needs a clock to work.

With this patch clock_speed which is used to calculate
the framerate is defaulted to 30MHz, crippling all the calculations if
that default value doesn't match what is actually installed on the
board.

If this patch breaks the OLPC, then might it be the DTS for said
device needs to be fixed instead of working around the issue here?

Also, the DT bindings should be updated too if we decide this property
can be omitted. At this point, with a follow-up patch.

Thanks
   j

> Tested on a OLPC XO-1 laptop.
>
> Cc: stable@...r.kernel.org # 4.11+
> Fixes: 0a024d634cee ("[media] ov7670: get xclk")
> Signed-off-by: Lubomir Rintel <lkundrak@...sk>
> ---
>  drivers/media/i2c/ov7670.c | 27 +++++++++++++++++----------
>  1 file changed, 17 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c
> index 31bf577b0bd3..64d1402882c8 100644
> --- a/drivers/media/i2c/ov7670.c
> +++ b/drivers/media/i2c/ov7670.c
> @@ -1808,17 +1808,24 @@ static int ov7670_probe(struct i2c_client *client,
>  			info->pclk_hb_disable = true;
>  	}
>
> -	info->clk = devm_clk_get(&client->dev, "xclk");
> -	if (IS_ERR(info->clk))
> -		return PTR_ERR(info->clk);
> -	ret = clk_prepare_enable(info->clk);
> -	if (ret)
> -		return ret;
> +	info->clk = devm_clk_get(&client->dev, "xclk"); /* optional */
> +	if (IS_ERR(info->clk)) {
> +		ret = PTR_ERR(info->clk);
> +		if (ret == -ENOENT)
> +			info->clk = NULL;
> +		else
> +			return ret;
> +	}
> +	if (info->clk) {
> +		ret = clk_prepare_enable(info->clk);
> +		if (ret)
> +			return ret;
>
> -	info->clock_speed = clk_get_rate(info->clk) / 1000000;
> -	if (info->clock_speed < 10 || info->clock_speed > 48) {
> -		ret = -EINVAL;
> -		goto clk_disable;
> +		info->clock_speed = clk_get_rate(info->clk) / 1000000;
> +		if (info->clock_speed < 10 || info->clock_speed > 48) {
> +			ret = -EINVAL;
> +			goto clk_disable;
> +		}
>  	}
>
>  	ret = ov7670_init_gpio(client, info);
> --
> 2.19.0
>

Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ