regulator: fixed: use dev_err_probe for gpio
authorRouven Czerwinski <r.czerwinski@pengutronix.de>
Wed, 16 Jun 2021 12:53:31 +0000 (14:53 +0200)
committerMark Brown <broonie@kernel.org>
Wed, 16 Jun 2021 14:41:20 +0000 (15:41 +0100)
Instead of returning the the PTR_ERR directly, use dev_err_probe which
will also correctly set the deferred probe reason in
/sys/kernel/debug/deferred_devices, making it easier to debug missing
devices on the system.

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Link: https://lore.kernel.org/r/20210616125331.153414-1-r.czerwinski@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/fixed.c

index 02ad83153e19afabddadc3a4125ebd12c71abcfb..78f3a938b39bbd8fa2f23e55adc2fb76e9d77cd3 100644 (file)
@@ -271,7 +271,8 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
         */
        cfg.ena_gpiod = gpiod_get_optional(&pdev->dev, NULL, gflags);
        if (IS_ERR(cfg.ena_gpiod))
-               return PTR_ERR(cfg.ena_gpiod);
+               return dev_err_probe(&pdev->dev, PTR_ERR(cfg.ena_gpiod),
+                                    "can't get GPIO\n");
 
        cfg.dev = &pdev->dev;
        cfg.init_data = config->init_data;