From: hang cheng Date: Tue, 15 Jun 2021 06:37:48 +0000 (+0800) Subject: hdmitx: enhance robustness for export function [1/1] X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cd43f959b0667f79adc41088170304efdd658e68;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git hdmitx: enhance robustness for export function [1/1] PD#SWPL-52333 Problem: hdmitx audio setting function is called on TV platform and cause crash Solution: if hdmitx driver is not enabled, export function just return Verify: am301 Change-Id: I5e369e6951dfbb5da1784a7245b9c08bc7684c6f Signed-off-by: hang cheng --- diff --git a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c index 1eb0a986ee12..76da86e8cd00 100644 --- a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c +++ b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c @@ -1329,6 +1329,9 @@ static ssize_t show_hdcp22_base(struct device *dev, void hdmitx_audio_mute_op(unsigned int flag) { + if (hdmitx_device.hdmi_init != 1) + return; + hdmitx_device.tx_aud_cfg = flag; if (flag == 0) hdmitx_device.hwop.cntlconfig(&hdmitx_device, @@ -1341,6 +1344,9 @@ EXPORT_SYMBOL(hdmitx_audio_mute_op); void hdmitx_video_mute_op(unsigned int flag) { + if (hdmitx_device.hdmi_init != 1) + return; + if (flag == 0) { /* hdmitx_device.hwop.cntlconfig(&hdmitx_device, */ /* CONF_VIDEO_MUTE_OP, VIDEO_MUTE); */ @@ -4149,6 +4155,9 @@ void direct_hdcptx14_opr(enum rptx_hdcp14_cmd cmd, void *args) int rst; struct hdmitx_dev *hdev = &hdmitx_device; + if (hdmitx_device.hdmi_init != 1) + return; + pr_info("%s[%d] cmd: %d\n", __func__, __LINE__, cmd); switch (cmd) { case RPTX_HDCP14_OFF: @@ -5951,6 +5960,8 @@ int hdmitx_event_notifier_regist(struct notifier_block *nb) { int ret = 0; + if (hdmitx_device.hdmi_init != 1) + return 1; if (!nb) return ret; @@ -5971,6 +5982,8 @@ int hdmitx_event_notifier_unregist(struct notifier_block *nb) { int ret; + if (hdmitx_device.hdmi_init != 1) + return 1; ret = blocking_notifier_chain_unregister(&hdmitx_event_notify_list, nb); return ret;