summaryrefslogtreecommitdiff
path: root/drivers/iio/adc
diff options
context:
space:
mode:
authorTrevor Gamblin <tgamblin@baylibre.com>2024-06-13 19:34:06 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2024-06-22 12:48:48 +0300
commit40c0f07528c795b83abb4550a16b7866c6db5778 (patch)
treec71e266ee8d81378eb871f16f0401026f8f91812 /drivers/iio/adc
parent20460472952043a4735e9abc1fd9de8e024d1c9e (diff)
downloadlinux-40c0f07528c795b83abb4550a16b7866c6db5778.tar.xz
iio: adc: adi-axi-adc: improve probe() error messaging
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 change: |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@baylibre.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20240613163407.2147884-1-tgamblin@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/adc')
-rw-r--r--drivers/iio/adc/adi-axi-adc.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/iio/adc/adi-axi-adc.c b/drivers/iio/adc/adi-axi-adc.c
index 0f8bd1d75131..21ce7564e83d 100644
--- a/drivers/iio/adc/adi-axi-adc.c
+++ b/drivers/iio/adc/adi-axi-adc.c
@@ -308,7 +308,8 @@ static int adi_axi_adc_probe(struct platform_device *pdev)
st->regmap = devm_regmap_init_mmio(&pdev->dev, base,
&axi_adc_regmap_config);
if (IS_ERR(st->regmap))
- return PTR_ERR(st->regmap);
+ return dev_err_probe(&pdev->dev, PTR_ERR(st->regmap),
+ "failed to init register map\n");
expected_ver = device_get_match_data(&pdev->dev);
if (!expected_ver)
@@ -316,7 +317,8 @@ static int adi_axi_adc_probe(struct platform_device *pdev)
clk = devm_clk_get_enabled(&pdev->dev, NULL);
if (IS_ERR(clk))
- return PTR_ERR(clk);
+ return dev_err_probe(&pdev->dev, PTR_ERR(clk),
+ "failed to get clock\n");
/*
* Force disable the core. Up to the frontend to enable us. And we can
@@ -344,7 +346,8 @@ static int adi_axi_adc_probe(struct platform_device *pdev)
ret = devm_iio_backend_register(&pdev->dev, &adi_axi_adc_generic, st);
if (ret)
- return ret;
+ return dev_err_probe(&pdev->dev, ret,
+ "failed to register iio backend\n");
dev_info(&pdev->dev, "AXI ADC IP core (%d.%.2d.%c) probed\n",
ADI_AXI_PCORE_VER_MAJOR(ver),