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

[media] vb2: Fix compilation breakage when !CONFIG_BUG

Commit 77a3c6fd90c9 ("[media] vb2: Don't WARN when v4l2_buffer.bytesused
is 0 for multiplanar buffers") uses the __WARN() macro which isn't
defined when CONFIG_BUG isn't set. This introduces a compilation
breakage. Fix it by using WARN_ON() instead.

The commit was also broken in that it merged v1 of the patch while a new
v2 version had been submitted, reviewed and acked. Fix it by
incorporating the changes from v1 to v2.

Fixes: 77a3c6fd90c9 ("[media] vb2: Don't WARN when v4l2_buffer.bytesused is 0 for multiplanar buffers")

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

authored by

Laurent Pinchart and committed by
Mauro Carvalho Chehab
2fa3dc4e 6d058c56

+7 -7
+7 -7
drivers/media/v4l2-core/videobuf2-core.c
··· 1254 1254 1255 1255 static void vb2_warn_zero_bytesused(struct vb2_buffer *vb) 1256 1256 { 1257 - static bool __check_once __read_mostly; 1257 + static bool check_once; 1258 1258 1259 - if (__check_once) 1259 + if (check_once) 1260 1260 return; 1261 1261 1262 - __check_once = true; 1263 - __WARN(); 1262 + check_once = true; 1263 + WARN_ON(1); 1264 1264 1265 - pr_warn_once("use of bytesused == 0 is deprecated and will be removed in the future,\n"); 1265 + pr_warn("use of bytesused == 0 is deprecated and will be removed in the future,\n"); 1266 1266 if (vb->vb2_queue->allow_zero_bytesused) 1267 - pr_warn_once("use VIDIOC_DECODER_CMD(V4L2_DEC_CMD_STOP) instead.\n"); 1267 + pr_warn("use VIDIOC_DECODER_CMD(V4L2_DEC_CMD_STOP) instead.\n"); 1268 1268 else 1269 - pr_warn_once("use the actual size instead.\n"); 1269 + pr_warn("use the actual size instead.\n"); 1270 1270 } 1271 1271 1272 1272 /**