summaryrefslogtreecommitdiff
path: root/drivers/iio/adc/xilinx-xadc-core.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2022-05-31 17:11:18 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2022-07-13 19:11:43 +0300
commit568f6869e680c7492c5e38df9094af86fe9d6364 (patch)
tree410e73256d946c988c33704e7e429f7e86ec7359 /drivers/iio/adc/xilinx-xadc-core.c
parent59b2947ed4c32da50e7390fce6e200669900f503 (diff)
downloadlinux-568f6869e680c7492c5e38df9094af86fe9d6364.tar.xz
iio: adc: xilinx-xadc: Drop duplicate NULL check in xadc_parse_dt()
The fwnode_for_each_child_node() is NULL-aware, no need to check its parameters outside. Drop duplicate NULL check in xadc_parse_dt(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220531141118.64540-2-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/adc/xilinx-xadc-core.c')
-rw-r--r--drivers/iio/adc/xilinx-xadc-core.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c
index e883f95f0cda..1b247722ba25 100644
--- a/drivers/iio/adc/xilinx-xadc-core.c
+++ b/drivers/iio/adc/xilinx-xadc-core.c
@@ -1247,30 +1247,28 @@ static int xadc_parse_dt(struct iio_dev *indio_dev, unsigned int *conf, int irq)
chan = &channels[9];
chan_node = device_get_named_child_node(dev, "xlnx,channels");
- if (chan_node) {
- fwnode_for_each_child_node(chan_node, child) {
- if (num_channels >= max_channels) {
- fwnode_handle_put(child);
- break;
- }
+ fwnode_for_each_child_node(chan_node, child) {
+ if (num_channels >= max_channels) {
+ fwnode_handle_put(child);
+ break;
+ }
- ret = fwnode_property_read_u32(child, "reg", &reg);
- if (ret || reg > 16)
- continue;
+ ret = fwnode_property_read_u32(child, "reg", &reg);
+ if (ret || reg > 16)
+ continue;
- if (fwnode_property_read_bool(child, "xlnx,bipolar"))
- chan->scan_type.sign = 's';
+ if (fwnode_property_read_bool(child, "xlnx,bipolar"))
+ chan->scan_type.sign = 's';
- if (reg == 0) {
- chan->scan_index = 11;
- chan->address = XADC_REG_VPVN;
- } else {
- chan->scan_index = 15 + reg;
- chan->address = XADC_REG_VAUX(reg - 1);
- }
- num_channels++;
- chan++;
+ if (reg == 0) {
+ chan->scan_index = 11;
+ chan->address = XADC_REG_VPVN;
+ } else {
+ chan->scan_index = 15 + reg;
+ chan->address = XADC_REG_VAUX(reg - 1);
}
+ num_channels++;
+ chan++;
}
fwnode_handle_put(chan_node);