summaryrefslogtreecommitdiffstats
path: root/drivers/media/pci/mantis
diff options
context:
space:
mode:
authorMauro Carvalho Chehab2018-04-12 14:28:33 +0200
committerMauro Carvalho Chehab2018-04-17 11:50:05 +0200
commitcac61a1acb1def146c3900f1c8f7af4947d98814 (patch)
treee5658832786cc7024d32d7c22f616a5e3a9caecd /drivers/media/pci/mantis
parentmedia: st_rc: Don't stay on an IRQ handler forever (diff)
downloadkernel-qcow2-linux-cac61a1acb1def146c3900f1c8f7af4947d98814.tar.gz
kernel-qcow2-linux-cac61a1acb1def146c3900f1c8f7af4947d98814.tar.xz
kernel-qcow2-linux-cac61a1acb1def146c3900f1c8f7af4947d98814.zip
media: mantis: prevent staying forever in a loop at IRQ
As warned by smatch: drivers/media/pci/mantis/mantis_uart.c:105 mantis_uart_work() warn: this loop depends on readl() succeeding If something goes wrong at readl(), the logic will stay there inside an IRQ code forever. This is not the nicest thing to do :-) So, add a timeout there, preventing staying inside the IRQ for more than 10ms. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/pci/mantis')
-rw-r--r--drivers/media/pci/mantis/mantis_uart.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/media/pci/mantis/mantis_uart.c b/drivers/media/pci/mantis/mantis_uart.c
index 18f81c135996..b7765687e0c3 100644
--- a/drivers/media/pci/mantis/mantis_uart.c
+++ b/drivers/media/pci/mantis/mantis_uart.c
@@ -92,6 +92,7 @@ static void mantis_uart_work(struct work_struct *work)
{
struct mantis_pci *mantis = container_of(work, struct mantis_pci, uart_work);
u32 stat;
+ unsigned long timeout;
stat = mmread(MANTIS_UART_STAT);
@@ -102,9 +103,15 @@ static void mantis_uart_work(struct work_struct *work)
* MANTIS_UART_RXFIFO_DATA is only set if at least
* config->bytes + 1 bytes are in the FIFO.
*/
+
+ /* FIXME: is 10ms good enough ? */
+ timeout = jiffies + msecs_to_jiffies(10);
while (stat & MANTIS_UART_RXFIFO_DATA) {
mantis_uart_read(mantis);
stat = mmread(MANTIS_UART_STAT);
+
+ if (!time_is_after_jiffies(timeout))
+ break;
}
/* re-enable UART (RX) interrupt */