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

media: pci: saa7164-core.c: replace if (cond) BUG() with BUG_ON()

Fix the following coccinelle reports:

drivers/media/pci/saa7164/saa7164-core.c:579:2-5:
WARNING: Use BUG_ON instead of if condition followed by BUG.

drivers/media/pci/saa7164/saa7164-core.c:592:3-6:
WARNING: Use BUG_ON instead of if condition followed by BUG.

drivers/media/pci/saa7164/saa7164-core.c:898:2-5:
WARNING: Use BUG_ON instead of if condition followed by BUG.

Found using - Coccinelle (http://coccinelle.lip6.fr)

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

authored by

Daniel W. S. Almeida and committed by
Mauro Carvalho Chehab
56149c8c d8018ec1

+5 -7
+5 -7
drivers/media/pci/saa7164/saa7164-core.c
··· 575 575 576 576 /* Find the current write point from the hardware */ 577 577 wp = saa7164_readl(port->bufcounter); 578 - if (wp > (port->hwcfg.buffercount - 1)) 579 - BUG(); 578 + 579 + BUG_ON(wp > (port->hwcfg.buffercount - 1)); 580 580 581 581 /* Find the previous buffer to the current write point */ 582 582 if (wp == 0) ··· 588 588 /* TODO: turn this into a worker thread */ 589 589 list_for_each_safe(c, n, &port->dmaqueue.list) { 590 590 buf = list_entry(c, struct saa7164_buffer, list); 591 - if (i++ > port->hwcfg.buffercount) 592 - BUG(); 591 + BUG_ON(i > port->hwcfg.buffercount); 592 + i++; 593 593 594 594 if (buf->idx == rp) { 595 595 /* Found the buffer, deal with it */ ··· 894 894 { 895 895 struct saa7164_port *port = NULL; 896 896 897 - if ((portnr < 0) || (portnr >= SAA7164_MAX_PORTS)) 898 - BUG(); 897 + BUG_ON((portnr < 0) || (portnr >= SAA7164_MAX_PORTS)); 899 898 900 899 port = &dev->ports[portnr]; 901 900 ··· 1562 1563 1563 1564 module_init(saa7164_init); 1564 1565 module_exit(saa7164_fini); 1565 -