From ea5154a0c5b625788b0c707769883a88af02ac86 Mon Sep 17 00:00:00 2001 From: "nengwen.chen" Date: Fri, 15 Mar 2019 21:50:54 +0800 Subject: [PATCH] dtv_demod: Prevent NULL pointer crash caused by tuner attach failure [1/1] 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 --- drivers/amlogic/media/dtv_demod/aml_demod.c | 4 +++- drivers/amlogic/media/dtv_demod/amlfrontend.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/amlogic/media/dtv_demod/aml_demod.c b/drivers/amlogic/media/dtv_demod/aml_demod.c index 181c4a3..c350537 100644 --- a/drivers/amlogic/media/dtv_demod/aml_demod.c +++ b/drivers/amlogic/media/dtv_demod/aml_demod.c @@ -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; diff --git a/drivers/amlogic/media/dtv_demod/amlfrontend.c b/drivers/amlogic/media/dtv_demod/amlfrontend.c index f1bcfad..463ca08 100644 --- a/drivers/amlogic/media/dtv_demod/amlfrontend.c +++ b/drivers/amlogic/media/dtv_demod/amlfrontend.c @@ -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; } -- 2.7.4