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>
This commit is contained in:
@@ -505,6 +505,8 @@ static int tegra_dpaux_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
return PTR_ERR(dpaux->vdd);
|
return PTR_ERR(dpaux->vdd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dpaux->vdd = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
platform_set_drvdata(pdev, dpaux);
|
platform_set_drvdata(pdev, dpaux);
|
||||||
@@ -698,12 +700,14 @@ int drm_dp_aux_attach(struct drm_dp_aux *aux, struct tegra_output *output)
|
|||||||
output->connector.polled = DRM_CONNECTOR_POLL_HPD;
|
output->connector.polled = DRM_CONNECTOR_POLL_HPD;
|
||||||
dpaux->output = output;
|
dpaux->output = output;
|
||||||
|
|
||||||
|
if (output->panel) {
|
||||||
|
enum drm_connector_status status;
|
||||||
|
|
||||||
|
if (dpaux->vdd) {
|
||||||
err = regulator_enable(dpaux->vdd);
|
err = regulator_enable(dpaux->vdd);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
}
|
||||||
if (output->panel) {
|
|
||||||
enum drm_connector_status status;
|
|
||||||
|
|
||||||
timeout = jiffies + msecs_to_jiffies(250);
|
timeout = jiffies + msecs_to_jiffies(250);
|
||||||
|
|
||||||
@@ -732,12 +736,14 @@ int drm_dp_aux_detach(struct drm_dp_aux *aux)
|
|||||||
|
|
||||||
disable_irq(dpaux->irq);
|
disable_irq(dpaux->irq);
|
||||||
|
|
||||||
|
if (dpaux->output->panel) {
|
||||||
|
enum drm_connector_status status;
|
||||||
|
|
||||||
|
if (dpaux->vdd) {
|
||||||
err = regulator_disable(dpaux->vdd);
|
err = regulator_disable(dpaux->vdd);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
}
|
||||||
if (dpaux->output->panel) {
|
|
||||||
enum drm_connector_status status;
|
|
||||||
|
|
||||||
timeout = jiffies + msecs_to_jiffies(250);
|
timeout = jiffies + msecs_to_jiffies(250);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user