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]
Date:   Fri, 11 Aug 2023 12:46:19 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Mehdi Djait <mehdi.djait.k@...il.com>
Cc:     jic23@...nel.org, mazziesaccount@...il.com,
        krzysztof.kozlowski+dt@...aro.org, robh+dt@...nel.org,
        lars@...afoo.de, linux-iio@...r.kernel.org,
        linux-kernel@...r.kernel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH v7 5/7] iio: accel: kionix-kx022a: Refactor driver and
 add chip_info structure

On Wed, Aug 09, 2023 at 09:11:36PM +0200, Mehdi Djait wrote:
> Add the chip_info structure to the driver's private data to hold all
> the device specific infos.
> Refactor the kx022a driver implementation to make it more generic and
> extensible.

...

> +	chip_info = device_get_match_data(&i2c->dev);
> +	if (!chip_info) {
> +		const struct i2c_device_id *id = i2c_client_get_device_id(i2c);

Missing blank line.

> +		chip_info = (const struct kx022a_chip_info *)id->driver_data;
> +		if (!chip_info)
> +			return -EINVAL;
> +	}

...

> -	if (val > KX022A_FIFO_LENGTH)
> -		val = KX022A_FIFO_LENGTH;
> +	val = min_t(unsigned int, data->chip_info->fifo_length, val);

min_t() is a beast. Please, use min() if no special requirement for
min_t() here, otherwise explain why.

...

> +	data->fifo_buffer = kmalloc(data->chip_info->fifo_length *
> +				    KX022A_FIFO_SAMPLES_SIZE_BYTES, GFP_KERNEL);

kmalloc_array()

> +	if (!data->fifo_buffer)
> +		return -ENOMEM;

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ