diff mbox series

soc: imx: gpcv2: print errno for regulator errors

Message ID 20220609094453.2120099-1-martin.kepplinger@puri.sm (mailing list archive)
State New, archived
Headers show
Series soc: imx: gpcv2: print errno for regulator errors | expand

Commit Message

Martin Kepplinger June 9, 2022, 9:44 a.m. UTC
Make debugging of power management issues easier by printing the reason
why a regulator fails to be enabled or disabled.

Signed-off-by: Martin Kepplinger <martin.kepplinger@puri.sm>
---
 drivers/soc/imx/gpcv2.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Ahmad Fatoum June 9, 2022, 9:47 a.m. UTC | #1
Hello Martin,

On 09.06.22 11:44, Martin Kepplinger wrote:
> Make debugging of power management issues easier by printing the reason
> why a regulator fails to be enabled or disabled.
> 
> Signed-off-by: Martin Kepplinger <martin.kepplinger@puri.sm>
> ---
>  drivers/soc/imx/gpcv2.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/soc/imx/gpcv2.c b/drivers/soc/imx/gpcv2.c
> index 3cb123016b3e..311507a815c5 100644
> --- a/drivers/soc/imx/gpcv2.c
> +++ b/drivers/soc/imx/gpcv2.c
> @@ -233,7 +233,8 @@ static int imx_pgc_power_up(struct generic_pm_domain *genpd)
>  	if (!IS_ERR(domain->regulator)) {
>  		ret = regulator_enable(domain->regulator);
>  		if (ret) {
> -			dev_err(domain->dev, "failed to enable regulator\n");
> +			dev_err(domain->dev, "failed to enable regulator: %d\n",
> +				ret);

You could make it even more approachable by using %pe.

>  			goto out_put_pm;
>  		}
>  	}
> @@ -372,7 +373,8 @@ static int imx_pgc_power_down(struct generic_pm_domain *genpd)
>  	if (!IS_ERR(domain->regulator)) {
>  		ret = regulator_disable(domain->regulator);
>  		if (ret) {
> -			dev_err(domain->dev, "failed to disable regulator\n");
> +			dev_err(domain->dev,
> +				"failed to disable regulator: %d\n", ret);
>  			return ret;
>  		}
>  	}
diff mbox series

Patch

diff --git a/drivers/soc/imx/gpcv2.c b/drivers/soc/imx/gpcv2.c
index 3cb123016b3e..311507a815c5 100644
--- a/drivers/soc/imx/gpcv2.c
+++ b/drivers/soc/imx/gpcv2.c
@@ -233,7 +233,8 @@  static int imx_pgc_power_up(struct generic_pm_domain *genpd)
 	if (!IS_ERR(domain->regulator)) {
 		ret = regulator_enable(domain->regulator);
 		if (ret) {
-			dev_err(domain->dev, "failed to enable regulator\n");
+			dev_err(domain->dev, "failed to enable regulator: %d\n",
+				ret);
 			goto out_put_pm;
 		}
 	}
@@ -372,7 +373,8 @@  static int imx_pgc_power_down(struct generic_pm_domain *genpd)
 	if (!IS_ERR(domain->regulator)) {
 		ret = regulator_disable(domain->regulator);
 		if (ret) {
-			dev_err(domain->dev, "failed to disable regulator\n");
+			dev_err(domain->dev,
+				"failed to disable regulator: %d\n", ret);
 			return ret;
 		}
 	}