aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Goode <emilgoode@gmail.com>2014-06-24 17:42:27 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-07-22 20:23:53 -0400
commit20721185c9896570ec9d93175e10e62e1b517ebb (patch)
tree1221d66f0b2f81161cb806c189db71e7c5353ac3
parent18d75a09e954b72de6e85a8fb172835be547a48a (diff)
[media] Remove checks of struct member addresses
This removes checks of struct member addresses since they likely result in the condition always being true. Also in the stb6100_get_bandwidth and tda8261_get_bandwidth functions the pointers frontend_ops and tuner_ops are assigned the same addresses twice. Signed-off-by: Emil Goode <emilgoode@gmail.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r--drivers/media/dvb-frontends/stb6100_cfg.h30
-rw-r--r--drivers/media/dvb-frontends/stb6100_proc.h34
-rw-r--r--drivers/media/dvb-frontends/stv0367.c9
-rw-r--r--drivers/media/dvb-frontends/tda8261_cfg.h21
4 files changed, 25 insertions, 69 deletions
diff --git a/drivers/media/dvb-frontends/stb6100_cfg.h b/drivers/media/dvb-frontends/stb6100_cfg.h
index 6314d18c797a..0e10ad89d1f1 100644
--- a/drivers/media/dvb-frontends/stb6100_cfg.h
+++ b/drivers/media/dvb-frontends/stb6100_cfg.h
@@ -21,15 +21,11 @@
21 21
22static int stb6100_get_frequency(struct dvb_frontend *fe, u32 *frequency) 22static int stb6100_get_frequency(struct dvb_frontend *fe, u32 *frequency)
23{ 23{
24 struct dvb_frontend_ops *frontend_ops = NULL; 24 struct dvb_frontend_ops *frontend_ops = &fe->ops;
25 struct dvb_tuner_ops *tuner_ops = NULL; 25 struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
26 struct tuner_state t_state; 26 struct tuner_state t_state;
27 int err = 0; 27 int err = 0;
28 28
29 if (&fe->ops)
30 frontend_ops = &fe->ops;
31 if (&frontend_ops->tuner_ops)
32 tuner_ops = &frontend_ops->tuner_ops;
33 if (tuner_ops->get_state) { 29 if (tuner_ops->get_state) {
34 if ((err = tuner_ops->get_state(fe, DVBFE_TUNER_FREQUENCY, &t_state)) < 0) { 30 if ((err = tuner_ops->get_state(fe, DVBFE_TUNER_FREQUENCY, &t_state)) < 0) {
35 printk("%s: Invalid parameter\n", __func__); 31 printk("%s: Invalid parameter\n", __func__);
@@ -42,16 +38,13 @@ static int stb6100_get_frequency(struct dvb_frontend *fe, u32 *frequency)
42 38
43static int stb6100_set_frequency(struct dvb_frontend *fe, u32 frequency) 39static int stb6100_set_frequency(struct dvb_frontend *fe, u32 frequency)
44{ 40{
45 struct dvb_frontend_ops *frontend_ops = NULL; 41 struct dvb_frontend_ops *frontend_ops = &fe->ops;
46 struct dvb_tuner_ops *tuner_ops = NULL; 42 struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
47 struct tuner_state t_state; 43 struct tuner_state t_state;
48 int err = 0; 44 int err = 0;
49 45
50 t_state.frequency = frequency; 46 t_state.frequency = frequency;
51 if (&fe->ops) 47
52 frontend_ops = &fe->ops;
53 if (&frontend_ops->tuner_ops)
54 tuner_ops = &frontend_ops->tuner_ops;
55 if (tuner_ops->set_state) { 48 if (tuner_ops->set_state) {
56 if ((err = tuner_ops->set_state(fe, DVBFE_TUNER_FREQUENCY, &t_state)) < 0) { 49 if ((err = tuner_ops->set_state(fe, DVBFE_TUNER_FREQUENCY, &t_state)) < 0) {
57 printk("%s: Invalid parameter\n", __func__); 50 printk("%s: Invalid parameter\n", __func__);
@@ -68,10 +61,6 @@ static int stb6100_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
68 struct tuner_state t_state; 61 struct tuner_state t_state;
69 int err = 0; 62 int err = 0;
70 63
71 if (&fe->ops)
72 frontend_ops = &fe->ops;
73 if (&frontend_ops->tuner_ops)
74 tuner_ops = &frontend_ops->tuner_ops;
75 if (tuner_ops->get_state) { 64 if (tuner_ops->get_state) {
76 if ((err = tuner_ops->get_state(fe, DVBFE_TUNER_BANDWIDTH, &t_state)) < 0) { 65 if ((err = tuner_ops->get_state(fe, DVBFE_TUNER_BANDWIDTH, &t_state)) < 0) {
77 printk("%s: Invalid parameter\n", __func__); 66 printk("%s: Invalid parameter\n", __func__);
@@ -84,16 +73,13 @@ static int stb6100_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
84 73
85static int stb6100_set_bandwidth(struct dvb_frontend *fe, u32 bandwidth) 74static int stb6100_set_bandwidth(struct dvb_frontend *fe, u32 bandwidth)
86{ 75{
87 struct dvb_frontend_ops *frontend_ops = NULL; 76 struct dvb_frontend_ops *frontend_ops = &fe->ops;
88 struct dvb_tuner_ops *tuner_ops = NULL; 77 struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
89 struct tuner_state t_state; 78 struct tuner_state t_state;
90 int err = 0; 79 int err = 0;
91 80
92 t_state.bandwidth = bandwidth; 81 t_state.bandwidth = bandwidth;
93 if (&fe->ops) 82
94 frontend_ops = &fe->ops;
95 if (&frontend_ops->tuner_ops)
96 tuner_ops = &frontend_ops->tuner_ops;
97 if (tuner_ops->set_state) { 83 if (tuner_ops->set_state) {
98 if ((err = tuner_ops->set_state(fe, DVBFE_TUNER_BANDWIDTH, &t_state)) < 0) { 84 if ((err = tuner_ops->set_state(fe, DVBFE_TUNER_BANDWIDTH, &t_state)) < 0) {
99 printk("%s: Invalid parameter\n", __func__); 85 printk("%s: Invalid parameter\n", __func__);
diff --git a/drivers/media/dvb-frontends/stb6100_proc.h b/drivers/media/dvb-frontends/stb6100_proc.h
index 112163a48622..bd8a0ec9e2cc 100644
--- a/drivers/media/dvb-frontends/stb6100_proc.h
+++ b/drivers/media/dvb-frontends/stb6100_proc.h
@@ -19,15 +19,11 @@
19 19
20static int stb6100_get_freq(struct dvb_frontend *fe, u32 *frequency) 20static int stb6100_get_freq(struct dvb_frontend *fe, u32 *frequency)
21{ 21{
22 struct dvb_frontend_ops *frontend_ops = NULL; 22 struct dvb_frontend_ops *frontend_ops = &fe->ops;
23 struct dvb_tuner_ops *tuner_ops = NULL; 23 struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
24 struct tuner_state state; 24 struct tuner_state state;
25 int err = 0; 25 int err = 0;
26 26
27 if (&fe->ops)
28 frontend_ops = &fe->ops;
29 if (&frontend_ops->tuner_ops)
30 tuner_ops = &frontend_ops->tuner_ops;
31 if (tuner_ops->get_state) { 27 if (tuner_ops->get_state) {
32 if (frontend_ops->i2c_gate_ctrl) 28 if (frontend_ops->i2c_gate_ctrl)
33 frontend_ops->i2c_gate_ctrl(fe, 1); 29 frontend_ops->i2c_gate_ctrl(fe, 1);
@@ -49,16 +45,13 @@ static int stb6100_get_freq(struct dvb_frontend *fe, u32 *frequency)
49 45
50static int stb6100_set_freq(struct dvb_frontend *fe, u32 frequency) 46static int stb6100_set_freq(struct dvb_frontend *fe, u32 frequency)
51{ 47{
52 struct dvb_frontend_ops *frontend_ops = NULL; 48 struct dvb_frontend_ops *frontend_ops = &fe->ops;
53 struct dvb_tuner_ops *tuner_ops = NULL; 49 struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
54 struct tuner_state state; 50 struct tuner_state state;
55 int err = 0; 51 int err = 0;
56 52
57 state.frequency = frequency; 53 state.frequency = frequency;
58 if (&fe->ops) 54
59 frontend_ops = &fe->ops;
60 if (&frontend_ops->tuner_ops)
61 tuner_ops = &frontend_ops->tuner_ops;
62 if (tuner_ops->set_state) { 55 if (tuner_ops->set_state) {
63 if (frontend_ops->i2c_gate_ctrl) 56 if (frontend_ops->i2c_gate_ctrl)
64 frontend_ops->i2c_gate_ctrl(fe, 1); 57 frontend_ops->i2c_gate_ctrl(fe, 1);
@@ -79,15 +72,11 @@ static int stb6100_set_freq(struct dvb_frontend *fe, u32 frequency)
79 72
80static int stb6100_get_bandw(struct dvb_frontend *fe, u32 *bandwidth) 73static int stb6100_get_bandw(struct dvb_frontend *fe, u32 *bandwidth)
81{ 74{
82 struct dvb_frontend_ops *frontend_ops = NULL; 75 struct dvb_frontend_ops *frontend_ops = &fe->ops;
83 struct dvb_tuner_ops *tuner_ops = NULL; 76 struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
84 struct tuner_state state; 77 struct tuner_state state;
85 int err = 0; 78 int err = 0;
86 79
87 if (&fe->ops)
88 frontend_ops = &fe->ops;
89 if (&frontend_ops->tuner_ops)
90 tuner_ops = &frontend_ops->tuner_ops;
91 if (tuner_ops->get_state) { 80 if (tuner_ops->get_state) {
92 if (frontend_ops->i2c_gate_ctrl) 81 if (frontend_ops->i2c_gate_ctrl)
93 frontend_ops->i2c_gate_ctrl(fe, 1); 82 frontend_ops->i2c_gate_ctrl(fe, 1);
@@ -109,16 +98,13 @@ static int stb6100_get_bandw(struct dvb_frontend *fe, u32 *bandwidth)
109 98
110static int stb6100_set_bandw(struct dvb_frontend *fe, u32 bandwidth) 99static int stb6100_set_bandw(struct dvb_frontend *fe, u32 bandwidth)
111{ 100{
112 struct dvb_frontend_ops *frontend_ops = NULL; 101 struct dvb_frontend_ops *frontend_ops = &fe->ops;
113 struct dvb_tuner_ops *tuner_ops = NULL; 102 struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
114 struct tuner_state state; 103 struct tuner_state state;
115 int err = 0; 104 int err = 0;
116 105
117 state.bandwidth = bandwidth; 106 state.bandwidth = bandwidth;
118 if (&fe->ops) 107
119 frontend_ops = &fe->ops;
120 if (&frontend_ops->tuner_ops)
121 tuner_ops = &frontend_ops->tuner_ops;
122 if (tuner_ops->set_state) { 108 if (tuner_ops->set_state) {
123 if (frontend_ops->i2c_gate_ctrl) 109 if (frontend_ops->i2c_gate_ctrl)
124 frontend_ops->i2c_gate_ctrl(fe, 1); 110 frontend_ops->i2c_gate_ctrl(fe, 1);
diff --git a/drivers/media/dvb-frontends/stv0367.c b/drivers/media/dvb-frontends/stv0367.c
index 458772739423..59b6e661acc0 100644
--- a/drivers/media/dvb-frontends/stv0367.c
+++ b/drivers/media/dvb-frontends/stv0367.c
@@ -922,18 +922,13 @@ static int stv0367ter_gate_ctrl(struct dvb_frontend *fe, int enable)
922 922
923static u32 stv0367_get_tuner_freq(struct dvb_frontend *fe) 923static u32 stv0367_get_tuner_freq(struct dvb_frontend *fe)
924{ 924{
925 struct dvb_frontend_ops *frontend_ops = NULL; 925 struct dvb_frontend_ops *frontend_ops = &fe->ops;
926 struct dvb_tuner_ops *tuner_ops = NULL; 926 struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
927 u32 freq = 0; 927 u32 freq = 0;
928 int err = 0; 928 int err = 0;
929 929
930 dprintk("%s:\n", __func__); 930 dprintk("%s:\n", __func__);
931 931
932
933 if (&fe->ops)
934 frontend_ops = &fe->ops;
935 if (&frontend_ops->tuner_ops)
936 tuner_ops = &frontend_ops->tuner_ops;
937 if (tuner_ops->get_frequency) { 932 if (tuner_ops->get_frequency) {
938 err = tuner_ops->get_frequency(fe, &freq); 933 err = tuner_ops->get_frequency(fe, &freq);
939 if (err < 0) { 934 if (err < 0) {
diff --git a/drivers/media/dvb-frontends/tda8261_cfg.h b/drivers/media/dvb-frontends/tda8261_cfg.h
index 46710744173b..7de65c302e08 100644
--- a/drivers/media/dvb-frontends/tda8261_cfg.h
+++ b/drivers/media/dvb-frontends/tda8261_cfg.h
@@ -19,15 +19,11 @@
19 19
20static int tda8261_get_frequency(struct dvb_frontend *fe, u32 *frequency) 20static int tda8261_get_frequency(struct dvb_frontend *fe, u32 *frequency)
21{ 21{
22 struct dvb_frontend_ops *frontend_ops = NULL; 22 struct dvb_frontend_ops *frontend_ops = &fe->ops;
23 struct dvb_tuner_ops *tuner_ops = NULL; 23 struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
24 struct tuner_state t_state; 24 struct tuner_state t_state;
25 int err = 0; 25 int err = 0;
26 26
27 if (&fe->ops)
28 frontend_ops = &fe->ops;
29 if (&frontend_ops->tuner_ops)
30 tuner_ops = &frontend_ops->tuner_ops;
31 if (tuner_ops->get_state) { 27 if (tuner_ops->get_state) {
32 if ((err = tuner_ops->get_state(fe, DVBFE_TUNER_FREQUENCY, &t_state)) < 0) { 28 if ((err = tuner_ops->get_state(fe, DVBFE_TUNER_FREQUENCY, &t_state)) < 0) {
33 printk("%s: Invalid parameter\n", __func__); 29 printk("%s: Invalid parameter\n", __func__);
@@ -41,16 +37,13 @@ static int tda8261_get_frequency(struct dvb_frontend *fe, u32 *frequency)
41 37
42static int tda8261_set_frequency(struct dvb_frontend *fe, u32 frequency) 38static int tda8261_set_frequency(struct dvb_frontend *fe, u32 frequency)
43{ 39{
44 struct dvb_frontend_ops *frontend_ops = NULL; 40 struct dvb_frontend_ops *frontend_ops = &fe->ops;
45 struct dvb_tuner_ops *tuner_ops = NULL; 41 struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
46 struct tuner_state t_state; 42 struct tuner_state t_state;
47 int err = 0; 43 int err = 0;
48 44
49 t_state.frequency = frequency; 45 t_state.frequency = frequency;
50 if (&fe->ops) 46
51 frontend_ops = &fe->ops;
52 if (&frontend_ops->tuner_ops)
53 tuner_ops = &frontend_ops->tuner_ops;
54 if (tuner_ops->set_state) { 47 if (tuner_ops->set_state) {
55 if ((err = tuner_ops->set_state(fe, DVBFE_TUNER_FREQUENCY, &t_state)) < 0) { 48 if ((err = tuner_ops->set_state(fe, DVBFE_TUNER_FREQUENCY, &t_state)) < 0) {
56 printk("%s: Invalid parameter\n", __func__); 49 printk("%s: Invalid parameter\n", __func__);
@@ -68,10 +61,6 @@ static int tda8261_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
68 struct tuner_state t_state; 61 struct tuner_state t_state;
69 int err = 0; 62 int err = 0;
70 63
71 if (&fe->ops)
72 frontend_ops = &fe->ops;
73 if (&frontend_ops->tuner_ops)
74 tuner_ops = &frontend_ops->tuner_ops;
75 if (tuner_ops->get_state) { 64 if (tuner_ops->get_state) {
76 if ((err = tuner_ops->get_state(fe, DVBFE_TUNER_BANDWIDTH, &t_state)) < 0) { 65 if ((err = tuner_ops->get_state(fe, DVBFE_TUNER_BANDWIDTH, &t_state)) < 0) {
77 printk("%s: Invalid parameter\n", __func__); 66 printk("%s: Invalid parameter\n", __func__);