Re: [PATCH v8 3/4] media: i2c: add driver for the SK Hynix Hi-846 8M pixel camera

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Pavel, Martin,

On Fri, Sep 03, 2021 at 06:17:43PM +0200, Pavel Machek wrote:
> > +static void hi846_write_reg_16(struct hi846 *hi846, u16 reg, u16 val, int *err)
> > +{
> > +	struct i2c_client *client = v4l2_get_subdevdata(&hi846->sd);
> > +	u8 buf[6];
> > +	int ret;
> > +
> > +	if (*err < 0)
> > +		return;
> > +
> > +	put_unaligned_be16(reg, buf);
> > +	put_unaligned_be32(val << 8 * 2, buf + 2);
> 
> Is that obfuscated way of saying put_unaligned_be16(val, buf+2); buf[3] = 0; buf[4] = 0; ?

Good catch.

The buf should be only four u8's long, and you should use 16-bit variant
here, too.

Also the transfer should be done on sizeof(buf), not 4 (which indeed is the
same, but cleaner).

-- 
Regards,

Sakari Ailus



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux