diff mbox

[1/3] bq24022: Evaluate returns of gpio_direction_output-calls

Message ID 201108281508.31412.heiko@sntech.de (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Heiko Stübner Aug. 28, 2011, 1:08 p.m. UTC
It wasn't done before.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 drivers/regulator/bq24022.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

Comments

Mark Brown Aug. 29, 2011, 9:16 a.m. UTC | #1
On Sun, Aug 28, 2011 at 03:08:30PM +0200, Heiko Stübner wrote:

>  	ret = gpio_direction_output(pdata->gpio_iset2, 0);
> +	if (ret) {
> +		dev_dbg(&pdev->dev, "couldn't set ISET2 GPIO: %d\n",
> +			pdata->gpio_iset2);
> +		goto err_reg;
> +	}
>  	ret = gpio_direction_output(pdata->gpio_nce, 1);
> +	if (ret) {
> +		dev_dbg(&pdev->dev, "couldn't set nCE GPIO: %d\n",
> +			pdata->gpio_nce);
> +		goto err_reg;
> +	}

If these are fatal errors the log messages shouldn't be dev_dbg() but
should instead be something that will be displayed by default.
diff mbox

Patch

diff --git a/drivers/regulator/bq24022.c b/drivers/regulator/bq24022.c
index e24d1b7..973af08 100644
--- a/drivers/regulator/bq24022.c
+++ b/drivers/regulator/bq24022.c
@@ -104,7 +104,17 @@  static int __init bq24022_probe(struct platform_device *pdev)
 		goto err_iset2;
 	}
 	ret = gpio_direction_output(pdata->gpio_iset2, 0);
+	if (ret) {
+		dev_dbg(&pdev->dev, "couldn't set ISET2 GPIO: %d\n",
+			pdata->gpio_iset2);
+		goto err_reg;
+	}
 	ret = gpio_direction_output(pdata->gpio_nce, 1);
+	if (ret) {
+		dev_dbg(&pdev->dev, "couldn't set nCE GPIO: %d\n",
+			pdata->gpio_nce);
+		goto err_reg;
+	}
 
 	bq24022 = regulator_register(&bq24022_desc, &pdev->dev,
 				     pdata->init_data, pdata);