[PATCH v2 2/3] ALSA: sparc/dbri: Fix "possible condition with no effect" warning

From: wangdich9700

Date: Fri Jul 17 2026 - 05:18:04 EST


From: wangdicheng <wangdicheng@xxxxxxxxxx>

Fix a compiler warning about a condition with no effect:

sound/sparc/dbri.c:1843:1-3: WARNING: possible condition with no effect (if == else)

When DBRI_DEBUG is not defined, dprintk expands to an empty do-while
statement, making both branches of the if-else no-ops. Guard the entire
debug block with #ifdef DBRI_DEBUG to eliminate the warning and keep
the rval reference consistent with its declaration scope.

Signed-off-by: wangdicheng <wangdicheng@xxxxxxxxxx>
---
sound/sparc/dbri.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c
index 2f5f62079fa4..ccaa36525f8d 100644
--- a/sound/sparc/dbri.c
+++ b/sound/sparc/dbri.c
@@ -1840,6 +1840,7 @@ static void dbri_process_one_interrupt(struct snd_dbri *dbri, int x)
int rval = D_INTR_GETRVAL(x);
#endif

+#ifdef DBRI_DEBUG
if (channel == D_INTR_CMD) {
dprintk(D_CMD, "INTR: Command: %-5s Value:%d\n",
cmds[command], val);
@@ -1847,6 +1848,7 @@ static void dbri_process_one_interrupt(struct snd_dbri *dbri, int x)
dprintk(D_INT, "INTR: Chan:%d Code:%d Val:%#x\n",
channel, code, rval);
}
+#endif

switch (code) {
case D_INTR_CMDI:
--
2.25.1