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, 13 May 2022 03:30:49 +0300
From:   Dmitry Osipenko <digetx@...il.com>
To:     Shreeya Patel <shreeya.patel@...labora.com>, jic23@...nel.org,
        lars@...afoo.de, robh+dt@...nel.org, Zhigang.Shi@...eon.com,
        krisman@...labora.com
Cc:     linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org, kernel@...labora.com,
        alvaro.soliverez@...labora.com
Subject: Re: [PATCH v4 3/3] iio: light: Add support for ltrf216a sensor

11.05.2022 12:40, Shreeya Patel пишет:
> +static int ltrf216a_set_int_time(struct ltrf216a_data *data, int itime)
> +{
> +	int i, ret, index = -1;
> +	u8 reg_val;
> +
> +	for (i = 0; i < ARRAY_SIZE(ltrf216a_int_time_available); i++) {
> +		if (ltrf216a_int_time_available[i][1] == itime) {
> +			index = i;
> +			break;
> +		}
> +	}
> +
> +	if (index < 0)
> +		return -EINVAL;
> +
> +	reg_val = ltrf216a_int_time_reg[index][1];
> +	data->int_time_fac = ltrf216a_int_time_reg[index][0];
> +
> +	ret = i2c_smbus_write_byte_data(data->client, LTRF216A_ALS_MEAS_RES, reg_val);
> +	if (ret < 0)
> +		return ret;

Should the data->int_time_fac be updated only if I2C write was successful?

I'm not sure what reading of LTRF216A_CLEAR_DATA reg does, but if it
clears the measured data, then shouldn't the data be cleared after
changing the config?

> +	data->int_time = itime;
> +
> +	return 0;
> +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ