summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2019-06-24 13:30:24 +0200
committerThierry Reding <treding@nvidia.com>2019-10-28 11:18:43 +0100
commit6c79f09fce4dd03f6b623b1d49e1b8a968822f60 (patch)
tree71bf25f9a8de820c4d4602af8231479d75ada3ae /drivers
parent245ce70cd466d2e003861788d13726417557eb39 (diff)
downloadlinux-6c79f09fce4dd03f6b623b1d49e1b8a968822f60.tar.bz2
drm/tegra: dpaux: Fix crash if VDD supply is absent
In order to properly make the VDD supply optional, all accesses to the regulator need to be ignored, because the regulator core doesn't treat NULL special. Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/tegra/dpaux.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/gpu/drm/tegra/dpaux.c b/drivers/gpu/drm/tegra/dpaux.c
index 819fdd9b4413..1b3acb5852a0 100644
--- a/drivers/gpu/drm/tegra/dpaux.c
+++ b/drivers/gpu/drm/tegra/dpaux.c
@@ -505,6 +505,8 @@ static int tegra_dpaux_probe(struct platform_device *pdev)
return PTR_ERR(dpaux->vdd);
}
+
+ dpaux->vdd = NULL;
}
platform_set_drvdata(pdev, dpaux);
@@ -698,13 +700,15 @@ int drm_dp_aux_attach(struct drm_dp_aux *aux, struct tegra_output *output)
output->connector.polled = DRM_CONNECTOR_POLL_HPD;
dpaux->output = output;
- err = regulator_enable(dpaux->vdd);
- if (err < 0)
- return err;
-
if (output->panel) {
enum drm_connector_status status;
+ if (dpaux->vdd) {
+ err = regulator_enable(dpaux->vdd);
+ if (err < 0)
+ return err;
+ }
+
timeout = jiffies + msecs_to_jiffies(250);
while (time_before(jiffies, timeout)) {
@@ -732,13 +736,15 @@ int drm_dp_aux_detach(struct drm_dp_aux *aux)
disable_irq(dpaux->irq);
- err = regulator_disable(dpaux->vdd);
- if (err < 0)
- return err;
-
if (dpaux->output->panel) {
enum drm_connector_status status;
+ if (dpaux->vdd) {
+ err = regulator_disable(dpaux->vdd);
+ if (err < 0)
+ return err;
+ }
+
timeout = jiffies + msecs_to_jiffies(250);
while (time_before(jiffies, timeout)) {