[PATCH v8 1/5] iio: dac: mcp47feb02: Avoid unjustified probe error on missing label

From: Ariana Lazar

Date: Thu Sep 24 2026 - 09:03:57 EST


Fix unjustified probe error on missing optional 'label' property by
replacing dev_err_probe() with dev_warn_probe(). Correct %pfw usage by
passing the child fwnode handle directly in the error message. Besides the
probe warning a read error is returned at the attempt of reading a null
label.

Fixes: bf394cc80369 ("iio: dac: adding support for Microchip MCP47FEB02")
Reported-by: sashiko-bot@xxxxxxxxxx
Closes: https://lore.kernel.org/all/20260804134616.1D8A21F00A3E@xxxxxxxxxxxxxxx/
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Ariana Lazar <ariana.lazar@xxxxxxxxxxxxx>
---
drivers/iio/dac/mcp47feb02.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/dac/mcp47feb02.c b/drivers/iio/dac/mcp47feb02.c
index 3187a7d95ca8ce4aacf27efc588d9b33eb429aec..349574bc7489d9e5ac9722c3abbaaab0d2c3350e 100644
--- a/drivers/iio/dac/mcp47feb02.c
+++ b/drivers/iio/dac/mcp47feb02.c
@@ -929,7 +929,10 @@ static int mcp47feb02_read_label(struct iio_dev *indio_dev, struct iio_chan_spec
{
struct mcp47feb02_data *data = iio_priv(indio_dev);

- return sysfs_emit(label, "%s\n", data->labels[ch->address]);
+ if (data->labels[ch->address])
+ return sysfs_emit(label, "%s\n", data->labels[ch->address]);
+
+ return -ENOENT;
}

static const struct iio_info mcp47feb02_info = {
@@ -982,10 +985,11 @@ static int mcp47feb02_parse_fw(struct iio_dev *indio_dev,

set_bit(reg, &data->active_channels_mask);

- ret = fwnode_property_read_string(child, "label", &data->labels[reg]);
- if (ret)
- return dev_err_probe(dev, ret, "%pfw: invalid label\n",
- fwnode_get_name(child));
+ if (fwnode_property_present(child, "label")) {
+ ret = fwnode_property_read_string(child, "label", &data->labels[reg]);
+ if (ret)
+ dev_warn_probe(dev, ret, "%pfw: invalid label\n", child);
+ }

chanspec.address = reg;
chanspec.channel = reg;

--
2.43.0