diff mbox series

saa7134: fix smatch error

Message ID 22c95835-960d-d0af-b171-55c9d590676f@xs4all.nl
State New
Headers show
Series saa7134: fix smatch error | expand

Commit Message

Hans Verkuil Nov. 10, 2020, 8:10 a.m. UTC
Fix this smatch error:

saa7134-video.c:1286 saa7134_g_fmt_vid_overlay() error: we previously assumed 'f->fmt.win.clips' could be null (see line 1279)

This is actually a false error since if f->fmt.win.clips is NULL, clipcount
will be set to 0, so the clips array won't be touched, but it doesn't hurt
to make this explicit in the code.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
 drivers/media/pci/saa7134/saa7134-video.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/media/pci/saa7134/saa7134-video.c b/drivers/media/pci/saa7134/saa7134-video.c
index c24716f4ce23..0f9d6b9edb90 100644
--- a/drivers/media/pci/saa7134/saa7134-video.c
+++ b/drivers/media/pci/saa7134/saa7134-video.c
@@ -1276,8 +1276,10 @@  static int saa7134_g_fmt_vid_overlay(struct file *file, void *priv,
 		return -EINVAL;
 	}
 	f->fmt.win = dev->win;
-	if (!f->fmt.win.clips)
-		clipcount = 0;
+	if (!f->fmt.win.clips) {
+		f->fmt.win.clipcount = 0;
+		return 0;
+	}
 	if (dev->nclips < clipcount)
 		clipcount = dev->nclips;
 	f->fmt.win.clipcount = clipcount;