Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 11dab54c authored by Tatenda Chipeperekwa's avatar Tatenda Chipeperekwa
Browse files

platform/msm: fix audio codec function pointer update



Fix the audio codec function pointer update by validating the
existing pointer before attempting to clear it. This check is
necessary in order to avoid a possible null deference during
the cable disconnect use case when the audio codec has not
been previously registered.

Change-Id: I7b3bd3dd4a83f335799f960a68391c272af256e0
Signed-off-by: default avatarTatenda Chipeperekwa <tatendac@codeaurora.org>
parent 870ded18
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -246,7 +246,9 @@ static int msm_ext_disp_update_audio_ops(struct msm_ext_disp *ext_disp,

		pr_debug("codec ops set for %s\n", msm_ext_disp_name(type));
	} else if (state == EXT_DISPLAY_CABLE_DISCONNECT) {
		*ext_disp->ops = (struct msm_ext_disp_audio_codec_ops){NULL};
		if (ext_disp->ops)
			*ext_disp->ops =
				(struct msm_ext_disp_audio_codec_ops){NULL};
		ext_disp->current_disp = EXT_DISPLAY_TYPE_MAX;

		pr_debug("codec ops cleared for %s\n", msm_ext_disp_name(type));