misc: tegra-baseband: register sysedpc if name exists
Neil Patel [Fri, 3 Jan 2014 22:02:15 +0000 (17:02 -0500)]
If sysedp is supported but the consumer name has not been specified
then no registration call should be made. Doing so will result in a
crash within the sysedp driver.

Bug 1416849

Change-Id: I9f03802d6f82f11ae6b2da7ff57880a1778c4637
Signed-off-by: Neil Patel <neilp@nvidia.com>
Reviewed-on: http://git-master/r/351878
Reviewed-by: Steve Lin <stlin@nvidia.com>

drivers/misc/tegra-baseband/tegra_usb_modem_power.c

index 21e9820..feb9377 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2013, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2011-2014, NVIDIA CORPORATION.  All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -841,10 +841,13 @@ static int mdm_init(struct tegra_usb_modem *modem, struct platform_device *pdev)
                modem->edp_initialized = 1;
        }
 
-       modem->sysedpc = sysedp_create_consumer(modem->pdata->sysedpc_name,
-                                               modem->pdata->sysedpc_name);
-       if (modem->sysedpc)
-               INIT_WORK(&modem->sysedp_work, sysedp_work);
+       if (pdata->sysedpc_name) {
+               modem->sysedpc = sysedp_create_consumer(pdata->sysedpc_name,
+                                                       pdata->sysedpc_name);
+
+               if (modem->sysedpc)
+                       INIT_WORK(&modem->sysedp_work, sysedp_work);
+       }
 
        /* get modem operations from platform data */
        modem->ops = (const struct tegra_modem_operations *)pdata->ops;