iio: adc: stm32-dfsdm: handle label as an optional property

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: 3208fa0cd9 ("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>
This commit is contained in:
Olivier Moysan 2024-11-14 11:24:59 +01:00 committed by Jonathan Cameron
parent dddfd0c489
commit ad8479ac08

View File

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