media: common: saa7146: replace BUG_ON by WARN_ON

No need for BUG_ON, WARN_ON is a lot friendlier.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
Hans Verkuil 2023-03-02 10:05:58 +00:00 committed by Mauro Carvalho Chehab
parent c79dbdae3a
commit 40e986c996
3 changed files with 15 additions and 9 deletions

View File

@ -37,7 +37,8 @@ void saa7146_setgpio(struct saa7146_dev *dev, int port, u32 data)
{ {
u32 value = 0; u32 value = 0;
BUG_ON(port > 3); if (WARN_ON(port > 3))
return;
value = saa7146_read(dev, GPIO_CTRL); value = saa7146_read(dev, GPIO_CTRL);
value &= ~(0xff << (8*port)); value &= ~(0xff << (8*port));
@ -148,7 +149,8 @@ static struct scatterlist* vmalloc_to_sg(unsigned char *virt, int nr_pages)
pg = vmalloc_to_page(virt); pg = vmalloc_to_page(virt);
if (NULL == pg) if (NULL == pg)
goto err; goto err;
BUG_ON(PageHighMem(pg)); if (WARN_ON(PageHighMem(pg)))
return NULL;
sg_set_page(&sglist[i], pg, PAGE_SIZE, 0); sg_set_page(&sglist[i], pg, PAGE_SIZE, 0);
} }
return sglist; return sglist;
@ -239,8 +241,9 @@ int saa7146_pgtable_build_single(struct pci_dev *pci, struct saa7146_pgtable *pt
int nr_pages = 0; int nr_pages = 0;
int i,p; int i,p;
BUG_ON(0 == sglen); if (WARN_ON(!sglen) ||
BUG_ON(list->offset > PAGE_SIZE); WARN_ON(list->offset > PAGE_SIZE))
return -EIO;
/* if we have a user buffer, the first page may not be /* if we have a user buffer, the first page may not be
aligned to a page boundary. */ aligned to a page boundary. */

View File

@ -68,7 +68,8 @@ int saa7146_buffer_queue(struct saa7146_dev *dev,
assert_spin_locked(&dev->slock); assert_spin_locked(&dev->slock);
DEB_EE("dev:%p, dmaq:%p, buf:%p\n", dev, q, buf); DEB_EE("dev:%p, dmaq:%p, buf:%p\n", dev, q, buf);
BUG_ON(!q); if (WARN_ON(!q))
return -EIO;
if (NULL == q->curr) { if (NULL == q->curr) {
q->curr = buf; q->curr = buf;
@ -109,7 +110,8 @@ void saa7146_buffer_next(struct saa7146_dev *dev,
{ {
struct saa7146_buf *buf,*next = NULL; struct saa7146_buf *buf,*next = NULL;
BUG_ON(!q); if (WARN_ON(!q))
return;
DEB_INT("dev:%p, dmaq:%p, vbi:%d\n", dev, q, vbi); DEB_INT("dev:%p, dmaq:%p, vbi:%d\n", dev, q, vbi);

View File

@ -542,9 +542,10 @@ static int calculate_video_dma_grab_planar(struct saa7146_dev* dev, struct saa71
int height = pix->height; int height = pix->height;
enum v4l2_field field = pix->field; enum v4l2_field field = pix->field;
BUG_ON(0 == buf->pt[0].dma); if (WARN_ON(!buf->pt[0].dma) ||
BUG_ON(0 == buf->pt[1].dma); WARN_ON(!buf->pt[1].dma) ||
BUG_ON(0 == buf->pt[2].dma); WARN_ON(!buf->pt[2].dma))
return -1;
DEB_CAP("[size=%dx%d,fields=%s]\n", DEB_CAP("[size=%dx%d,fields=%s]\n",
width, height, v4l2_field_names[field]); width, height, v4l2_field_names[field]);