Re: [PATCH V2 2/2] ASoC: codecs: Add aw88166 amplifier driver

From: Nathan Chancellor
Date: Sun Mar 09 2025 - 16:42:28 EST


On Sat, Mar 08, 2025 at 02:20:22PM +0800, kernel test robot wrote:
> Hi,
>
> kernel test robot noticed the following build warnings:
>
> [auto build test WARNING on 1e15510b71c99c6e49134d756df91069f7d18141]
>
> url: https://github.com/intel-lab-lkp/linux/commits/wangweidong-a-awinic-com/ASoC-dt-bindings-Add-schema-for-awinic-aw88166/20250228-115709
> base: 1e15510b71c99c6e49134d756df91069f7d18141
> patch link: https://lore.kernel.org/r/20250228034958.181934-3-wangweidong.a%40awinic.com
> patch subject: [PATCH V2 2/2] ASoC: codecs: Add aw88166 amplifier driver
> config: x86_64-buildonly-randconfig-004-20250308 (https://download.01.org/0day-ci/archive/20250308/202503081433.xufVVq8t-lkp@xxxxxxxxx/config)
> compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250308/202503081433.xufVVq8t-lkp@xxxxxxxxx/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@xxxxxxxxx>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202503081433.xufVVq8t-lkp@xxxxxxxxx/
>
> All warnings (new ones prefixed by >>):
>
> >> sound/soc/codecs/snd-soc-aw88166.o: warning: objtool: .text.aw_dev_dsp_update_cfg: unexpected end of section

Neat, it looks like LTO allows clang to figure out that through inlining
that...

| static int aw_dev_dsp_read(struct aw_device *aw_dev,
| unsigned short dsp_addr, unsigned int *dsp_data, unsigned char data_type)
| {
| ...
| case AW88166_DSP_32_DATA:
| ret = aw_dev_dsp_read_32bit(aw_dev, dsp_addr, dsp_data);
| if (ret)
| dev_err(aw_dev->dev, "read dsp_addr[0x%x] 32r-bit dsp_data[0x%x] failed",
| (u32)dsp_addr, *dsp_data);

^ This is an uninitialized read...

| static int aw_dev_dsp_read_32bit(struct aw_device *aw_dev,
| unsigned short dsp_addr, unsigned int *dsp_data)
| {
| unsigned int temp_data;
| int ret;
|
| ret = regmap_write(aw_dev->regmap, AW88166_DSPMADD_REG, dsp_addr);
| if (ret) {
| dev_err(aw_dev->dev, "%s write error, ret=%d", __func__, ret);
| return ret;
| }
|
| ret = regmap_read(aw_dev->regmap, AW88166_DSPMDAT_REG, &temp_data);
| if (ret) {
| dev_err(aw_dev->dev, "%s read error, ret=%d", __func__, ret);
| return ret;
| }
| *dsp_data = temp_data;

when either of the two error statements occur before this assignment...

| static int aw_dev_get_ra(struct aw_cali_desc *cali_desc)
| {
| struct aw_device *aw_dev =
| container_of(cali_desc, struct aw_device, cali_desc);
| u32 dsp_ra;
| int ret;
|
| ret = aw_dev_dsp_read(aw_dev, AW88166_DSP_REG_CFG_ADPZ_RA,
| &dsp_ra, AW88166_DSP_32_DATA);

^ because it was not initialized prior to this point.

Initializng dsp_ra to 0 in aw_dev_get_ra() resolves the issue but that
may or may not be correct, it just shows where the issue lies.

Cheers,
Nathan