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: <20180426065010.a67iqsaicpgu7m5b@valkosipuli.retiisi.org.uk>
Date:   Thu, 26 Apr 2018 09:50:10 +0300
From:   Sakari Ailus <sakari.ailus@....fi>
To:     Todor Tomov <todor.tomov@...aro.org>
Cc:     mchehab@...nel.org, hverkuil@...all.nl,
        laurent.pinchart@...asonboard.com, linux-media@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 2/2] media: Add a driver for the ov7251 camera sensor

Hi Todor,

On Wed, Apr 25, 2018 at 07:20:46PM +0300, Todor Tomov wrote:
...
> +static int ov7251_write_reg(struct ov7251 *ov7251, u16 reg, u8 val)
> +{
> +	u8 regbuf[3];
> +	int ret;
> +
> +	regbuf[0] = reg >> 8;
> +	regbuf[1] = reg & 0xff;
> +	regbuf[2] = val;
> +
> +	ret = i2c_master_send(ov7251->i2c_client, regbuf, 3);
> +	if (ret < 0) {
> +		dev_err(ov7251->dev, "%s: write reg error %d: reg=%x, val=%x\n",
> +			__func__, ret, reg, val);
> +		return ret;
> +	}
> +
> +	return 0;

How about:

	return ov7251_write_seq_regs(ov7251, reg, &val, 1);

And put the function below ov2751_write_seq_regs().

> +}
> +
> +static int ov7251_write_seq_regs(struct ov7251 *ov7251, u16 reg, u8 *val,
> +				 u8 num)
> +{
> +	const u8 maxregbuf = 5;
> +	u8 regbuf[maxregbuf];
> +	u8 nregbuf = sizeof(reg) + num * sizeof(*val);
> +	int ret = 0;
> +
> +	if (nregbuf > maxregbuf)
> +		return -EINVAL;
> +
> +	regbuf[0] = reg >> 8;
> +	regbuf[1] = reg & 0xff;
> +
> +	memcpy(regbuf + 2, val, num);
> +
> +	ret = i2c_master_send(ov7251->i2c_client, regbuf, nregbuf);
> +	if (ret < 0) {
> +		dev_err(ov7251->dev, "%s: write seq regs error %d: first reg=%x\n",

This line is over 80... 

If you're happy with these, I can make the changes, too; they're trivial.

> +			__func__, ret, reg);
> +		return ret;
> +	}
> +
> +	return 0;
> +}

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ailus@....fi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ