RE: Re: sound/soc/codecs/tac5xx2-sdw.c:984 tac5xx2_jack_init() warn: missing error code 'ret'

From: Holalu Yogendra, Niranjan

Date: Wed Jul 29 2026 - 06:49:12 EST


> On 15:37-20260729, Dan Carpenter wrote:
> Subject: [EXTERNAL] Re: sound/soc/codecs/tac5xx2-sdw.c:984 tac5xx2_jack_init() warn: missing error code 'ret'
> On Wed, Jul 29, 2026 at 09:56:57AM +0000, Holalu Yogendra, Niranjan wrote:
> > > On 11:16-20260729, Dan Carpenter wrote:
> > > Subject: sound/soc/codecs/tac5xx2-sdw.c:984 tac5xx2_jack_init() warn: missing error code 'ret's
> > >
> > > smatch warnings:
> > > sound/soc/codecs/tac5xx2-sdw.c:984 tac5xx2_jack_init() warn: missing
> error
> > > code 'ret'
> > >
> > > vim +/ret +984 sound/soc/codecs/tac5xx2-sdw.c
> > >
> > > 38c89fededd5a9 Niranjan H Y 2026-05-05 979 static int tac5xx2_jack_init(struct tac5xx2_prv *tac_dev)
> > > 38c89fededd5a9 Niranjan H Y 2026-05-05 980 {
> > > 38c89fededd5a9 Niranjan H Y 2026-05-05 981 int ret = 0;
> > > 38c89fededd5a9 Niranjan H Y 2026-05-05 982
> > > 38c89fededd5a9 Niranjan H Y 2026-05-05 983 if (!tac_dev->hs_jack)
> > > 38c89fededd5a9 Niranjan H Y 2026-05-05 @984 goto disable_interrupts;
> > >
> > > Is this supposed to be an error path? tac_dev->hs_jack can't be NULL
> > > in real life.
> >
> > We added this as defensive strategy in case someone calls like this
> > snd_soc_component_set_jack(component, NULL, NULL);
>
> Should it return zero or an error code? I feel like it should
> return an error code since it disables interrupts which
> pretty much stops the driver.
>
It should return 0 as we intentionally setting the jack pointer to NULL to disable the jack detection.
And the interrupts which we are disabling are jack detection related interrupts, based on which
we were earlier creating the jack report - which is no longer required.

I see a few places where they set the jack pointer to NULL, for e.g.
https://elixir.bootlin.com/linux/v7.2-rc4/source/sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c#L209
https://elixir.bootlin.com/linux/v7.2-rc4/source/sound/soc/intel/avs/boards/es8336.c#L248
https://elixir.bootlin.com/linux/v7.2-rc4/source/sound/soc/intel/avs/boards/da7219.c#L144
..
I believe they are during either clean up or putting the device to suspend/sleep state.
So it looks okay to me.

Regards
Niranjan