4th set of IIO fixes for 6.1
Single patch fixing a memory leak in an error path. Fine to queue either for 6.2 if too late for 6.1 -----BEGIN PGP SIGNATURE----- iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAmOCXEIRHGppYzIzQGtl cm5lbC5vcmcACgkQVIU0mcT0FoiA7A//bUZgsgl+z9sM6azIqAMDI6efDubi5D5L +anh1rnyScocgweTI65uMuafWkBvajy0U7ugXC5TO06BoZNRKj9RMKBTbCBWmOoF 8laRbffjiKcxZzpVm/kPZZI+vW9Ijq7/mWS16Jc/rKNrLtSN9nobLbwibJ4WwPzc LfjTAXwEDvzdXDqCo3F7z5/cPRWdv/GPtgGEYhPQkTGEY1zSZhZ9lG60Ed2NfABu VGz4ZAkr4XBFWtBlXoKegr1t/0Ulb/D8hA0p4eCCPDgSNCszhBApTCF6c8quZz8U 2KmRfi3nJSUNnOigl2gfAzS/HN3WQF9U3m8l8VwGdAo5+qOs4hx0fxb3LZf2Lg3M 4GqYtYgAi8fI9pDvkbODH47yCQYau0FSEytgoGfEXQvSAiRiwqc4jlKZYZ/fiS6G JYIcG1zWXpclmq5ugCFB6vSZKBP3chqplPnOD8Wt/QYCsskkejt2HPuqLYcZH3EQ 8PfPhKFD2qtlgrYiCjKdkVZlChNeTEXbAHa9nIDSMyhxKMfKvZ9s3vY9w0Z/gpOC NzWEesKSj8mfKaWnl3I7k/DvhPyVFw2jzHRZHhd0tmGEaV/GUl0WViWUpgz+G0aG c7c87SvDk3bbRLlnnqe6Qb+u9yZNnZjqXHhNHODUk8Iok2Hv+WILX005XoZmvs/1 LWRfgMJS84A= =38dX -----END PGP SIGNATURE----- Merge tag 'iio-fixes-for-6.1d' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next Jonathan writes: 4th set of IIO fixes for 6.1 Single patch fixing a memory leak in an error path. Fine to queue either for 6.2 if too late for 6.1 * tag 'iio-fixes-for-6.1d' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: iio: fix memory leak in iio_device_register_eventset() dt-bindings: iio: adc: Remove the property "aspeed,trim-data-valid" iio: adc: aspeed: Remove the trim valid dts property. iio: core: Fix entry not deleted when iio_register_sw_trigger_type() fails iio: accel: bma400: Fix memory leak in bma400_get_steps_reg() iio: light: rpr0521: add missing Kconfig dependencies iio: health: afe4404: Fix oob read in afe4404_[read|write]_raw iio: health: afe4403: Fix oob read in afe4403_read_raw iio: light: apds9960: fix wrong register for gesture gain
This commit is contained in:
Коммит
6e6df27064
|
@ -62,13 +62,6 @@ properties:
|
|||
description:
|
||||
Inform the driver that last channel will be used to sensor battery.
|
||||
|
||||
aspeed,trim-data-valid:
|
||||
type: boolean
|
||||
description: |
|
||||
The ADC reference voltage can be calibrated to obtain the trimming
|
||||
data which will be stored in otp. This property informs the driver that
|
||||
the data store in the otp is valid.
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
|
|
|
@ -805,8 +805,10 @@ static int bma400_get_steps_reg(struct bma400_data *data, int *val)
|
|||
|
||||
ret = regmap_bulk_read(data->regmap, BMA400_STEP_CNT0_REG,
|
||||
steps_raw, BMA400_STEP_RAW_LEN);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
kfree(steps_raw);
|
||||
return ret;
|
||||
}
|
||||
*val = get_unaligned_le24(steps_raw);
|
||||
kfree(steps_raw);
|
||||
return IIO_VAL_INT;
|
||||
|
|
|
@ -202,6 +202,8 @@ static int aspeed_adc_set_trim_data(struct iio_dev *indio_dev)
|
|||
((scu_otp) &
|
||||
(data->model_data->trim_locate->field)) >>
|
||||
__ffs(data->model_data->trim_locate->field);
|
||||
if (!trimming_val)
|
||||
trimming_val = 0x8;
|
||||
}
|
||||
dev_dbg(data->dev,
|
||||
"trimming val = %d, offset = %08x, fields = %08x\n",
|
||||
|
@ -563,12 +565,9 @@ static int aspeed_adc_probe(struct platform_device *pdev)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (of_find_property(data->dev->of_node, "aspeed,trim-data-valid",
|
||||
NULL)) {
|
||||
ret = aspeed_adc_set_trim_data(indio_dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (of_find_property(data->dev->of_node, "aspeed,battery-sensing",
|
||||
NULL)) {
|
||||
|
|
|
@ -245,14 +245,14 @@ static int afe4403_read_raw(struct iio_dev *indio_dev,
|
|||
int *val, int *val2, long mask)
|
||||
{
|
||||
struct afe4403_data *afe = iio_priv(indio_dev);
|
||||
unsigned int reg = afe4403_channel_values[chan->address];
|
||||
unsigned int field = afe4403_channel_leds[chan->address];
|
||||
unsigned int reg, field;
|
||||
int ret;
|
||||
|
||||
switch (chan->type) {
|
||||
case IIO_INTENSITY:
|
||||
switch (mask) {
|
||||
case IIO_CHAN_INFO_RAW:
|
||||
reg = afe4403_channel_values[chan->address];
|
||||
ret = afe4403_read(afe, reg, val);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
@ -262,6 +262,7 @@ static int afe4403_read_raw(struct iio_dev *indio_dev,
|
|||
case IIO_CURRENT:
|
||||
switch (mask) {
|
||||
case IIO_CHAN_INFO_RAW:
|
||||
field = afe4403_channel_leds[chan->address];
|
||||
ret = regmap_field_read(afe->fields[field], val);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
|
|
@ -250,20 +250,20 @@ static int afe4404_read_raw(struct iio_dev *indio_dev,
|
|||
int *val, int *val2, long mask)
|
||||
{
|
||||
struct afe4404_data *afe = iio_priv(indio_dev);
|
||||
unsigned int value_reg = afe4404_channel_values[chan->address];
|
||||
unsigned int led_field = afe4404_channel_leds[chan->address];
|
||||
unsigned int offdac_field = afe4404_channel_offdacs[chan->address];
|
||||
unsigned int value_reg, led_field, offdac_field;
|
||||
int ret;
|
||||
|
||||
switch (chan->type) {
|
||||
case IIO_INTENSITY:
|
||||
switch (mask) {
|
||||
case IIO_CHAN_INFO_RAW:
|
||||
value_reg = afe4404_channel_values[chan->address];
|
||||
ret = regmap_read(afe->regmap, value_reg, val);
|
||||
if (ret)
|
||||
return ret;
|
||||
return IIO_VAL_INT;
|
||||
case IIO_CHAN_INFO_OFFSET:
|
||||
offdac_field = afe4404_channel_offdacs[chan->address];
|
||||
ret = regmap_field_read(afe->fields[offdac_field], val);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
@ -273,6 +273,7 @@ static int afe4404_read_raw(struct iio_dev *indio_dev,
|
|||
case IIO_CURRENT:
|
||||
switch (mask) {
|
||||
case IIO_CHAN_INFO_RAW:
|
||||
led_field = afe4404_channel_leds[chan->address];
|
||||
ret = regmap_field_read(afe->fields[led_field], val);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
@ -295,19 +296,20 @@ static int afe4404_write_raw(struct iio_dev *indio_dev,
|
|||
int val, int val2, long mask)
|
||||
{
|
||||
struct afe4404_data *afe = iio_priv(indio_dev);
|
||||
unsigned int led_field = afe4404_channel_leds[chan->address];
|
||||
unsigned int offdac_field = afe4404_channel_offdacs[chan->address];
|
||||
unsigned int led_field, offdac_field;
|
||||
|
||||
switch (chan->type) {
|
||||
case IIO_INTENSITY:
|
||||
switch (mask) {
|
||||
case IIO_CHAN_INFO_OFFSET:
|
||||
offdac_field = afe4404_channel_offdacs[chan->address];
|
||||
return regmap_field_write(afe->fields[offdac_field], val);
|
||||
}
|
||||
break;
|
||||
case IIO_CURRENT:
|
||||
switch (mask) {
|
||||
case IIO_CHAN_INFO_RAW:
|
||||
led_field = afe4404_channel_leds[chan->address];
|
||||
return regmap_field_write(afe->fields[led_field], val);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -556,7 +556,7 @@ int iio_device_register_eventset(struct iio_dev *indio_dev)
|
|||
|
||||
ret = iio_device_register_sysfs_group(indio_dev, &ev_int->group);
|
||||
if (ret)
|
||||
goto error_free_setup_event_lines;
|
||||
goto error_free_group_attrs;
|
||||
|
||||
ev_int->ioctl_handler.ioctl = iio_event_ioctl;
|
||||
iio_device_ioctl_handler_register(&iio_dev_opaque->indio_dev,
|
||||
|
@ -564,6 +564,8 @@ int iio_device_register_eventset(struct iio_dev *indio_dev)
|
|||
|
||||
return 0;
|
||||
|
||||
error_free_group_attrs:
|
||||
kfree(ev_int->group.attrs);
|
||||
error_free_setup_event_lines:
|
||||
iio_free_chan_devattr_list(&ev_int->dev_attr_list);
|
||||
kfree(ev_int);
|
||||
|
|
|
@ -58,8 +58,12 @@ int iio_register_sw_trigger_type(struct iio_sw_trigger_type *t)
|
|||
|
||||
t->group = configfs_register_default_group(iio_triggers_group, t->name,
|
||||
&iio_trigger_type_group_type);
|
||||
if (IS_ERR(t->group))
|
||||
if (IS_ERR(t->group)) {
|
||||
mutex_lock(&iio_trigger_types_lock);
|
||||
list_del(&t->list);
|
||||
mutex_unlock(&iio_trigger_types_lock);
|
||||
ret = PTR_ERR(t->group);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -293,6 +293,8 @@ config RPR0521
|
|||
tristate "ROHM RPR0521 ALS and proximity sensor driver"
|
||||
depends on I2C
|
||||
select REGMAP_I2C
|
||||
select IIO_BUFFER
|
||||
select IIO_TRIGGERED_BUFFER
|
||||
help
|
||||
Say Y here if you want to build support for ROHM's RPR0521
|
||||
ambient light and proximity sensor device.
|
||||
|
|
|
@ -54,9 +54,6 @@
|
|||
#define APDS9960_REG_CONTROL_PGAIN_MASK_SHIFT 2
|
||||
|
||||
#define APDS9960_REG_CONFIG_2 0x90
|
||||
#define APDS9960_REG_CONFIG_2_GGAIN_MASK 0x60
|
||||
#define APDS9960_REG_CONFIG_2_GGAIN_MASK_SHIFT 5
|
||||
|
||||
#define APDS9960_REG_ID 0x92
|
||||
|
||||
#define APDS9960_REG_STATUS 0x93
|
||||
|
@ -77,6 +74,9 @@
|
|||
#define APDS9960_REG_GCONF_1_GFIFO_THRES_MASK_SHIFT 6
|
||||
|
||||
#define APDS9960_REG_GCONF_2 0xa3
|
||||
#define APDS9960_REG_GCONF_2_GGAIN_MASK 0x60
|
||||
#define APDS9960_REG_GCONF_2_GGAIN_MASK_SHIFT 5
|
||||
|
||||
#define APDS9960_REG_GOFFSET_U 0xa4
|
||||
#define APDS9960_REG_GOFFSET_D 0xa5
|
||||
#define APDS9960_REG_GPULSE 0xa6
|
||||
|
@ -400,9 +400,9 @@ static int apds9960_set_pxs_gain(struct apds9960_data *data, int val)
|
|||
}
|
||||
|
||||
ret = regmap_update_bits(data->regmap,
|
||||
APDS9960_REG_CONFIG_2,
|
||||
APDS9960_REG_CONFIG_2_GGAIN_MASK,
|
||||
idx << APDS9960_REG_CONFIG_2_GGAIN_MASK_SHIFT);
|
||||
APDS9960_REG_GCONF_2,
|
||||
APDS9960_REG_GCONF_2_GGAIN_MASK,
|
||||
idx << APDS9960_REG_GCONF_2_GGAIN_MASK_SHIFT);
|
||||
if (!ret)
|
||||
data->pxs_gain = idx;
|
||||
mutex_unlock(&data->lock);
|
||||
|
|
Загрузка…
Ссылка в новой задаче