drm/vc4: hdmi: Check the device state in prepare()
authorMaxime Ripard <maxime@cerno.tech>
Mon, 25 Oct 2021 14:11:11 +0000 (16:11 +0200)
committerMaxime Ripard <maxime@cerno.tech>
Fri, 5 Nov 2021 11:53:28 +0000 (12:53 +0100)
commita64ff88cb5eb0b9a6855a24ff326e948931e3a8e
tree58b1bd490f6af3d3f27424ae759219e32dd199a9
parent633be8c3c0c5e0cf176ce904083a4728ae8e4025
drm/vc4: hdmi: Check the device state in prepare()

Even though we already check that the encoder->crtc pointer is there
during in startup(), which is part of the open() path in ASoC, nothing
guarantees that our encoder state won't change between the time when we
open the device and the time we prepare it.

Move the sanity checks we do in startup() to a helper and call it from
prepare().

Link: https://lore.kernel.org/r/20211025141113.702757-8-maxime@cerno.tech
Fixes: 91e99e113929 ("drm/vc4: hdmi: Register HDMI codec")
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
drivers/gpu/drm/vc4/vc4_hdmi.c