Skip to content

Commit be9b3f9

Browse files
Nicolas Frattarolilumag
authored andcommitted
drm/connector: only call HDMI audio helper plugged cb if non-null
On driver remove, sound/soc/codecs/hdmi-codec.c calls the plugged_cb with NULL as the callback function and codec_dev, as seen in its hdmi_remove function. The HDMI audio helper then happily tries calling said null function pointer, and produces an Oops as a result. Fix this by only executing the callback if fn is non-null. This means the .plugged_cb and .plugged_cb_dev members still get appropriately cleared. Fixes: baf6166 ("drm/connector: implement generic HDMI audio helpers") Signed-off-by: Nicolas Frattaroli <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Link: https://lore.kernel.org/r/20250527-hdmi-audio-helper-remove-fix-v1-1-6cf77de364d8@collabora.com Signed-off-by: Dmitry Baryshkov <[email protected]>
1 parent 4673dec commit be9b3f9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/gpu/drm/display/drm_hdmi_audio_helper.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ static int drm_connector_hdmi_audio_hook_plugged_cb(struct device *dev,
103103
connector->hdmi_audio.plugged_cb = fn;
104104
connector->hdmi_audio.plugged_cb_dev = codec_dev;
105105

106-
fn(codec_dev, connector->hdmi_audio.last_state);
106+
if (fn)
107+
fn(codec_dev, connector->hdmi_audio.last_state);
107108

108109
mutex_unlock(&connector->hdmi_audio.lock);
109110

0 commit comments

Comments
 (0)