diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-03-25 08:55:59 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-03-25 14:10:43 -0400 |
commit | 004e45d736bfe62159bd4dc1549eff414bd27496 (patch) | |
tree | 040379919d82f8d9f844324abecfd429a7dae02c /drivers/media/v4l2-core | |
parent | 6f8ca0b541c8bb542edb02dad68bd723625132e7 (diff) |
[media] tuner-core: handle errors when getting signal strength/afc
If those callbacks fail, it should return zero, and not a random
value. The previous code assumed that all drivers would only change
signal strength if it succeeds, but this may not be true.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/v4l2-core')
-rw-r--r-- | drivers/media/v4l2-core/tuner-core.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/media/v4l2-core/tuner-core.c b/drivers/media/v4l2-core/tuner-core.c index f1e8b402b7ca..cf9a9af90322 100644 --- a/drivers/media/v4l2-core/tuner-core.c +++ b/drivers/media/v4l2-core/tuner-core.c | |||
@@ -220,18 +220,20 @@ static void fe_standby(struct dvb_frontend *fe) | |||
220 | 220 | ||
221 | static int fe_has_signal(struct dvb_frontend *fe) | 221 | static int fe_has_signal(struct dvb_frontend *fe) |
222 | { | 222 | { |
223 | u16 strength = 0; | 223 | u16 strength; |
224 | 224 | ||
225 | fe->ops.tuner_ops.get_rf_strength(fe, &strength); | 225 | if (fe->ops.tuner_ops.get_rf_strength(fe, &strength) < 0) |
226 | return 0; | ||
226 | 227 | ||
227 | return strength; | 228 | return strength; |
228 | } | 229 | } |
229 | 230 | ||
230 | static int fe_get_afc(struct dvb_frontend *fe) | 231 | static int fe_get_afc(struct dvb_frontend *fe) |
231 | { | 232 | { |
232 | s32 afc = 0; | 233 | s32 afc; |
233 | 234 | ||
234 | fe->ops.tuner_ops.get_afc(fe, &afc); | 235 | if (fe->ops.tuner_ops.get_afc(fe, &afc) < 0) |
236 | return 0; | ||
235 | 237 | ||
236 | return afc; | 238 | return afc; |
237 | } | 239 | } |