Linux Sound subsystem development
 help / color / mirror / Atom feed
* [Question] Dead code in ALSA drivers - functions always returning 0?
@ 2026-01-31  8:14 Ingyu Jang
  2026-02-02 16:43 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Ingyu Jang @ 2026-01-31  8:14 UTC (permalink / raw)
  To: linux-sound; +Cc: perex, tiwai, Ingyu Jang

Hi,

I noticed several ALSA driver functions that always return 0, but their
return values are still checked by callers. I wanted to ask whether
these are intentional defensive coding or could be cleaned up.

1. sound/isa/cs423x/cs4236.c - snd_cs423x_pnp_init_mpu()
   This function handles pnp_activate_dev() failure internally by
   setting mpu_port[dev] = SNDRV_AUTO_PORT, then always returns 0.
   The caller checks "< 0" which can never be true.

2. sound/pci/ice1712/ice1712.c - snd_ice1712_chip_init()
   Always returns 0. Callers check "< 0" in snd_ice1712_create()
   and the PM resume path.

3. sound/pci/ice1712/ice1724.c - snd_vt1724_chip_init()
   Always returns 0. Similar pattern to ice1712.

4. sound/pci/vx222/vx222_ops.c - put_xilinx_data()
   Always returns 0. Caller vx2_load_xilinx_binary() checks "< 0".

Are these intentional for potential future error handling, or could
the return value checks be removed?

Thanks,
Ingyu Jang

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-02-02 16:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-31  8:14 [Question] Dead code in ALSA drivers - functions always returning 0? Ingyu Jang
2026-02-02 16:43 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox