summaryrefslogtreecommitdiffstats
path: root/drivers/iio/adc/ad7266.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2016-08-01 19:34:01 +0200
committerBjorn Helgaas <bhelgaas@google.com>2016-08-01 19:34:01 +0200
commit9454c23852ca6d7aec89fd6fd46a046c323caac3 (patch)
tree794be65345027b5adea3720a43124fee338333a5 /drivers/iio/adc/ad7266.c
parentMerge branches 'pci/host-aardvark', 'pci/host-altera', 'pci/host-dra7xx', 'pc... (diff)
parentPCI: Spread interrupt vectors in pci_alloc_irq_vectors() (diff)
downloadlinux-9454c23852ca6d7aec89fd6fd46a046c323caac3.tar.xz
linux-9454c23852ca6d7aec89fd6fd46a046c323caac3.zip
Merge branch 'pci/msi-affinity' into next
Conflicts: drivers/nvme/host/pci.c
Diffstat (limited to 'drivers/iio/adc/ad7266.c')
-rw-r--r--drivers/iio/adc/ad7266.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/iio/adc/ad7266.c b/drivers/iio/adc/ad7266.c
index 21e19b60e2b9..2123f0ac2e2a 100644
--- a/drivers/iio/adc/ad7266.c
+++ b/drivers/iio/adc/ad7266.c
@@ -396,8 +396,8 @@ static int ad7266_probe(struct spi_device *spi)
st = iio_priv(indio_dev);
- st->reg = devm_regulator_get(&spi->dev, "vref");
- if (!IS_ERR_OR_NULL(st->reg)) {
+ st->reg = devm_regulator_get_optional(&spi->dev, "vref");
+ if (!IS_ERR(st->reg)) {
ret = regulator_enable(st->reg);
if (ret)
return ret;
@@ -408,6 +408,9 @@ static int ad7266_probe(struct spi_device *spi)
st->vref_mv = ret / 1000;
} else {
+ /* Any other error indicates that the regulator does exist */
+ if (PTR_ERR(st->reg) != -ENODEV)
+ return PTR_ERR(st->reg);
/* Use internal reference */
st->vref_mv = 2500;
}