[PATCH] regulator: tps65090: Check for pdata before dereferencing
From: Mark Brown
Date: Thu May 01 2014 - 14:57:17 EST
From: Mark Brown <broonie@xxxxxxxxxx>
The per-regulator pdata is optional so we need to check that it's there
before dereferencing it. This wasn't done in "regulator: tps65090: Allow
setting the overcurrent wait time", fix that.
Reported-by: Olof Johansson <olof@xxxxxxxxx>
Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
---
drivers/regulator/tps65090-regulator.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/regulator/tps65090-regulator.c b/drivers/regulator/tps65090-regulator.c
index ca04e9f..fbe0bf5 100644
--- a/drivers/regulator/tps65090-regulator.c
+++ b/drivers/regulator/tps65090-regulator.c
@@ -306,8 +306,11 @@ static int tps65090_regulator_probe(struct platform_device *pdev)
ri = &pmic[num];
ri->dev = &pdev->dev;
ri->desc = &tps65090_regulator_desc[num];
- ri->overcurrent_wait_valid = tps_pdata->overcurrent_wait_valid;
- ri->overcurrent_wait = tps_pdata->overcurrent_wait;
+ if (tps_pdata) {
+ ri->overcurrent_wait_valid =
+ tps_pdata->overcurrent_wait_valid;
+ ri->overcurrent_wait = tps_pdata->overcurrent_wait;
+ }
/*
* TPS5090 DCDC support the control from external digital input.
--
1.9.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/