summaryrefslogtreecommitdiff
path: root/drivers/power/tps80031-charger.c
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2011-08-25 18:24:32 +0530
committerDan Willemsen <dwillemsen@nvidia.com>2013-09-14 01:08:41 -0700
commit6eaf80769a4ac55fa0f1b68f6f5f44b2c6ad8d49 (patch)
tree76868838bc6757560216432415dcb43205d0b1ae /drivers/power/tps80031-charger.c
parente173a9bbc2013ad7331cec4dbbe82459e4fe387c (diff)
power: tps80031-charger: Check for proper platform data
Checking for valid platform data before registering the driver as regulator. bug 868483 Original-Change-Id: I630d55f4e60f296d9e9a05455b97e72186f09e19 Reviewed-on: http://git-master/r/49224 Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com> Tested-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-by: Sachin Nikam <snikam@nvidia.com> Reviewed-by: Thomas Cherry <tcherry@nvidia.com> Rebase-Id: Rb2d75be1e54c9260c028a5526dfbf416853628e4
Diffstat (limited to 'drivers/power/tps80031-charger.c')
-rw-r--r--drivers/power/tps80031-charger.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/power/tps80031-charger.c b/drivers/power/tps80031-charger.c
index aea8dd97751c..7855b8eef48c 100644
--- a/drivers/power/tps80031-charger.c
+++ b/drivers/power/tps80031-charger.c
@@ -296,6 +296,17 @@ static int tps80031_charger_probe(struct platform_device *pdev)
struct tps80031_charger_platform_data *pdata = pdev->dev.platform_data;
dev_info(dev, "%s()\n", __func__);
+
+ if (!pdata) {
+ dev_err(dev, "%s() No platform data, exiting..\n", __func__);
+ return -ENODEV;
+ }
+
+ if (!pdata->num_consumer_supplies) {
+ dev_err(dev, "%s() No consumer supply list, exiting..\n", __func__);
+ return -ENODEV;
+ }
+
charger = kzalloc(sizeof(*charger), GFP_KERNEL);
if (!charger) {
dev_err(dev, "failed to allocate memory status\n");