diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2008-04-26 08:26:13 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-29 17:41:34 -0400 |
commit | 94dee760823606ff6e191efc60e5bb98b81f1676 (patch) | |
tree | 1377bf7e0c09000ab94d664d4d5a39ee24ca7f7e /drivers | |
parent | 22f23fcc13e34a1efde8e7c37d157516fc1aa24f (diff) |
V4L/DVB (7758): ivtv: fix oops when itv->speed == 0 and VIDEO_CMD_PLAY is called
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-ioctl.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 6282387ca05..d508b5d0538 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -243,20 +243,31 @@ static int ivtv_validate_speed(int cur_speed, int new_speed) | |||
243 | int fact = new_speed < 0 ? -1 : 1; | 243 | int fact = new_speed < 0 ? -1 : 1; |
244 | int s; | 244 | int s; |
245 | 245 | ||
246 | if (new_speed < 0) new_speed = -new_speed; | 246 | if (cur_speed == 0) |
247 | if (cur_speed < 0) cur_speed = -cur_speed; | 247 | cur_speed = 1000; |
248 | if (new_speed < 0) | ||
249 | new_speed = -new_speed; | ||
250 | if (cur_speed < 0) | ||
251 | cur_speed = -cur_speed; | ||
248 | 252 | ||
249 | if (cur_speed <= new_speed) { | 253 | if (cur_speed <= new_speed) { |
250 | if (new_speed > 1500) return fact * 2000; | 254 | if (new_speed > 1500) |
251 | if (new_speed > 1000) return fact * 1500; | 255 | return fact * 2000; |
256 | if (new_speed > 1000) | ||
257 | return fact * 1500; | ||
252 | } | 258 | } |
253 | else { | 259 | else { |
254 | if (new_speed >= 2000) return fact * 2000; | 260 | if (new_speed >= 2000) |
255 | if (new_speed >= 1500) return fact * 1500; | 261 | return fact * 2000; |
256 | if (new_speed >= 1000) return fact * 1000; | 262 | if (new_speed >= 1500) |
257 | } | 263 | return fact * 1500; |
258 | if (new_speed == 0) return 1000; | 264 | if (new_speed >= 1000) |
259 | if (new_speed == 1 || new_speed == 1000) return fact * new_speed; | 265 | return fact * 1000; |
266 | } | ||
267 | if (new_speed == 0) | ||
268 | return 1000; | ||
269 | if (new_speed == 1 || new_speed == 1000) | ||
270 | return fact * new_speed; | ||
260 | 271 | ||
261 | s = new_speed; | 272 | s = new_speed; |
262 | new_speed = 1000 / new_speed; | 273 | new_speed = 1000 / new_speed; |