]> git.baikalelectronics.ru Git - kernel.git/commitdiff
media: pci: cx23885: replace BUG with error return
authorHans Verkuil <hverkuil-cisco@xs4all.nl>
Fri, 21 Jul 2023 08:23:42 +0000 (10:23 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Sep 2023 09:11:06 +0000 (11:11 +0200)
[ Upstream commit 2e1796fd4904fdd6062a8e4589778ea899ea0c8d ]

It was completely unnecessary to use BUG in buffer_prepare().
Just replace it with an error return. This also fixes a smatch warning:

drivers/media/pci/cx23885/cx23885-video.c:422 buffer_prepare() error: uninitialized symbol 'ret'.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/pci/cx23885/cx23885-video.c

index 671fc0588e431bcfdcfb209d68ce093355886e84..9af2c5596121cba5ba9f3e4b9b6b70b08c5a7c99 100644 (file)
@@ -413,7 +413,7 @@ static int buffer_prepare(struct vb2_buffer *vb)
                                dev->height >> 1);
                break;
        default:
-               BUG();
+               return -EINVAL; /* should not happen */
        }
        dprintk(2, "[%p/%d] buffer_init - %dx%d %dbpp 0x%08x - dma=0x%08lx\n",
                buf, buf->vb.vb2_buf.index,