mirror of
https://github.com/torvalds/linux.git
synced 2024-11-16 17:12:06 +00:00
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>
This commit is contained in:
parent
22f23fcc13
commit
94dee76082
@ -243,20 +243,31 @@ static int ivtv_validate_speed(int cur_speed, int new_speed)
|
|||||||
int fact = new_speed < 0 ? -1 : 1;
|
int fact = new_speed < 0 ? -1 : 1;
|
||||||
int s;
|
int s;
|
||||||
|
|
||||||
if (new_speed < 0) new_speed = -new_speed;
|
if (cur_speed == 0)
|
||||||
if (cur_speed < 0) cur_speed = -cur_speed;
|
cur_speed = 1000;
|
||||||
|
if (new_speed < 0)
|
||||||
|
new_speed = -new_speed;
|
||||||
|
if (cur_speed < 0)
|
||||||
|
cur_speed = -cur_speed;
|
||||||
|
|
||||||
if (cur_speed <= new_speed) {
|
if (cur_speed <= new_speed) {
|
||||||
if (new_speed > 1500) return fact * 2000;
|
if (new_speed > 1500)
|
||||||
if (new_speed > 1000) return fact * 1500;
|
return fact * 2000;
|
||||||
|
if (new_speed > 1000)
|
||||||
|
return fact * 1500;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (new_speed >= 2000) return fact * 2000;
|
if (new_speed >= 2000)
|
||||||
if (new_speed >= 1500) return fact * 1500;
|
return fact * 2000;
|
||||||
if (new_speed >= 1000) return fact * 1000;
|
if (new_speed >= 1500)
|
||||||
|
return fact * 1500;
|
||||||
|
if (new_speed >= 1000)
|
||||||
|
return fact * 1000;
|
||||||
}
|
}
|
||||||
if (new_speed == 0) return 1000;
|
if (new_speed == 0)
|
||||||
if (new_speed == 1 || new_speed == 1000) return fact * new_speed;
|
return 1000;
|
||||||
|
if (new_speed == 1 || new_speed == 1000)
|
||||||
|
return fact * new_speed;
|
||||||
|
|
||||||
s = new_speed;
|
s = new_speed;
|
||||||
new_speed = 1000 / new_speed;
|
new_speed = 1000 / new_speed;
|
||||||
|
Loading…
Reference in New Issue
Block a user