Hi Kevin,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on broonie-sound/for-next] [also build test WARNING on linus/master v6.1 next-20221220] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Kevin-Lu/ALSA-SoC-Texas-Instr... base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next patch link: https://lore.kernel.org/r/20221220151157.2247-1-luminlong%40139.com patch subject: [PATCH v1] ALSA SoC: Texas Instruments TAS2781 Audio Smart Amp config: s390-randconfig-m041-20221218 compiler: s390-linux-gcc (GCC) 12.1.0
If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot lkp@intel.com
New smatch warnings: sound/soc/codecs/tas2781-i2c.c:224 tasdevice_process_block() warn: inconsistent indenting sound/soc/codecs/tas2781-i2c.c:476 tas2781_digital_putvol() warn: unsigned 'val' is never less than zero. sound/soc/codecs/tas2781-i2c.c:549 tas2781_amp_putvol() warn: unsigned 'val' is never less than zero. sound/soc/codecs/tas2781-i2c.c:846 tasdevice_regbin_ready() error: we previously assumed 'tas_dev' could be null (see line 845) sound/soc/codecs/tas2781-i2c.c:2035 tasdevice_pm_suspend() error: we previously assumed 'tas_dev' could be null (see line 2034) sound/soc/codecs/tas2781-dsp.c:1831 tasdevice_load_block() warn: inconsistent indenting sound/soc/codecs/tas2781-dsp.c:797 tas2781_clear_Calfirmware() warn: inconsistent indenting sound/soc/codecs/tas2781-dsp.c:2239 tasdevice_dsp_remove() warn: inconsistent indenting
Old smatch warnings: sound/soc/codecs/tas2781-dsp.c:1848 tasdevice_load_block() warn: inconsistent indenting sound/soc/codecs/tas2781-dsp.c:2243 tasdevice_dsp_remove() warn: inconsistent indenting sound/soc/codecs/tas2781-dsp.c:2253 tasdevice_dsp_remove() warn: inconsistent indenting sound/soc/codecs/tas2781-dsp.c:2274 tasdevice_dsp_remove() warn: inconsistent indenting
vim +224 sound/soc/codecs/tas2781-i2c.c
99 100 int tasdevice_process_block(void *pContext, 101 unsigned char *data, unsigned char dev_idx, int sublocksize) 102 { 103 struct tasdevice_priv *tas_dev = 104 (struct tasdevice_priv *)pContext; 105 unsigned char subblk_typ = data[1]; 106 int subblk_offset = 2; 107 int chn = 0, chnend = 0; 108 int rc = 0; 109 int blktyp = dev_idx & 0xC0, idx = dev_idx & 0x3F; 110 bool bError = false; 111 112 if (idx) { 113 chn = idx-1; 114 chnend = idx; 115 } else { 116 if (tas_dev->glb_addr.mnDevAddr) { 117 chn = tas_dev->ndev; 118 chnend = tas_dev->ndev + 1; 119 } else { 120 chn = 0; 121 chnend = tas_dev->ndev; 122 } 123 } 124 125 for (; chn < chnend; chn++) { 126 if (tas_dev->glb_addr.mnDevAddr == 0 && 127 tas_dev->tasdevice[chn].bLoading == false) 128 continue; 129 130 bError = false; 131 subblk_offset = 2; 132 switch (subblk_typ) { 133 case TASDEVICE_CMD_SING_W: { 134 int i = 0; 135 unsigned short len = SMS_HTONS(data[2], data[3]); 136 137 subblk_offset += 2; 138 if (subblk_offset + 4 * len > sublocksize) { 139 dev_err(tas_dev->dev, 140 "process_block: Out of memory\n"); 141 bError = true; 142 break; 143 } 144 145 for (i = 0; i < len; i++) { 146 rc = tasdevice_dev_write(tas_dev, chn, 147 TASDEVICE_REG(data[subblk_offset], 148 data[subblk_offset + 1], 149 data[subblk_offset + 2]), 150 data[subblk_offset + 3]); 151 if (rc < 0) { 152 bError = true; 153 dev_err(tas_dev->dev, 154 "process_block: single write error\n"); 155 } 156 subblk_offset += 4; 157 } 158 } 159 break; 160 case TASDEVICE_CMD_BURST: { 161 unsigned short len = SMS_HTONS(data[2], data[3]); 162 163 subblk_offset += 2; 164 if (subblk_offset + 4 + len > sublocksize) { 165 dev_err(tas_dev->dev, 166 "process_block: BURST Out of memory\n"); 167 bError = true; 168 break; 169 } 170 if (len % 4) { 171 dev_err(tas_dev->dev, 172 "process_block: Burst len(%u) can be divided by 4\n", 173 len); 174 break; 175 } 176 177 rc = tasdevice_dev_bulk_write(tas_dev, chn, 178 TASDEVICE_REG(data[subblk_offset], 179 data[subblk_offset + 1], 180 data[subblk_offset + 2]), 181 &(data[subblk_offset + 4]), len); 182 if (rc < 0) { 183 bError = true; 184 dev_err(tas_dev->dev, 185 "process_block: bulk_write error = %d\n", 186 rc); 187 } 188 subblk_offset += (len + 4); 189 } 190 break; 191 case TASDEVICE_CMD_DELAY: { 192 unsigned short delay_time = 0; 193 194 if (subblk_offset + 2 > sublocksize) { 195 dev_err(tas_dev->dev, 196 "process_block: deley Out of memory\n"); 197 bError = true; 198 break; 199 } 200 delay_time = SMS_HTONS(data[2], data[3]); 201 usleep_range(delay_time*1000, delay_time*1000); 202 subblk_offset += 2; 203 } 204 break; 205 case TASDEVICE_CMD_FIELD_W: 206 if (subblk_offset + 6 > sublocksize) { 207 dev_err(tas_dev->dev, 208 "process_block: bit write Out of memory\n"); 209 bError = true; 210 break; 211 } 212 rc = tasdevice_dev_update_bits(tas_dev, chn, 213 TASDEVICE_REG(data[subblk_offset + 2], 214 data[subblk_offset + 3], 215 data[subblk_offset + 4]), 216 data[subblk_offset + 1], 217 data[subblk_offset + 5]); 218 if (rc < 0) { 219 bError = true; 220 dev_err(tas_dev->dev, 221 "process_block: update_bits error = %d\n", rc); 222 } 223 subblk_offset += 6;
224 break;
225 default: 226 break; 227 }; 228 if (bError == true && blktyp != 0) { 229 if (blktyp == 0x80) { 230 tas_dev->tasdevice[chn].mnCurrentProgram = -1; 231 tas_dev->tasdevice[chn].mnCurrentConfiguration = 232 -1; 233 } else 234 tas_dev->tasdevice[chn].mnCurrentConfiguration = 235 -1; 236 } 237 } 238 return subblk_offset; 239 } 240