Re: [PATCH] iio: adc: adi-axi-adc: improve probe() error messaging

From: Nuno Sá
Date: Fri Jun 14 2024 - 05:11:46 EST


On Thu, 2024-06-13 at 12:34 -0400, Trevor Gamblin wrote:
> The current error handling for calls such as devm_clk_get_enabled() in
> the adi-axi-adc probe() function means that, if a property such as
> 'clocks' (for example) is not present in the devicetree when booting a
> kernel with the driver enabled, the resulting error message will be
> vague, e.g.:
>
> > adi_axi_adc 44a00000.backend: probe with driver adi_axi_adc failed with error -2
>
> Change the devm_clk_get_enabled(), devm_regmap_init_mmio(), and
> devm_iio_backend_register() checks to use dev_err_probe() with some
> context for easier debugging.
>
> After the fix:
>
> > adi_axi_adc 44a00000.backend: error -ENOENT: failed to get clock
> > adi_axi_adc 44a00000.backend: probe with driver adi_axi_adc failed with error -2
>
> Signed-off-by: Trevor Gamblin <tgamblin@xxxxxxxxxxxx>
> ---

Somehow feel that in these cases the error log should come from the functions we're
calling but bah... likely not going happen/change:

Reviewed-by: Nuno Sa <nuno.sa@xxxxxxxxxx>

(As a suggestion, you may do similar work in the axi-dac driver)

- Nuno Sá