mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* re: ASoC: rt721-sdca: Add RT721 SDCA driver
@ 2024-10-08 17:18 Colin King (gmail)
  0 siblings, 0 replies; 2+ messages in thread
From: Colin King (gmail) @ 2024-10-08 17:18 UTC (permalink / raw)
  To: Jack Yu, Mark Brown; +Cc: linux-sound, linux-kernel

Hi Jack,

There is an unsigned variable check in commit:

commit 86ce355c1f9ab943bbe099ea7d0b8a3af2247f65
Author: Jack Yu <jack.yu@realtek.com>
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

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

* re: ASoC: rt721-sdca: Add RT721 SDCA driver
@ 2024-10-08 17:02 Colin King (gmail)
  0 siblings, 0 replies; 2+ messages in thread
From: Colin King (gmail) @ 2024-10-08 17:02 UTC (permalink / raw)
  To: Jack Yu, linux-sound; +Cc: Mark Brown, linux-kernel

Hi Jack,

With respect to the recent commit in linux-next:

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

     ASoC: rt721-sdca: Add RT721 SDCA driver


I'm flagging up an issue in function rt721_sdca_dmic_set_gain_get there 
are a bunch of nested if statements as follows:

                 if (!adc_vol_flag) /* boost gain */
                         ctl = regvalue / boost_step;
                 else { /* ADC gain */
                         if (adc_vol_flag)
                                 ctl = p->max - (((vol_max - regvalue) & 
0xffff) / interval_offset);
                         else
                                 ctl = p->max - (((0 - regvalue) & 
0xffff) / interval_offset);
                 }

The last else statement ctl = p->max - (((0 - regvalue) & 0xffff) / 
interval_offset) is redundant, since this is the !adc_vol_flag checked 
for in the first boost gain if clause.

Colin


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

end of thread, other threads:[~2024-10-08 17:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-08 17:18 ASoC: rt721-sdca: Add RT721 SDCA driver Colin King (gmail)
  -- strict thread matches above, loose matches on Subject: below --
2024-10-08 17:02 Colin King (gmail)

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

all inboxes | Powered by JetHome®