diff mbox series

ASoC: ak4458: check reset control status

Message ID 1618573502-1488-1-git-send-email-shengjiu.wang@nxp.com (mailing list archive)
State Superseded
Headers show
Series ASoC: ak4458: check reset control status | expand

Commit Message

Shengjiu Wang April 16, 2021, 11:45 a.m. UTC
From: Viorel Suman <viorel.suman@nxp.com>

check the return value of ak4458_rstn_control.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
 sound/soc/codecs/ak4458.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

Comments

kernel test robot April 16, 2021, 3:05 p.m. UTC | #1
Hi Shengjiu,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on asoc/for-next]
[also build test ERROR on v5.12-rc7 next-20210415]
[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]

url:    https://github.com/0day-ci/linux/commits/Shengjiu-Wang/ASoC-ak4458-check-reset-control-status/20210416-200151
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: x86_64-randconfig-s021-20210416 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-280-g2cd6d34e-dirty
        # https://github.com/0day-ci/linux/commit/48f467759d71681e2d3c35253a6eed08e686bd16
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Shengjiu-Wang/ASoC-ak4458-check-reset-control-status/20210416-200151
        git checkout 48f467759d71681e2d3c35253a6eed08e686bd16
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   sound/soc/codecs/ak4458.c: In function 'ak4458_hw_params':
>> sound/soc/codecs/ak4458.c:422:2: error: 'ret' undeclared (first use in this function); did you mean 'net'?
     422 |  ret = ak4458_rstn_control(component, 0);
         |  ^~~
         |  net
   sound/soc/codecs/ak4458.c:422:2: note: each undeclared identifier is reported only once for each function it appears in


vim +422 sound/soc/codecs/ak4458.c

   328	
   329	static int ak4458_hw_params(struct snd_pcm_substream *substream,
   330				    struct snd_pcm_hw_params *params,
   331				    struct snd_soc_dai *dai)
   332	{
   333		struct snd_soc_component *component = dai->component;
   334		struct ak4458_priv *ak4458 = snd_soc_component_get_drvdata(component);
   335		int pcm_width = max(params_physical_width(params), ak4458->slot_width);
   336		u8 format, dsdsel0, dsdsel1;
   337		int nfs1, dsd_bclk;
   338	
   339		nfs1 = params_rate(params);
   340		ak4458->fs = nfs1;
   341	
   342		/* calculate bit clock */
   343		switch (params_format(params)) {
   344		case SNDRV_PCM_FORMAT_DSD_U8:
   345		case SNDRV_PCM_FORMAT_DSD_U16_LE:
   346		case SNDRV_PCM_FORMAT_DSD_U16_BE:
   347		case SNDRV_PCM_FORMAT_DSD_U32_LE:
   348		case SNDRV_PCM_FORMAT_DSD_U32_BE:
   349			dsd_bclk = nfs1 * params_physical_width(params);
   350			switch (dsd_bclk) {
   351			case 2822400:
   352				dsdsel0 = 0;
   353				dsdsel1 = 0;
   354				break;
   355			case 5644800:
   356				dsdsel0 = 1;
   357				dsdsel1 = 0;
   358				break;
   359			case 11289600:
   360				dsdsel0 = 0;
   361				dsdsel1 = 1;
   362				break;
   363			case 22579200:
   364				if (ak4458->drvdata->type == AK4497) {
   365					dsdsel0 = 1;
   366					dsdsel1 = 1;
   367				} else {
   368					dev_err(dai->dev, "DSD512 not supported.\n");
   369					return -EINVAL;
   370				}
   371				break;
   372			default:
   373				dev_err(dai->dev, "Unsupported dsd bclk.\n");
   374				return -EINVAL;
   375			}
   376	
   377			snd_soc_component_update_bits(component, AK4458_06_DSD1,
   378						      AK4458_DSDSEL_MASK, dsdsel0);
   379			snd_soc_component_update_bits(component, AK4458_09_DSD2,
   380						      AK4458_DSDSEL_MASK, dsdsel1);
   381			break;
   382		}
   383	
   384		/* Master Clock Frequency Auto Setting Mode Enable */
   385		snd_soc_component_update_bits(component, AK4458_00_CONTROL1, 0x80, 0x80);
   386	
   387		switch (pcm_width) {
   388		case 16:
   389			if (ak4458->fmt == SND_SOC_DAIFMT_I2S)
   390				format = AK4458_DIF_24BIT_I2S;
   391			else
   392				format = AK4458_DIF_16BIT_LSB;
   393			break;
   394		case 32:
   395			switch (ak4458->fmt) {
   396			case SND_SOC_DAIFMT_I2S:
   397				format = AK4458_DIF_32BIT_I2S;
   398				break;
   399			case SND_SOC_DAIFMT_LEFT_J:
   400				format = AK4458_DIF_32BIT_MSB;
   401				break;
   402			case SND_SOC_DAIFMT_RIGHT_J:
   403				format = AK4458_DIF_32BIT_LSB;
   404				break;
   405			case SND_SOC_DAIFMT_DSP_B:
   406				format = AK4458_DIF_32BIT_MSB;
   407				break;
   408			case SND_SOC_DAIFMT_PDM:
   409				format = AK4458_DIF_32BIT_MSB;
   410				break;
   411			default:
   412				return -EINVAL;
   413			}
   414			break;
   415		default:
   416			return -EINVAL;
   417		}
   418	
   419		snd_soc_component_update_bits(component, AK4458_00_CONTROL1,
   420				    AK4458_DIF_MASK, format);
   421	
 > 422		ret = ak4458_rstn_control(component, 0);
   423		if (ret)
   424			return ret;
   425	
   426		ret = ak4458_rstn_control(component, 1);
   427		if (ret)
   428			return ret;
   429	
   430		return 0;
   431	}
   432	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
kernel test robot April 16, 2021, 6:15 p.m. UTC | #2
Hi Shengjiu,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on asoc/for-next]
[also build test ERROR on v5.12-rc7 next-20210416]
[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]

url:    https://github.com/0day-ci/linux/commits/Shengjiu-Wang/ASoC-ak4458-check-reset-control-status/20210416-200151
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: riscv-randconfig-r006-20210416 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 6a18cc23efad410db48a3ccfc233d215de7d4cb9)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://github.com/0day-ci/linux/commit/48f467759d71681e2d3c35253a6eed08e686bd16
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Shengjiu-Wang/ASoC-ak4458-check-reset-control-status/20210416-200151
        git checkout 48f467759d71681e2d3c35253a6eed08e686bd16
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=riscv 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> sound/soc/codecs/ak4458.c:422:2: error: use of undeclared identifier 'ret'
           ret = ak4458_rstn_control(component, 0);
           ^
   sound/soc/codecs/ak4458.c:423:6: error: use of undeclared identifier 'ret'
           if (ret)
               ^
   sound/soc/codecs/ak4458.c:424:10: error: use of undeclared identifier 'ret'
                   return ret;
                          ^
   sound/soc/codecs/ak4458.c:426:2: error: use of undeclared identifier 'ret'
           ret = ak4458_rstn_control(component, 1);
           ^
   sound/soc/codecs/ak4458.c:427:6: error: use of undeclared identifier 'ret'
           if (ret)
               ^
   sound/soc/codecs/ak4458.c:428:10: error: use of undeclared identifier 'ret'
                   return ret;
                          ^
   6 errors generated.


vim +/ret +422 sound/soc/codecs/ak4458.c

   328	
   329	static int ak4458_hw_params(struct snd_pcm_substream *substream,
   330				    struct snd_pcm_hw_params *params,
   331				    struct snd_soc_dai *dai)
   332	{
   333		struct snd_soc_component *component = dai->component;
   334		struct ak4458_priv *ak4458 = snd_soc_component_get_drvdata(component);
   335		int pcm_width = max(params_physical_width(params), ak4458->slot_width);
   336		u8 format, dsdsel0, dsdsel1;
   337		int nfs1, dsd_bclk;
   338	
   339		nfs1 = params_rate(params);
   340		ak4458->fs = nfs1;
   341	
   342		/* calculate bit clock */
   343		switch (params_format(params)) {
   344		case SNDRV_PCM_FORMAT_DSD_U8:
   345		case SNDRV_PCM_FORMAT_DSD_U16_LE:
   346		case SNDRV_PCM_FORMAT_DSD_U16_BE:
   347		case SNDRV_PCM_FORMAT_DSD_U32_LE:
   348		case SNDRV_PCM_FORMAT_DSD_U32_BE:
   349			dsd_bclk = nfs1 * params_physical_width(params);
   350			switch (dsd_bclk) {
   351			case 2822400:
   352				dsdsel0 = 0;
   353				dsdsel1 = 0;
   354				break;
   355			case 5644800:
   356				dsdsel0 = 1;
   357				dsdsel1 = 0;
   358				break;
   359			case 11289600:
   360				dsdsel0 = 0;
   361				dsdsel1 = 1;
   362				break;
   363			case 22579200:
   364				if (ak4458->drvdata->type == AK4497) {
   365					dsdsel0 = 1;
   366					dsdsel1 = 1;
   367				} else {
   368					dev_err(dai->dev, "DSD512 not supported.\n");
   369					return -EINVAL;
   370				}
   371				break;
   372			default:
   373				dev_err(dai->dev, "Unsupported dsd bclk.\n");
   374				return -EINVAL;
   375			}
   376	
   377			snd_soc_component_update_bits(component, AK4458_06_DSD1,
   378						      AK4458_DSDSEL_MASK, dsdsel0);
   379			snd_soc_component_update_bits(component, AK4458_09_DSD2,
   380						      AK4458_DSDSEL_MASK, dsdsel1);
   381			break;
   382		}
   383	
   384		/* Master Clock Frequency Auto Setting Mode Enable */
   385		snd_soc_component_update_bits(component, AK4458_00_CONTROL1, 0x80, 0x80);
   386	
   387		switch (pcm_width) {
   388		case 16:
   389			if (ak4458->fmt == SND_SOC_DAIFMT_I2S)
   390				format = AK4458_DIF_24BIT_I2S;
   391			else
   392				format = AK4458_DIF_16BIT_LSB;
   393			break;
   394		case 32:
   395			switch (ak4458->fmt) {
   396			case SND_SOC_DAIFMT_I2S:
   397				format = AK4458_DIF_32BIT_I2S;
   398				break;
   399			case SND_SOC_DAIFMT_LEFT_J:
   400				format = AK4458_DIF_32BIT_MSB;
   401				break;
   402			case SND_SOC_DAIFMT_RIGHT_J:
   403				format = AK4458_DIF_32BIT_LSB;
   404				break;
   405			case SND_SOC_DAIFMT_DSP_B:
   406				format = AK4458_DIF_32BIT_MSB;
   407				break;
   408			case SND_SOC_DAIFMT_PDM:
   409				format = AK4458_DIF_32BIT_MSB;
   410				break;
   411			default:
   412				return -EINVAL;
   413			}
   414			break;
   415		default:
   416			return -EINVAL;
   417		}
   418	
   419		snd_soc_component_update_bits(component, AK4458_00_CONTROL1,
   420				    AK4458_DIF_MASK, format);
   421	
 > 422		ret = ak4458_rstn_control(component, 0);
   423		if (ret)
   424			return ret;
   425	
   426		ret = ak4458_rstn_control(component, 1);
   427		if (ret)
   428			return ret;
   429	
   430		return 0;
   431	}
   432	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/sound/soc/codecs/ak4458.c b/sound/soc/codecs/ak4458.c
index 85a1d00894a9..0a94973889a1 100644
--- a/sound/soc/codecs/ak4458.c
+++ b/sound/soc/codecs/ak4458.c
@@ -419,8 +419,13 @@  static int ak4458_hw_params(struct snd_pcm_substream *substream,
 	snd_soc_component_update_bits(component, AK4458_00_CONTROL1,
 			    AK4458_DIF_MASK, format);
 
-	ak4458_rstn_control(component, 0);
-	ak4458_rstn_control(component, 1);
+	ret = ak4458_rstn_control(component, 0);
+	if (ret)
+		return ret;
+
+	ret = ak4458_rstn_control(component, 1);
+	if (ret)
+		return ret;
 
 	return 0;
 }
@@ -429,6 +434,7 @@  static int ak4458_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
 {
 	struct snd_soc_component *component = dai->component;
 	struct ak4458_priv *ak4458 = snd_soc_component_get_drvdata(component);
+	int ret;
 
 	switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
 	case SND_SOC_DAIFMT_CBS_CFS: /* Slave Mode */
@@ -461,8 +467,13 @@  static int ak4458_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
 				      ak4458->fmt == SND_SOC_DAIFMT_PDM ?
 				      AK4458_DP_MASK : 0);
 
-	ak4458_rstn_control(component, 0);
-	ak4458_rstn_control(component, 1);
+	ret = ak4458_rstn_control(component, 0);
+	if (ret)
+		return ret;
+
+	ret = ak4458_rstn_control(component, 1);
+	if (ret)
+		return ret;
 
 	return 0;
 }