drm/vc4: hdmi: Fix HPD GPIO error path
authorMaxime Ripard <maxime@cerno.tech>
Fri, 2 Jul 2021 09:54:47 +0000 (11:54 +0200)
committerPhil Elwell <8911409+pelwell@users.noreply.github.com>
Fri, 2 Jul 2021 15:45:04 +0000 (16:45 +0100)
The HPD GPIO retrieval code on failure will jump to the
err_unprepare_hsm label that calls pm_runtime_disable.

However at that point we haven't called pm_runtime_enable, so we end up
with an unbalanced call.

The next error than can occur (and therefore the next label) needs both
pm_runtime_disable and drm_encoder_cleanup though, so let's rearrange
the labels to match what we expect.

Fixes: cd4cb49dc5bb ("drm/vc4: hdmi: Adjust HSM clock rate depending on pixel rate")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
drivers/gpu/drm/vc4/vc4_hdmi.c

index e7017aa..eefb81a 100644 (file)
@@ -2236,7 +2236,7 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
                                                             &hpd_gpio_flags);
                if (vc4_hdmi->hpd_gpio < 0) {
                        ret = vc4_hdmi->hpd_gpio;
-                       goto err_unprepare_hsm;
+                       goto err_put_ddc;
                }
 
                vc4_hdmi->hpd_active_low = hpd_gpio_flags & OF_GPIO_ACTIVE_LOW;
@@ -2297,8 +2297,8 @@ err_destroy_conn:
        vc4_hdmi_connector_destroy(&vc4_hdmi->connector);
 err_destroy_encoder:
        drm_encoder_cleanup(encoder);
-err_unprepare_hsm:
        pm_runtime_disable(dev);
+err_put_ddc:
        put_device(&vc4_hdmi->ddc->dev);
 
        return ret;