From: Larry Finger <Larry.Finger@lwfinger.net>
To: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Larry Finger <Larry.Finger@lwfinger.net>,
Hans Verkuil <hans.verkuil@cisco.com>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
jrh <jharbestonus@gmail.com>
Subject: [PATCH] media: au0828: Convert BUG_ON to WARN_ONCE
Date: Sun, 8 Apr 2012 18:19:11 -0500 [thread overview]
Message-ID: <1333927151-13014-1-git-send-email-Larry.Finger@lwfinger.net> (raw)
In the mail thread at http://www.mythtv.org/pipermail/mythtv-users/2012-April/331164.html,
a kernel crash is triggered when trying to run mythtv with a HVR950Q tuner.
The crash condition is due to res_free() being called to free something that
has is not reserved. The actual reason for this mismatch of reserve/free is
not known; however, using a BUG_ON rather than a WARN_ON seems unfortunate.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---
drivers/media/video/au0828/au0828-video.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/media/video/au0828/au0828-video.c b/drivers/media/video/au0828/au0828-video.c
index 0b3e481..5c53e38 100644
--- a/drivers/media/video/au0828/au0828-video.c
+++ b/drivers/media/video/au0828/au0828-video.c
@@ -891,8 +891,13 @@ static int res_locked(struct au0828_dev *dev, unsigned int bit)
static void res_free(struct au0828_fh *fh, unsigned int bits)
{
struct au0828_dev *dev = fh->dev;
+ unsigned int bits2 = fh->resources & bits;
- BUG_ON((fh->resources & bits) != bits);
+ if (bits2 != bits) {
+ WARN_ONCE(true, "au0828: Trying to free resource 0x%x"
+ " without reserving it\n", bits);
+ return;
+ }
mutex_lock(&dev->lock);
fh->resources &= ~bits;
--
1.7.10
next reply other threads:[~2012-04-08 23:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-08 23:19 Larry Finger [this message]
2012-04-09 1:46 ` Devin Heitmueller
2012-04-09 2:16 ` Larry Finger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1333927151-13014-1-git-send-email-Larry.Finger@lwfinger.net \
--to=larry.finger@lwfinger.net \
--cc=hans.verkuil@cisco.com \
--cc=jharbestonus@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®