Re: [PATCH v7 06/11] iio: dac: mcp47feb02: Avoid unjustified probe error on missing label
From: Jonathan Cameron
Date: Sun Sep 20 2026 - 18:53:01 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>
>
> diff --git a/drivers/iio/dac/mcp47feb02.c b/drivers/iio/dac/mcp47feb02.c
> index 9d4ba95da84a..43cf69e43a41 100644
> --- a/drivers/iio/dac/mcp47feb02.c
> +++ b/drivers/iio/dac/mcp47feb02.c
> @@ -921,7 +921,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 = {
> @@ -976,8 +979,7 @@ static int mcp47feb02_parse_fw(struct iio_dev *indio_dev,
>
> 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));
> + dev_warn_probe(dev, ret, "%pfw: invalid label\n", child);
Sashiko says:
[Severity: Medium]
Since the label is an optional property, fwnode_property_read_string()
returning a non-zero value is a valid and expected condition when the
property is omitted.
Does this unconditional dev_warn_probe() cause unnecessary warning spam in
the kernel boot log for valid configurations that don't specify a label?
-
I think I agree on this. We should perhaps wrap this in a
property_present check. If it is simply not there carry on without
a warning print.
--
Jonathan Cameron <jonathan.cameron@xxxxxxxxxxxxxxxx>