Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] s5p-tv: fix wait_event_timeout return handling

event API conformance testing with coccinelle spatches are being
used to locate API usage inconsistencies this triggert with:
./drivers/media/platform/s5p-tv/mixer_reg.c:364
incorrect check for negative return

Return type of wait_event_timeout is signed long not int and the
return type is >=0 always thus the negative check is unnecessary.
An appropriately named variable of type long is inserted and the
call fixed up aswell as the negative return check dropped.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

authored by

Nicholas Mc Guire and committed by
Mauro Carvalho Chehab
4f50efad 264d1cf8

+5 -7
+5 -7
drivers/media/platform/s5p-tv/mixer_reg.c
··· 357 357 358 358 int mxr_reg_wait4vsync(struct mxr_device *mdev) 359 359 { 360 - int ret; 360 + long time_left; 361 361 362 362 clear_bit(MXR_EVENT_VSYNC, &mdev->event_flags); 363 363 /* TODO: consider adding interruptible */ 364 - ret = wait_event_timeout(mdev->event_queue, 365 - test_bit(MXR_EVENT_VSYNC, &mdev->event_flags), 366 - msecs_to_jiffies(1000)); 367 - if (ret > 0) 364 + time_left = wait_event_timeout(mdev->event_queue, 365 + test_bit(MXR_EVENT_VSYNC, &mdev->event_flags), 366 + msecs_to_jiffies(1000)); 367 + if (time_left > 0) 368 368 return 0; 369 - if (ret < 0) 370 - return ret; 371 369 mxr_warn(mdev, "no vsync detected - timeout\n"); 372 370 return -ETIME; 373 371 }