]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
iio: adc: stm32-dfsdm: handle label as an optional property
authorOlivier Moysan <olivier.moysan@foss.st.com>
Thu, 14 Nov 2024 10:24:59 +0000 (11:24 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 7 Dec 2024 17:23:41 +0000 (17:23 +0000)
The label property is defined as optional in the DFSDM binding.
Parse the label property only when it is defined in the device tree.

Fixes: 3208fa0cd919 ("iio: adc: stm32-dfsdm: adopt generic channels bindings")
Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
Link: https://patch.msgid.link/20241114102459.2497178-1-olivier.moysan@foss.st.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/stm32-dfsdm-adc.c

index 1f9eca2fb2bf8ca0d681b452cb7e2054f07b33c2..fe11b0d8eab37615a9ad03ac204ef78c057e5ad5 100644 (file)
@@ -691,11 +691,14 @@ static int stm32_dfsdm_generic_channel_parse_of(struct stm32_dfsdm *dfsdm,
                return -EINVAL;
        }
 
-       ret = fwnode_property_read_string(node, "label", &ch->datasheet_name);
-       if (ret < 0) {
-               dev_err(&indio_dev->dev,
-                       " Error parsing 'label' for idx %d\n", ch->channel);
-               return ret;
+       if (fwnode_property_present(node, "label")) {
+               /* label is optional */
+               ret = fwnode_property_read_string(node, "label", &ch->datasheet_name);
+               if (ret < 0) {
+                       dev_err(&indio_dev->dev,
+                               " Error parsing 'label' for idx %d\n", ch->channel);
+                       return ret;
+               }
        }
 
        df_ch =  &dfsdm->ch_list[ch->channel];