re: ASoC: rt721-sdca: Add RT721 SDCA driver

From: Colin King (gmail)
Date: Tue Oct 08 2024 - 13:19:03 EST


Hi Jack,

There is an unsigned variable check in commit:

commit 86ce355c1f9ab943bbe099ea7d0b8a3af2247f65
Author: Jack Yu <jack.yu@xxxxxxxxxxx>
Date: Tue Oct 1 09:17:38 2024 +0000

ASoC: rt721-sdca: Add RT721 SDCA driver


function rt721_sdca_jack_detect_handler, the following code does not initialize variable ret:

int btn_type = 0, ret;

if (!rt721->hs_jack)
return;

if (!rt721->component->card || !rt721->component->card->instantiated)
return;

/* SDW_SCP_SDCA_INT_SDCA_6 is used for jack detection */
if (rt721->scp_sdca_stat1 & SDW_SCP_SDCA_INT_SDCA_6) {
rt721->jack_type = rt_sdca_headset_detect(rt721->regmap,

RT721_SDCA_ENT_GE49);
if (ret < 0)
return;
}

..and there is a check for ret < 0, even though it's not been assigned. Should that be a check on rtl->jack_type < 0 instead?

Colin