mirror of
https://github.com/torvalds/linux.git
synced 2024-11-24 21:21:41 +00:00
drm/vc4: hdmi: Fix pointer dereference before check
Commit6bed2ea3cb
("drm/vc4: hdmi: Reset link on hotplug") introduced the vc4_hdmi_reset_link() function. This function dereferences the "connector" pointer before checking whether it is NULL or not. Rework variable assignment to avoid this issue. Fixes:6bed2ea3cb
("drm/vc4: hdmi: Reset link on hotplug") Signed-off-by: José Expósito <jose.exposito89@gmail.com> Link: https://lore.kernel.org/r/20221110134752.238820-3-jose.exposito89@gmail.com Signed-off-by: Maxime Ripard <maxime@cerno.tech>
This commit is contained in:
parent
d218750805
commit
0a99962c0d
@ -318,8 +318,8 @@ out:
|
||||
static int vc4_hdmi_reset_link(struct drm_connector *connector,
|
||||
struct drm_modeset_acquire_ctx *ctx)
|
||||
{
|
||||
struct drm_device *drm = connector->dev;
|
||||
struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector);
|
||||
struct drm_device *drm;
|
||||
struct vc4_hdmi *vc4_hdmi;
|
||||
struct drm_connector_state *conn_state;
|
||||
struct drm_crtc_state *crtc_state;
|
||||
struct drm_crtc *crtc;
|
||||
@ -330,6 +330,7 @@ static int vc4_hdmi_reset_link(struct drm_connector *connector,
|
||||
if (!connector)
|
||||
return 0;
|
||||
|
||||
drm = connector->dev;
|
||||
ret = drm_modeset_lock(&drm->mode_config.connection_mutex, ctx);
|
||||
if (ret)
|
||||
return ret;
|
||||
@ -347,6 +348,7 @@ static int vc4_hdmi_reset_link(struct drm_connector *connector,
|
||||
if (!crtc_state->active)
|
||||
return 0;
|
||||
|
||||
vc4_hdmi = connector_to_vc4_hdmi(connector);
|
||||
if (!vc4_hdmi_supports_scrambling(vc4_hdmi))
|
||||
return 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user