Skip to contentSkip to conversation

media: dvb-frontends/stv0900_core.c: remove unnecessary null pointer check

PATCH New Cong Ding 1 participant 2 messages Jan 15, 2013 Media (V4L/DVB)

lore
Share & tools
lore

Cong Ding

author
#0 lore raw

PATCH 1/1 media: dvb-frontends/stv0900_core.c: remove unnecessary null pointer check

The address of a variable is impossible to be null, so we remove the check.

---
 drivers/media/dvb-frontends/stv0900_core.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/media/dvb-frontends/stv0900_core.c +2 -5
index 0fb34e1..612b872 100644
@@ -524,11 +524,8 @@ void stv0900_set_tuner(struct dvb_frontend *fe, u32 frequency,
 	struct dvb_frontend_ops *frontend_ops = NULL;
 	struct dvb_tuner_ops *tuner_ops = NULL;
 
-	if (&fe->ops)
-		frontend_ops = &fe->ops;
-
-	if (&frontend_ops->tuner_ops)
-		tuner_ops = &frontend_ops->tuner_ops;
+	frontend_ops = &fe->ops;
+	tuner_ops = &frontend_ops->tuner_ops;
 
 	if (tuner_ops->set_frequency) {
 		if ((tuner_ops->set_frequency(fe, frequency)) < 0)
Signature · 1 line
1.7.10.4
author
#1 lore raw

PATCH 1/1 media: dvb-frontends: remove unnecessary null pointer check

The address of a variable is impossible to be null, so we remove the check.

---
sorry for sending again. I didn't notice there are another 2 places with the same issue.
- cong

 drivers/media/dvb-frontends/stv0900_core.c |   14 ++++----------
 drivers/media/dvb-frontends/stv0900_sw.c   |    7 ++-----
 2 files changed, 6 insertions(+), 15 deletions(-)
drivers/media/dvb-frontends/stv0900_core.c +4 -10
index 0fb34e1..e5a87b5 100644
@@ -524,11 +524,8 @@ void stv0900_set_tuner(struct dvb_frontend *fe, u32 frequency,
 	struct dvb_frontend_ops *frontend_ops = NULL;
 	struct dvb_tuner_ops *tuner_ops = NULL;
 
-	if (&fe->ops)
-		frontend_ops = &fe->ops;
-
-	if (&frontend_ops->tuner_ops)
-		tuner_ops = &frontend_ops->tuner_ops;
+	frontend_ops = &fe->ops;
+	tuner_ops = &frontend_ops->tuner_ops;
 
 	if (tuner_ops->set_frequency) {
 		if ((tuner_ops->set_frequency(fe, frequency)) < 0)
@@ -552,11 +549,8 @@ void stv0900_set_bandwidth(struct dvb_frontend *fe, u32 bandwidth)
 	struct dvb_frontend_ops *frontend_ops = NULL;
 	struct dvb_tuner_ops *tuner_ops = NULL;
 
-	if (&fe->ops)
-		frontend_ops = &fe->ops;
-
-	if (&frontend_ops->tuner_ops)
-		tuner_ops = &frontend_ops->tuner_ops;
+	frontend_ops = &fe->ops;
+	tuner_ops = &frontend_ops->tuner_ops;
 
 	if (tuner_ops->set_bandwidth) {
 		if ((tuner_ops->set_bandwidth(fe, bandwidth)) < 0)
drivers/media/dvb-frontends/stv0900_sw.c +2 -5
index 4af2078..0a40edf 100644
@@ -1167,11 +1167,8 @@ static u32 stv0900_get_tuner_freq(struct dvb_frontend *fe)
 	struct dvb_tuner_ops *tuner_ops = NULL;
 	u32 freq = 0;
 
-	if (&fe->ops)
-		frontend_ops = &fe->ops;
-
-	if (&frontend_ops->tuner_ops)
-		tuner_ops = &frontend_ops->tuner_ops;
+	frontend_ops = &fe->ops;
+	tuner_ops = &frontend_ops->tuner_ops;
 
 	if (tuner_ops->get_frequency) {
 		if ((tuner_ops->get_frequency(fe, &freq)) < 0)
Signature · 1 line
1.7.10.4