Skip to content

Commit ad8479a

Browse files
Olivier Moysanjic23
authored andcommitted
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: 3208fa0 ("iio: adc: stm32-dfsdm: adopt generic channels bindings") Signed-off-by: Olivier Moysan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
1 parent dddfd0c commit ad8479a

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

drivers/iio/adc/stm32-dfsdm-adc.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -691,11 +691,14 @@ static int stm32_dfsdm_generic_channel_parse_of(struct stm32_dfsdm *dfsdm,
691691
return -EINVAL;
692692
}
693693

694-
ret = fwnode_property_read_string(node, "label", &ch->datasheet_name);
695-
if (ret < 0) {
696-
dev_err(&indio_dev->dev,
697-
" Error parsing 'label' for idx %d\n", ch->channel);
698-
return ret;
694+
if (fwnode_property_present(node, "label")) {
695+
/* label is optional */
696+
ret = fwnode_property_read_string(node, "label", &ch->datasheet_name);
697+
if (ret < 0) {
698+
dev_err(&indio_dev->dev,
699+
" Error parsing 'label' for idx %d\n", ch->channel);
700+
return ret;
701+
}
699702
}
700703

701704
df_ch = &dfsdm->ch_list[ch->channel];

0 commit comments

Comments
 (0)