1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>snd_BUG_ON()</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Writing an ALSA Driver"><link rel="up" href="useful-functions.html" title="Chapter 16. Useful Functions"><link rel="prev" href="useful-functions-snd-bug.html" title="snd_BUG()"><link rel="next" href="acknowledgments.html" title="Chapter 17. Acknowledgments"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><code class="function">snd_BUG_ON()</code></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="useful-functions-snd-bug.html">Prev</a> </td><th width="60%" align="center">Chapter 16. Useful Functions</th><td width="20%" align="right"> <a accesskey="n" href="acknowledgments.html">Next</a></td></tr></table><hr></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="useful-functions-snd-bug-on"></a><code class="function">snd_BUG_ON()</code></h2></div></div></div><p> 2 <code class="function">snd_BUG_ON()</code> macro is similar with 3 <code class="function">WARN_ON()</code> macro. For example, 4 5 </p><div class="informalexample"><pre class="programlisting"> 6 7 snd_BUG_ON(!pointer); 8 9 </pre></div><p> 10 11 or it can be used as the condition, 12 </p><div class="informalexample"><pre class="programlisting"> 13 14 if (snd_BUG_ON(non_zero_is_bug)) 15 return -EINVAL; 16 17 </pre></div><p> 18 19 </p><p> 20 The macro takes an conditional expression to evaluate. 21 When <code class="constant">CONFIG_SND_DEBUG</code>, is set, if the 22 expression is non-zero, it shows the warning message such as 23 <code class="computeroutput">BUG? (xxx)</code> 24 normally followed by stack trace. 25 26 In both cases it returns the evaluated value. 27 </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="useful-functions-snd-bug.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="useful-functions.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="acknowledgments.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><code class="function">snd_BUG()</code> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 17. Acknowledgments</td></tr></table></div></body></html> 28