public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: David Henningsson <david.henningsson@canonical.com>
Cc: Christine Spang <christine.spang@oracle.com>,
	Sasha Levin <sasha.levin@oracle.com>,
	alsa-devel@alsa-project.org, Jamie Iles <jamie.iles@oracle.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [alsa-devel] [PATCH] Make snd_BUG_ON() always evaluate and return the conditional expression.
Date: Wed, 06 Mar 2013 15:04:56 +0100	[thread overview]
Message-ID: <s5hip544oaf.wl%tiwai@suse.de> (raw)
In-Reply-To: <51374968.4070805@canonical.com>

At Wed, 06 Mar 2013 14:49:28 +0100,
David Henningsson wrote:
> 
> 2013-03-05 21:41, Christine Spang skrev:
> > On 03/05/2013 04:05 AM, Takashi Iwai wrote:
> >> At Mon,  4 Mar 2013 17:02:59 -0500,
> >> Christine Spang wrote:
> >>> Having snd_BUG_ON() only evaluate its conditional when CONFIG_SND_DEBUG
> >>> is set leads to frequent bugs, since other similar macros in the kernel
> >>> have different behavior. Let's make snd_BUG_ON() act like those macros
> >>> so it will stop being accidentally misused.
> >>>
> >>> Signed-off-by: Christine Spang <christine.spang@oracle.com>
> >> Sounds reasonable.  The dependency on CONFIG_SND_DEBUG was for
> >> allowing more optimization, but since we use this for more places than
> >> expected, this change would be safer indeed.
> >>
> >> If no one has objection, I'll apply it for 3.10 kernel.
> 
> If snd_BUG_ON now works like WARN_ON rather than BUG_ON (at least it 
> does with this change, if I understand things right),

No, snd_BUG_ON() has always been equivalent with WARN_ON() when
CONFIG_SND_DEBUG is set.  But it's empty when CONFIG_SND_DEBUG=n
(i.e. the conditional is ignored).

Christine's patch changes the behavior in only the latter case.  It
enables the conditional but doesn't involve WARN_ON(), so the check is
done silently.

> maybe we should 
> rename it to snd_WARN_ON for consistency?

Maybe.  As an additional note, BUG_ON() should be almost never used in
the normal driver codes. If you find BUG_ON() in a driver code, doubt
it twice whether it's right.


Takashi

      reply	other threads:[~2013-03-06 14:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-04 22:02 [PATCH] Make snd_BUG_ON() always evaluate and return the conditional expression Christine Spang
2013-03-05  9:05 ` Takashi Iwai
2013-03-05 20:41   ` Christine Spang
2013-03-06  9:35     ` Takashi Iwai
2013-03-06 13:49     ` [alsa-devel] " David Henningsson
2013-03-06 14:04       ` Takashi Iwai [this message]

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=s5hip544oaf.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=christine.spang@oracle.com \
    --cc=david.henningsson@canonical.com \
    --cc=jamie.iles@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sasha.levin@oracle.com \
    /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