dtv_demod: Prevent NULL pointer crash caused by tuner attach failure [1/1]
authornengwen.chen <nengwen.chen@amlogic.com>
Fri, 15 Mar 2019 13:50:54 +0000 (21:50 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Mon, 18 Mar 2019 12:19:12 +0000 (04:19 -0800)
PD#TV-1539

Problem:
Prevent NULL pointer crash caused by tuner attach failure.

Solution:
Prevent NULL pointer crash caused by tuner attach failure.

Verify:
verified by x301

Change-Id: I57cf32947775626467eb952dd2298ae9ec84601d
Signed-off-by: nengwen.chen <nengwen.chen@amlogic.com>
drivers/amlogic/media/dtv_demod/aml_demod.c
drivers/amlogic/media/dtv_demod/amlfrontend.c

index 181c4a3..c350537 100644 (file)
@@ -281,6 +281,7 @@ static long aml_demod_ioctl(struct file *file,
                dvbfe = aml_get_fe();/*get_si2177_tuner();*/
 #if 0
                if (dvbfe != NULL)
+                       if (dvbfe->ops.tuner_ops.get_strength)
                        strength = dvbfe->ops.tuner_ops.get_strength(dvbfe);
 #else
                strength = tuner_get_ch_power2();
@@ -324,7 +325,8 @@ static long aml_demod_ioctl(struct file *file,
        #if 0 /*ary temp for my_tool:*/
                if (dvbfe != NULL) {
                        pr_dbg("calling tuner ops\n");
-                       dvbfe->ops.tuner_ops.set_params(dvbfe);
+                       if (dvbfe->ops.tuner_ops.set_params)
+                               dvbfe->ops.tuner_ops.set_params(dvbfe);
                }
        #endif
                break;
index f1bcfad..463ca08 100644 (file)
@@ -4004,7 +4004,8 @@ static int delsys_set(struct dvb_frontend *fe, unsigned int delsys)
        else if (mode == AM_FE_ISDBT_N)
                fe->ops.info.type = FE_ISDBT;
 
-       fe->ops.tuner_ops.set_config(fe, NULL);
+       if (fe->ops.tuner_ops.set_config)
+               fe->ops.tuner_ops.set_config(fe, NULL);
 
        return 0;
 }