vdac: fix crash issue
authorNian Jing <nian.jing@amlogic.com>
Fri, 12 Oct 2018 09:51:01 +0000 (17:51 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Sat, 13 Oct 2018 04:37:30 +0000 (21:37 -0700)
PD#174269: fix crash issue

Problem:
crash when unplug hdmi.null pointer visiting

Solution:
delete dts config,add null pointer protect

Verify:
test pass on p212

Change-Id: I5176aa4eb398b1bedf14b36ec6529c471e927530
Signed-off-by: Nian Jing <nian.jing@amlogic.com>
arch/arm/boot/dts/amlogic/gxl_p212_1g.dts
arch/arm/boot/dts/amlogic/gxl_p212_2g.dts
drivers/amlogic/media/vout/cvbs/cvbs_out.c
drivers/amlogic/media/vout/vdac/vdac_dev.c

index db79848..3a35ca9 100644 (file)
                fr_auto_policy = <0>;
        };
 
-       vdac {
-               compatible = "amlogic, vdac";
-               dev_name = "vdac";
-               status = "okay";
-       };
-
        cvbsout {
                compatible = "amlogic, cvbsout-gxl";
                dev_name = "cvbsout";
index feeddda..fcfbb39 100644 (file)
                fr_auto_policy = <0>;
        };
 
-       vdac {
-               compatible = "amlogic, vdac";
-               dev_name = "vdac";
-               status = "okay";
-       };
-
        cvbsout {
                compatible = "amlogic, cvbsout-gxl";
                dev_name = "cvbsout";
index 435dab5..455934e 100644 (file)
@@ -1440,7 +1440,7 @@ static int cvbsout_probe(struct platform_device *pdev)
                return -1;
        }
        info->cvbs_data = (struct meson_cvbsout_data *)match->data;
-       cvbs_log_info("%s£¬cpu_id:%d,name:%s\n", __func__,
+       cvbs_log_info("%scpu_id:%d,name:%s\n", __func__,
                info->cvbs_data->cpu_id, info->cvbs_data->name);
 
        cvbsout_get_config(&pdev->dev);
index 1ba9c1a..c103380 100644 (file)
@@ -339,6 +339,10 @@ EXPORT_SYMBOL(vdac_out_cntl1_bit3);
 
 void vdac_set_ctrl0_ctrl1(unsigned int ctrl0, unsigned int ctrl1)
 {
+       if (!s_vdac_data) {
+               pr_err("\n%s: s_vdac_data NULL\n", __func__);
+               return;
+       }
        if (s_vdac_data->cpu_id >= VDAC_CPU_G12AB) {
                vdac_hiu_reg_write(HHI_VDAC_CNTL0_G12A, ctrl0);
                vdac_hiu_reg_write(HHI_VDAC_CNTL1_G12A, ctrl1);
@@ -354,6 +358,11 @@ EXPORT_SYMBOL(vdac_set_ctrl0_ctrl1);
  */
 void vdac_enable(bool on, unsigned int module_sel)
 {
+       if (!s_vdac_data) {
+               pr_err("\n%s: s_vdac_data NULL\n", __func__);
+               return;
+       }
+
        pr_info("\n%s: on:%d,module_sel:%x\n", __func__, on, module_sel);
 
        mutex_lock(&vdac_mutex);
@@ -708,6 +717,7 @@ static int __init aml_vdac_init(void)
        pr_info("%s: module init\n", __func__);
 
        vdac_init_succ_flag = 0;
+       s_vdac_data = NULL;
 
        mutex_init(&vdac_mutex);