Skip to content

Commit db4a57e

Browse files
committed
Merge tag 'staging-4.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging and IIO driver fixes from Greg KH: "Here are some small staging and iio driver fixes for reported issues for 4.9-rc3. Nothing major, the "largest" being a lustre fix for a sysfs file that was obviously wrong, and had never been tested, so it was moved to debugfs as that is where it belongs. The others are small bug fixes for reported issues with various staging or iio drivers. All have been in linux-next for a while with no reported issues" * tag 'staging-4.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: greybus: fix a leak on error in gb_module_create() greybus: es2: fix error return code in ap_probe() greybus: arche-platform: Add missing of_node_put() in arche_platform_change_state() staging: android: ion: Fix error handling in ion_query_heaps() iio: accel: sca3000_core: avoid potentially uninitialized variable iio:chemical:atlas-ph-sensor: Fix use of 32 bit int to hold 16 bit big endian value staging/lustre/llite: Move unstable_stats from sysfs to debugfs Staging: wilc1000: Fix kernel Oops on opening the device staging: android/ion: testing the wrong variable Staging: greybus: uart: Use gbphy_dev->dev instead of bundle->dev Staging: greybus: gpio: Use gbphy_dev->dev instead of bundle->dev iio: adc: ti-adc081c: Select IIO_TRIGGERED_BUFFER to prevent build errors iio: maxim_thermocouple: Align 16 bit big endian value of raw reads
2 parents 37cc6bb + e866dd8 commit db4a57e

File tree

13 files changed

+46
-38
lines changed

13 files changed

+46
-38
lines changed

drivers/iio/adc/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,8 @@ config STX104
437437
config TI_ADC081C
438438
tristate "Texas Instruments ADC081C/ADC101C/ADC121C family"
439439
depends on I2C
440+
select IIO_BUFFER
441+
select IIO_TRIGGERED_BUFFER
440442
help
441443
If you say yes here you get support for Texas Instruments ADC081C,
442444
ADC101C and ADC121C ADC chips.

drivers/iio/chemical/atlas-ph-sensor.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,14 @@ static int atlas_check_ec_calibration(struct atlas_data *data)
213213
struct device *dev = &data->client->dev;
214214
int ret;
215215
unsigned int val;
216+
__be16 rval;
216217

217-
ret = regmap_bulk_read(data->regmap, ATLAS_REG_EC_PROBE, &val, 2);
218+
ret = regmap_bulk_read(data->regmap, ATLAS_REG_EC_PROBE, &rval, 2);
218219
if (ret)
219220
return ret;
220221

221-
dev_info(dev, "probe set to K = %d.%.2d", be16_to_cpu(val) / 100,
222-
be16_to_cpu(val) % 100);
222+
val = be16_to_cpu(rval);
223+
dev_info(dev, "probe set to K = %d.%.2d", val / 100, val % 100);
223224

224225
ret = regmap_read(data->regmap, ATLAS_REG_EC_CALIB_STATUS, &val);
225226
if (ret)

drivers/iio/temperature/maxim_thermocouple.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,22 +123,24 @@ static int maxim_thermocouple_read(struct maxim_thermocouple_data *data,
123123
{
124124
unsigned int storage_bytes = data->chip->read_size;
125125
unsigned int shift = chan->scan_type.shift + (chan->address * 8);
126-
unsigned int buf;
126+
__be16 buf16;
127+
__be32 buf32;
127128
int ret;
128129

129-
ret = spi_read(data->spi, (void *) &buf, storage_bytes);
130-
if (ret)
131-
return ret;
132-
133130
switch (storage_bytes) {
134131
case 2:
135-
*val = be16_to_cpu(buf);
132+
ret = spi_read(data->spi, (void *)&buf16, storage_bytes);
133+
*val = be16_to_cpu(buf16);
136134
break;
137135
case 4:
138-
*val = be32_to_cpu(buf);
136+
ret = spi_read(data->spi, (void *)&buf32, storage_bytes);
137+
*val = be32_to_cpu(buf32);
139138
break;
140139
}
141140

141+
if (ret)
142+
return ret;
143+
142144
/* check to be sure this is a valid reading */
143145
if (*val & data->chip->status_bit)
144146
return -EINVAL;

drivers/staging/android/ion/ion.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,8 +1187,10 @@ int ion_query_heaps(struct ion_client *client, struct ion_heap_query *query)
11871187
hdata.type = heap->type;
11881188
hdata.heap_id = heap->id;
11891189

1190-
ret = copy_to_user(&buffer[cnt],
1191-
&hdata, sizeof(hdata));
1190+
if (copy_to_user(&buffer[cnt], &hdata, sizeof(hdata))) {
1191+
ret = -EFAULT;
1192+
goto out;
1193+
}
11921194

11931195
cnt++;
11941196
if (cnt >= max_cnt)

drivers/staging/android/ion/ion_of.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ struct ion_platform_data *ion_parse_dt(struct platform_device *pdev,
107107

108108
heap_pdev = of_platform_device_create(node, heaps[i].name,
109109
&pdev->dev);
110-
if (!pdev)
110+
if (!heap_pdev)
111111
return ERR_PTR(-ENOMEM);
112112
heap_pdev->dev.platform_data = &heaps[i];
113113

drivers/staging/greybus/arche-platform.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ int arche_platform_change_state(enum arche_platform_state state,
128128
pdev = of_find_device_by_node(np);
129129
if (!pdev) {
130130
pr_err("arche-platform device not found\n");
131+
of_node_put(np);
131132
return -ENODEV;
132133
}
133134

drivers/staging/greybus/es2.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1548,7 +1548,8 @@ static int ap_probe(struct usb_interface *interface,
15481548
INIT_LIST_HEAD(&es2->arpcs);
15491549
spin_lock_init(&es2->arpc_lock);
15501550

1551-
if (es2_arpc_in_enable(es2))
1551+
retval = es2_arpc_in_enable(es2);
1552+
if (retval)
15521553
goto error;
15531554

15541555
retval = gb_hd_add(hd);

drivers/staging/greybus/gpio.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -702,15 +702,13 @@ static int gb_gpio_probe(struct gbphy_device *gbphy_dev,
702702
ret = gb_gpio_irqchip_add(gpio, irqc, 0,
703703
handle_level_irq, IRQ_TYPE_NONE);
704704
if (ret) {
705-
dev_err(&connection->bundle->dev,
706-
"failed to add irq chip: %d\n", ret);
705+
dev_err(&gbphy_dev->dev, "failed to add irq chip: %d\n", ret);
707706
goto exit_line_free;
708707
}
709708

710709
ret = gpiochip_add(gpio);
711710
if (ret) {
712-
dev_err(&connection->bundle->dev,
713-
"failed to add gpio chip: %d\n", ret);
711+
dev_err(&gbphy_dev->dev, "failed to add gpio chip: %d\n", ret);
714712
goto exit_gpio_irqchip_remove;
715713
}
716714

drivers/staging/greybus/module.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ struct gb_module *gb_module_create(struct gb_host_device *hd, u8 module_id,
127127
return module;
128128

129129
err_put_interfaces:
130-
for (--i; i > 0; --i)
130+
for (--i; i >= 0; --i)
131131
gb_interface_put(module->interfaces[i]);
132132

133133
put_device(&module->dev);

drivers/staging/greybus/uart.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ static int gb_uart_probe(struct gbphy_device *gbphy_dev,
888888
minor = alloc_minor(gb_tty);
889889
if (minor < 0) {
890890
if (minor == -ENOSPC) {
891-
dev_err(&connection->bundle->dev,
891+
dev_err(&gbphy_dev->dev,
892892
"no more free minor numbers\n");
893893
retval = -ENODEV;
894894
} else {

drivers/staging/iio/accel/sca3000_core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,8 @@ static inline int __sca3000_get_base_freq(struct sca3000_state *st,
468468
case SCA3000_MEAS_MODE_OP_2:
469469
*base_freq = info->option_mode_2_freq;
470470
break;
471+
default:
472+
ret = -EINVAL;
471473
}
472474
error_ret:
473475
return ret;

drivers/staging/lustre/lustre/llite/lproc_llite.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -871,32 +871,32 @@ static ssize_t xattr_cache_store(struct kobject *kobj,
871871
}
872872
LUSTRE_RW_ATTR(xattr_cache);
873873

874-
static ssize_t unstable_stats_show(struct kobject *kobj,
875-
struct attribute *attr,
876-
char *buf)
874+
static int ll_unstable_stats_seq_show(struct seq_file *m, void *v)
877875
{
878-
struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
879-
ll_kobj);
876+
struct super_block *sb = m->private;
877+
struct ll_sb_info *sbi = ll_s2sbi(sb);
880878
struct cl_client_cache *cache = sbi->ll_cache;
881879
long pages;
882880
int mb;
883881

884882
pages = atomic_long_read(&cache->ccc_unstable_nr);
885883
mb = (pages * PAGE_SIZE) >> 20;
886884

887-
return sprintf(buf, "unstable_check: %8d\n"
888-
"unstable_pages: %12ld\n"
889-
"unstable_mb: %8d\n",
890-
cache->ccc_unstable_check, pages, mb);
885+
seq_printf(m,
886+
"unstable_check: %8d\n"
887+
"unstable_pages: %12ld\n"
888+
"unstable_mb: %8d\n",
889+
cache->ccc_unstable_check, pages, mb);
890+
891+
return 0;
891892
}
892893

893-
static ssize_t unstable_stats_store(struct kobject *kobj,
894-
struct attribute *attr,
895-
const char *buffer,
896-
size_t count)
894+
static ssize_t ll_unstable_stats_seq_write(struct file *file,
895+
const char __user *buffer,
896+
size_t count, loff_t *off)
897897
{
898-
struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
899-
ll_kobj);
898+
struct super_block *sb = ((struct seq_file *)file->private_data)->private;
899+
struct ll_sb_info *sbi = ll_s2sbi(sb);
900900
char kernbuf[128];
901901
int val, rc;
902902

@@ -922,7 +922,7 @@ static ssize_t unstable_stats_store(struct kobject *kobj,
922922

923923
return count;
924924
}
925-
LUSTRE_RW_ATTR(unstable_stats);
925+
LPROC_SEQ_FOPS(ll_unstable_stats);
926926

927927
static ssize_t root_squash_show(struct kobject *kobj, struct attribute *attr,
928928
char *buf)
@@ -995,6 +995,7 @@ static struct lprocfs_vars lprocfs_llite_obd_vars[] = {
995995
/* { "filegroups", lprocfs_rd_filegroups, 0, 0 }, */
996996
{ "max_cached_mb", &ll_max_cached_mb_fops, NULL },
997997
{ "statahead_stats", &ll_statahead_stats_fops, NULL, 0 },
998+
{ "unstable_stats", &ll_unstable_stats_fops, NULL },
998999
{ "sbi_flags", &ll_sbi_flags_fops, NULL, 0 },
9991000
{ .name = "nosquash_nids",
10001001
.fops = &ll_nosquash_nids_fops },
@@ -1026,7 +1027,6 @@ static struct attribute *llite_attrs[] = {
10261027
&lustre_attr_max_easize.attr,
10271028
&lustre_attr_default_easize.attr,
10281029
&lustre_attr_xattr_cache.attr,
1029-
&lustre_attr_unstable_stats.attr,
10301030
&lustre_attr_root_squash.attr,
10311031
NULL,
10321032
};

drivers/staging/wilc1000/host_interface.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3388,7 +3388,6 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
33883388

33893389
clients_count++;
33903390

3391-
destroy_workqueue(hif_workqueue);
33923391
_fail_:
33933392
return result;
33943393
}

0 commit comments

Comments
 (0)