From patchwork Tue Feb 25 12:52:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 3716561 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 47C039F2F7 for ; Tue, 25 Feb 2014 12:53:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 85AE7201E4 for ; Tue, 25 Feb 2014 12:53:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B6B04201D3 for ; Tue, 25 Feb 2014 12:53:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752639AbaBYMx1 (ORCPT ); Tue, 25 Feb 2014 07:53:27 -0500 Received: from smtp-vbr2.xs4all.nl ([194.109.24.22]:3540 "EHLO smtp-vbr2.xs4all.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752530AbaBYMxX (ORCPT ); Tue, 25 Feb 2014 07:53:23 -0500 Received: from tschai.lan (209.80-203-20.nextgentel.com [80.203.20.209]) (authenticated bits=0) by smtp-vbr2.xs4all.nl (8.13.8/8.13.8) with ESMTP id s1PCrCXv063026; Tue, 25 Feb 2014 13:53:13 +0100 (CET) (envelope-from hverkuil@xs4all.nl) Received: from test-media.192.168.1.1 (test [192.168.1.27]) by tschai.lan (Postfix) with ESMTPSA id AF9872A0B1C; Tue, 25 Feb 2014 13:52:57 +0100 (CET) From: Hans Verkuil To: linux-media@vger.kernel.org Cc: pawel@osciak.com, s.nawrocki@samsung.com, m.szyprowski@samsung.com, Hans Verkuil Subject: [REVIEWv2 PATCH 13/15] vb2: replace BUG by WARN_ON Date: Tue, 25 Feb 2014 13:52:53 +0100 Message-Id: <1393332775-44067-14-git-send-email-hverkuil@xs4all.nl> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1393332775-44067-1-git-send-email-hverkuil@xs4all.nl> References: <1393332775-44067-1-git-send-email-hverkuil@xs4all.nl> X-Virus-Scanned: by XS4ALL Virus Scanner Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Hans Verkuil No need to oops for this, WARN_ON is good enough. Signed-off-by: Hans Verkuil --- drivers/media/v4l2-core/videobuf2-core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 3815f9c..68f3def 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -2536,9 +2536,9 @@ static int __vb2_init_fileio(struct vb2_queue *q, int read) /* * Sanity check */ - if ((read && !(q->io_modes & VB2_READ)) || - (!read && !(q->io_modes & VB2_WRITE))) - BUG(); + if (WARN_ON((read && !(q->io_modes & VB2_READ)) || + (!read && !(q->io_modes & VB2_WRITE)))) + return -EINVAL; /* * Check if device supports mapping buffers to kernel virtual space.