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: <Y+O+tcx9eFfBNjWm@pendragon.ideasonboard.com>
Date:   Wed, 8 Feb 2023 17:24:37 +0200
From:   Laurent Pinchart <laurent.pinchart@...asonboard.com>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     Sakari Ailus <sakari.ailus@...ux.intel.com>,
        Alexander Stein <alexander.stein@...tq-group.com>,
        linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
        Manivannan Sadhasivam <mani@...nel.org>,
        Mauro Carvalho Chehab <mchehab@...nel.org>
Subject: Re: [PATCH v1 1/1] media: i2c: imx290: Make use of
 get_unaligned_le24(), put_unaligned_le24()

Hi Andy,

Thank you for the patch.

On Wed, Feb 08, 2023 at 01:29:57PM +0200, Andy Shevchenko wrote:
> Since we have a proper endianness converters for LE 24-bit data use
> them. While at it, format the code using switch-cases as it's done
> for the rest of the endianness handlers.

I don't see any new switch-case :-)

The rest looks fine.

> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
>  drivers/media/i2c/imx290.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/i2c/imx290.c b/drivers/media/i2c/imx290.c
> index 49d6c8bdec41..330098a0772d 100644
> --- a/drivers/media/i2c/imx290.c
> +++ b/drivers/media/i2c/imx290.c
> @@ -16,6 +16,9 @@
>  #include <linux/pm_runtime.h>
>  #include <linux/regmap.h>
>  #include <linux/regulator/consumer.h>
> +
> +#include <asm/unaligned.h>
> +
>  #include <media/media-entity.h>
>  #include <media/v4l2-ctrls.h>
>  #include <media/v4l2-device.h>
> @@ -466,18 +469,20 @@ static int __always_unused imx290_read(struct imx290 *imx290, u32 addr, u32 *val
>  		return ret;
>  	}
>  
> -	*value = (data[2] << 16) | (data[1] << 8) | data[0];
> +	*value = get_unaligned_le24(data);
>  	return 0;
>  }
>  
>  static int imx290_write(struct imx290 *imx290, u32 addr, u32 value, int *err)
>  {
> -	u8 data[3] = { value & 0xff, (value >> 8) & 0xff, value >> 16 };
> +	u8 data[3];
>  	int ret;
>  
>  	if (err && *err)
>  		return *err;
>  
> +	put_unaligned_le24(value, data);
> +
>  	ret = regmap_raw_write(imx290->regmap, addr & IMX290_REG_ADDR_MASK,
>  			       data, (addr >> IMX290_REG_SIZE_SHIFT) & 3);
>  	if (ret < 0) {

-- 
Regards,

Laurent Pinchart

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ