Skip to content

Commit d3feaff

Browse files
committed
Merge tag 'char-misc-6.2-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver fixes from Greg KH: "Here are a number of small char/misc/whatever driver fixes. They include: - IIO driver fixes for some reported problems - nvmem driver fixes - fpga driver fixes - debugfs memory leak fix in the hv_balloon and irqdomain code (irqdomain change was acked by the maintainer) All have been in linux-next with no reported problems" * tag 'char-misc-6.2-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (33 commits) kernel/irq/irqdomain.c: fix memory leak with using debugfs_lookup() HV: hv_balloon: fix memory leak with using debugfs_lookup() nvmem: qcom-spmi-sdam: fix module autoloading nvmem: core: fix return value nvmem: core: fix cell removal on error nvmem: core: fix device node refcounting nvmem: core: fix registration vs use race nvmem: core: fix cleanup after dev_set_name() nvmem: core: remove nvmem_config wp_gpio nvmem: core: initialise nvmem->id early nvmem: sunxi_sid: Always use 32-bit MMIO reads nvmem: brcm_nvram: Add check for kzalloc iio: imu: fxos8700: fix MAGN sensor scale and unit iio: imu: fxos8700: remove definition FXOS8700_CTRL_ODR_MIN iio: imu: fxos8700: fix failed initialization ODR mode assignment iio: imu: fxos8700: fix incorrect ODR mode readback iio: light: cm32181: Fix PM support on system with 2 I2C resources iio: hid: fix the retval in gyro_3d_capture_sample iio: hid: fix the retval in accel_3d_capture_sample iio: imu: st_lsm6dsx: fix build when CONFIG_IIO_TRIGGERED_BUFFER=m ...
2 parents 870c3a9 + d83d7ed commit d3feaff

19 files changed

+207
-72
lines changed

drivers/fpga/intel-m10-bmc-sec-update.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -574,20 +574,27 @@ static int m10bmc_sec_probe(struct platform_device *pdev)
574574
len = scnprintf(buf, SEC_UPDATE_LEN_MAX, "secure-update%d",
575575
sec->fw_name_id);
576576
sec->fw_name = kmemdup_nul(buf, len, GFP_KERNEL);
577-
if (!sec->fw_name)
578-
return -ENOMEM;
577+
if (!sec->fw_name) {
578+
ret = -ENOMEM;
579+
goto fw_name_fail;
580+
}
579581

580582
fwl = firmware_upload_register(THIS_MODULE, sec->dev, sec->fw_name,
581583
&m10bmc_ops, sec);
582584
if (IS_ERR(fwl)) {
583585
dev_err(sec->dev, "Firmware Upload driver failed to start\n");
584-
kfree(sec->fw_name);
585-
xa_erase(&fw_upload_xa, sec->fw_name_id);
586-
return PTR_ERR(fwl);
586+
ret = PTR_ERR(fwl);
587+
goto fw_uploader_fail;
587588
}
588589

589590
sec->fwl = fwl;
590591
return 0;
592+
593+
fw_uploader_fail:
594+
kfree(sec->fw_name);
595+
fw_name_fail:
596+
xa_erase(&fw_upload_xa, sec->fw_name_id);
597+
return ret;
591598
}
592599

593600
static int m10bmc_sec_remove(struct platform_device *pdev)

drivers/fpga/stratix10-soc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,9 @@ static int s10_ops_write_init(struct fpga_manager *mgr,
213213
/* Allocate buffers from the service layer's pool. */
214214
for (i = 0; i < NUM_SVC_BUFS; i++) {
215215
kbuf = stratix10_svc_allocate_memory(priv->chan, SVC_BUF_SIZE);
216-
if (!kbuf) {
216+
if (IS_ERR(kbuf)) {
217217
s10_free_buffers(mgr);
218-
ret = -ENOMEM;
218+
ret = PTR_ERR(kbuf);
219219
goto init_done;
220220
}
221221

drivers/hv/hv_balloon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1963,7 +1963,7 @@ static void hv_balloon_debugfs_init(struct hv_dynmem_device *b)
19631963

19641964
static void hv_balloon_debugfs_exit(struct hv_dynmem_device *b)
19651965
{
1966-
debugfs_remove(debugfs_lookup("hv-balloon", NULL));
1966+
debugfs_lookup_and_remove("hv-balloon", NULL);
19671967
}
19681968

19691969
#else

drivers/iio/accel/hid-sensor-accel-3d.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ static int accel_3d_capture_sample(struct hid_sensor_hub_device *hsdev,
280280
hid_sensor_convert_timestamp(
281281
&accel_state->common_attributes,
282282
*(int64_t *)raw_data);
283+
ret = 0;
283284
break;
284285
default:
285286
break;

drivers/iio/adc/berlin2-adc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,10 @@ static int berlin2_adc_probe(struct platform_device *pdev)
298298
int ret;
299299

300300
indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*priv));
301-
if (!indio_dev)
301+
if (!indio_dev) {
302+
of_node_put(parent_np);
302303
return -ENOMEM;
304+
}
303305

304306
priv = iio_priv(indio_dev);
305307

drivers/iio/adc/imx8qxp-adc.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@
8686

8787
#define IMX8QXP_ADC_TIMEOUT msecs_to_jiffies(100)
8888

89+
#define IMX8QXP_ADC_MAX_FIFO_SIZE 16
90+
8991
struct imx8qxp_adc {
9092
struct device *dev;
9193
void __iomem *regs;
@@ -95,6 +97,7 @@ struct imx8qxp_adc {
9597
/* Serialise ADC channel reads */
9698
struct mutex lock;
9799
struct completion completion;
100+
u32 fifo[IMX8QXP_ADC_MAX_FIFO_SIZE];
98101
};
99102

100103
#define IMX8QXP_ADC_CHAN(_idx) { \
@@ -238,8 +241,7 @@ static int imx8qxp_adc_read_raw(struct iio_dev *indio_dev,
238241
return ret;
239242
}
240243

241-
*val = FIELD_GET(IMX8QXP_ADC_RESFIFO_VAL_MASK,
242-
readl(adc->regs + IMX8QXP_ADR_ADC_RESFIFO));
244+
*val = adc->fifo[0];
243245

244246
mutex_unlock(&adc->lock);
245247
return IIO_VAL_INT;
@@ -265,10 +267,15 @@ static irqreturn_t imx8qxp_adc_isr(int irq, void *dev_id)
265267
{
266268
struct imx8qxp_adc *adc = dev_id;
267269
u32 fifo_count;
270+
int i;
268271

269272
fifo_count = FIELD_GET(IMX8QXP_ADC_FCTRL_FCOUNT_MASK,
270273
readl(adc->regs + IMX8QXP_ADR_ADC_FCTRL));
271274

275+
for (i = 0; i < fifo_count; i++)
276+
adc->fifo[i] = FIELD_GET(IMX8QXP_ADC_RESFIFO_VAL_MASK,
277+
readl_relaxed(adc->regs + IMX8QXP_ADR_ADC_RESFIFO));
278+
272279
if (fifo_count)
273280
complete(&adc->completion);
274281

drivers/iio/adc/stm32-dfsdm-adc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,6 +1520,7 @@ static const struct of_device_id stm32_dfsdm_adc_match[] = {
15201520
},
15211521
{}
15221522
};
1523+
MODULE_DEVICE_TABLE(of, stm32_dfsdm_adc_match);
15231524

15241525
static int stm32_dfsdm_adc_probe(struct platform_device *pdev)
15251526
{

drivers/iio/adc/twl6030-gpadc.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,18 @@
5757
#define TWL6030_GPADCS BIT(1)
5858
#define TWL6030_GPADCR BIT(0)
5959

60+
#define USB_VBUS_CTRL_SET 0x04
61+
#define USB_ID_CTRL_SET 0x06
62+
63+
#define TWL6030_MISC1 0xE4
64+
#define VBUS_MEAS 0x01
65+
#define ID_MEAS 0x01
66+
67+
#define VAC_MEAS 0x04
68+
#define VBAT_MEAS 0x02
69+
#define BB_MEAS 0x01
70+
71+
6072
/**
6173
* struct twl6030_chnl_calib - channel calibration
6274
* @gain: slope coefficient for ideal curve
@@ -927,6 +939,26 @@ static int twl6030_gpadc_probe(struct platform_device *pdev)
927939
return ret;
928940
}
929941

942+
ret = twl_i2c_write_u8(TWL_MODULE_USB, VBUS_MEAS, USB_VBUS_CTRL_SET);
943+
if (ret < 0) {
944+
dev_err(dev, "failed to wire up inputs\n");
945+
return ret;
946+
}
947+
948+
ret = twl_i2c_write_u8(TWL_MODULE_USB, ID_MEAS, USB_ID_CTRL_SET);
949+
if (ret < 0) {
950+
dev_err(dev, "failed to wire up inputs\n");
951+
return ret;
952+
}
953+
954+
ret = twl_i2c_write_u8(TWL6030_MODULE_ID0,
955+
VBAT_MEAS | BB_MEAS | VAC_MEAS,
956+
TWL6030_MISC1);
957+
if (ret < 0) {
958+
dev_err(dev, "failed to wire up inputs\n");
959+
return ret;
960+
}
961+
930962
indio_dev->name = DRIVER_NAME;
931963
indio_dev->info = &twl6030_gpadc_iio_info;
932964
indio_dev->modes = INDIO_DIRECT_MODE;

drivers/iio/adc/xilinx-ams.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,7 @@ static int ams_parse_firmware(struct iio_dev *indio_dev)
13291329

13301330
dev_channels = devm_krealloc(dev, ams_channels, dev_size, GFP_KERNEL);
13311331
if (!dev_channels)
1332-
ret = -ENOMEM;
1332+
return -ENOMEM;
13331333

13341334
indio_dev->channels = dev_channels;
13351335
indio_dev->num_channels = num_channels;

drivers/iio/gyro/hid-sensor-gyro-3d.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ static int gyro_3d_capture_sample(struct hid_sensor_hub_device *hsdev,
231231
gyro_state->timestamp =
232232
hid_sensor_convert_timestamp(&gyro_state->common_attributes,
233233
*(s64 *)raw_data);
234+
ret = 0;
234235
break;
235236
default:
236237
break;

0 commit comments

Comments
 (0)