diff --git a/drivers/amlogic/amaudio2/amaudio2.c b/drivers/amlogic/amaudio2/amaudio2.c index 8a5036fc282b..d3f70807c8d6 100644 --- a/drivers/amlogic/amaudio2/amaudio2.c +++ b/drivers/amlogic/amaudio2/amaudio2.c @@ -1162,7 +1162,6 @@ static void i2s_copy(struct amaudio_t *amaudio) WARN_ON((hw->wr + int_block > hw->size) || (sw->rd + int_block > sw->size)); - WARN_ON((hw->wr < 0) || (sw->rd < 0)); if (external_mute_enable == 1 && external_mute_flag == 1) { memset((hw->addr + hw->wr), 0, int_block); @@ -1377,26 +1376,26 @@ static long amaudio_ioctl(struct file *file, unsigned int cmd, * audio_out_mode = 2, * TV in direct mix with android audio; */ - if (arg < 0 || arg > 2) + if (arg > 2) return -EINVAL; audio_out_mode = arg; break; case AMAUDIO_IOC_MIC_LEFT_GAIN: /* in karaOK mode, mic volume can be set from 0-256 */ - if (arg < 0 || arg > 256) + if (arg > 256) return -EINVAL; direct_left_gain = arg; break; case AMAUDIO_IOC_MIC_RIGHT_GAIN: - if (arg < 0 || arg > 256) + if (arg > 256) return -EINVAL; direct_right_gain = arg; break; case AMAUDIO_IOC_MUSIC_GAIN: /* music volume can be set from 0-256 */ - if (arg < 0 || arg > 256) + if (arg > 256) return -EINVAL; music_gain = arg; diff --git a/sound/soc/amlogic/auge/loopback_hw.c b/sound/soc/amlogic/auge/loopback_hw.c index 5f9ba3f5917a..6e4538cd2f41 100644 --- a/sound/soc/amlogic/auge/loopback_hw.c +++ b/sound/soc/amlogic/auge/loopback_hw.c @@ -168,11 +168,13 @@ void lb_mode(int mode) { // TODO: return; +#if 0 audiobus_update_bits( EE_AUDIO_LB_CTRL0, 0x1 << 30, mode << 30 ); +#endif } static void tdmin_lb_clk_enalbe(int tdm_src, int is_enable) diff --git a/sound/soc/amlogic/auge/pdm_hw.c b/sound/soc/amlogic/auge/pdm_hw.c index 5177aee78848..585d27166d80 100644 --- a/sound/soc/amlogic/auge/pdm_hw.c +++ b/sound/soc/amlogic/auge/pdm_hw.c @@ -438,9 +438,6 @@ int pdm_get_mute_channel(void) { int val = aml_pdm_read(PDM_CTRL); - if (!((val & 20000) >> 17)) - pr_warn_once("pdm mute is not enable\n"); - return (val & (0xff << 20)); } diff --git a/sound/soc/amlogic/auge/pwrdet.c b/sound/soc/amlogic/auge/pwrdet.c index 399760a2d779..1b129d198e92 100644 --- a/sound/soc/amlogic/auge/pwrdet.c +++ b/sound/soc/amlogic/auge/pwrdet.c @@ -166,7 +166,6 @@ static int aml_pwrdet_platform_probe(struct platform_device *pdev) ret = -EINVAL; goto fail; } - ret = of_property_read_u32(node, "pwrdet_src", &p_pwrdet->det_src); if (ret) { diff --git a/sound/soc/amlogic/auge/pwrdet.h b/sound/soc/amlogic/auge/pwrdet.h index 346acea438a2..240da3afd8dc 100644 --- a/sound/soc/amlogic/auge/pwrdet.h +++ b/sound/soc/amlogic/auge/pwrdet.h @@ -36,7 +36,7 @@ struct aml_pwrdet { struct device *dev; unsigned int det_src; - unsigned int irq; + int irq; unsigned int hi_th; unsigned int lo_th; diff --git a/sound/soc/amlogic/auge/resample.c b/sound/soc/amlogic/auge/resample.c index 608591e3b3fb..e8812c52dd8b 100644 --- a/sound/soc/amlogic/auge/resample.c +++ b/sound/soc/amlogic/auge/resample.c @@ -65,7 +65,7 @@ struct audioresample *s_resample; static int resample_clk_set(struct audioresample *p_resample) { - int ret; + int ret = 0; /* enable clock */ if (p_resample->enable) { diff --git a/sound/soc/amlogic/auge/tdm.c b/sound/soc/amlogic/auge/tdm.c index c817586d4c5f..425eebf6cfb9 100644 --- a/sound/soc/amlogic/auge/tdm.c +++ b/sound/soc/amlogic/auge/tdm.c @@ -1142,9 +1142,10 @@ static int aml_tdm_platform_probe(struct platform_device *pdev) /* match data */ p_chipinfo = (struct tdm_chipinfo *) of_device_get_match_data(dev); - if (!p_chipinfo) + if (!p_chipinfo) { dev_warn_once(dev, "check whether to update tdm chipinfo\n"); - + return -ENOMEM; + } p_tdm->chipinfo = p_chipinfo; p_tdm->id = p_chipinfo->id; pr_info("%s, tdm ID = %u\n", __func__, p_tdm->id); @@ -1238,7 +1239,11 @@ static int aml_tdm_platform_probe(struct platform_device *pdev) return PTR_ERR(p_tdm->mclk); } - clk_set_parent(p_tdm->mclk, p_tdm->clk); + ret = clk_set_parent(p_tdm->mclk, p_tdm->clk); + if (ret) { + dev_err(dev, "can't set tdm parent clock\n"); + return ret; + } /* complete mclk for tdm */ if (get_meson_cpu_version(MESON_CPU_VERSION_LVL_MINOR) == 0xa) diff --git a/sound/soc/amlogic/meson/audio_hw.c b/sound/soc/amlogic/meson/audio_hw.c index cef752c2e6df..5c4361d692e8 100644 --- a/sound/soc/amlogic/meson/audio_hw.c +++ b/sound/soc/amlogic/meson/audio_hw.c @@ -246,29 +246,24 @@ void audio_set_958outbuf(u32 addr, u32 size, int flag) aml_aiu_write(AIU_MEM_IEC958_START_PTR, addr & 0xffffffc0); aml_aiu_write(AIU_MEM_IEC958_RD_PTR, addr & 0xffffffc0); #endif - if (flag == 0) { - /* this is for 16bit 2 channel */ + #ifdef CONFIG_AMLOGIC_SND_SPLIT_MODE - aml_aiu_write(AIU_MEM_IEC958_END_PTR, - (addr & 0xffffffff) + - (size & 0xffffffff) - 1); -#else - aml_aiu_write(AIU_MEM_IEC958_END_PTR, - (addr & 0xffffffc0) + - (size & 0xffffffc0) - 64); -#endif - } else { - /* this is for RAW mode */ -#ifdef CONFIG_AMLOGIC_SND_SPLIT_MODE - aml_aiu_write(AIU_MEM_IEC958_END_PTR, + aml_aiu_write(AIU_MEM_IEC958_END_PTR, (addr & 0xffffffff) + (size & 0xffffffff) - 1); #else - aml_aiu_write(AIU_MEM_IEC958_END_PTR, - (addr & 0xffffffc0) + - (size & 0xffffffc0) - 1); -#endif + if (flag == 0) { + /* this is for 16bit 2 channel */ + aml_aiu_write(AIU_MEM_IEC958_END_PTR, + (addr & 0xffffffc0) + + (size & 0xffffffc0) - 64); + } else { + /* this is for RAW mode */ + aml_aiu_write(AIU_MEM_IEC958_END_PTR, + (addr & 0xffffffc0) + + (size & 0xffffffc0) - 1); } + #endif #ifdef CONFIG_AMLOGIC_SND_SPLIT_MODE aml_aiu_update_bits(AIU_MEM_IEC958_MASKS, 0xffff, 0xffff); #else @@ -884,7 +879,7 @@ void audio_set_spdif_clk_div(uint div) { uint val = 0; - if (div < 1 && div > 4) + if (div < 1 || div > 4) return; val = div - 1; diff --git a/sound/soc/amlogic/meson/audio_iomap.c b/sound/soc/amlogic/meson/audio_iomap.c index e1785878e4cd..172ca0725ff4 100644 --- a/sound/soc/amlogic/meson/audio_iomap.c +++ b/sound/soc/amlogic/meson/audio_iomap.c @@ -37,12 +37,12 @@ static struct audio_iomap v_aml_snd_iomap = { .use_iomap = false, }; -static int aml_snd_read(u32 base_type, unsigned int reg, unsigned int *val) +static int aml_snd_read(u32 base_type, unsigned int reg, int *val) { int ret; if (v_aml_snd_iomap.use_iomap) { - if ((base_type >= IO_AUDIN_BASE) && (base_type < IO_BASE_MAX)) { + if (base_type < IO_BASE_MAX) { *val = readl( (v_aml_snd_iomap.reg_map[base_type] + (reg << 2))); @@ -65,7 +65,7 @@ static int aml_snd_read(u32 base_type, unsigned int reg, unsigned int *val) static void aml_snd_write(u32 base_type, unsigned int reg, unsigned int val) { if (v_aml_snd_iomap.use_iomap) { - if ((base_type >= IO_AUDIN_BASE) && (base_type < IO_BASE_MAX)) { + if (base_type < IO_BASE_MAX) { writel(val, (v_aml_snd_iomap.reg_map[base_type] + (reg << 2))); @@ -83,15 +83,16 @@ static void aml_snd_update_bits(u32 base_type, unsigned int val) { if (v_aml_snd_iomap.use_iomap) { - if ((base_type >= IO_AUDIN_BASE) && (base_type < IO_BASE_MAX)) { + if (base_type < IO_BASE_MAX) { unsigned int tmp, orig; - aml_snd_read(base_type, reg, &orig); + if (aml_snd_read(base_type, reg, &orig) == 0) { tmp = orig & ~mask; tmp |= val & mask; aml_snd_write(base_type, reg, tmp); return; + } } pr_err("write snd reg %x error\n", reg); } else diff --git a/sound/soc/amlogic/meson/i2s.c b/sound/soc/amlogic/meson/i2s.c index af1dcbddfd19..4ee75a061dd7 100644 --- a/sound/soc/amlogic/meson/i2s.c +++ b/sound/soc/amlogic/meson/i2s.c @@ -1281,7 +1281,7 @@ static void aml_i2s_free_dma_buffers(struct snd_pcm *pcm) buf->area = NULL; tmp_buf = buf->private_data; - if (tmp_buf->buffer_start != NULL && tmp_buf != NULL) + if (tmp_buf != NULL && tmp_buf->buffer_start != NULL) kfree(tmp_buf->buffer_start); if (tmp_buf != NULL) kfree(tmp_buf); diff --git a/sound/soc/amlogic/meson/meson.c b/sound/soc/amlogic/meson/meson.c index 296b0dd97ede..eb32128c4b82 100644 --- a/sound/soc/amlogic/meson/meson.c +++ b/sound/soc/amlogic/meson/meson.c @@ -108,7 +108,7 @@ static void aml_audio_stop_timer(struct aml_audio_private_data *p_aml_audio) static int hp_det_adc_value(struct aml_audio_private_data *p_aml_audio) { - int ret, hp_value; + int ret, hp_value = 0; int hp_val_sum = 0; int loop_num = 0; unsigned int mic_ret = 0; diff --git a/sound/soc/amlogic/meson/pcm_dai.c b/sound/soc/amlogic/meson/pcm_dai.c index 8d90cce9d8c4..63b8835a5359 100644 --- a/sound/soc/amlogic/meson/pcm_dai.c +++ b/sound/soc/amlogic/meson/pcm_dai.c @@ -198,8 +198,6 @@ static int aml_pcm_dai_hw_params(struct snd_pcm_substream *substream, static int aml_pcm_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) { pr_debug("***Entered %s\n", __func__); - if (fmt & SND_SOC_DAIFMT_CBS_CFS) - snd_soc_dai_get_drvdata(dai); aml_set_pcm_format(fmt & SND_SOC_DAIFMT_FORMAT_MASK); diff --git a/sound/soc/amlogic/meson/tv.c b/sound/soc/amlogic/meson/tv.c index 17b965a9ca22..137c178ad330 100644 --- a/sound/soc/amlogic/meson/tv.c +++ b/sound/soc/amlogic/meson/tv.c @@ -254,9 +254,13 @@ static int aml_audio_set_in_source(struct snd_kcontrol *kcontrol, struct snd_soc_card *card = snd_kcontrol_chip(kcontrol); struct aml_audio_private_data *p_aml_audio = snd_soc_card_get_drvdata(card); - struct aml_card_info *p_cardinfo = p_aml_audio->cardinfo; + struct aml_card_info *p_cardinfo = NULL; - if (p_aml_audio && p_cardinfo) + if (!p_aml_audio) + return -EINVAL; + p_cardinfo = p_aml_audio->cardinfo; + + if (p_cardinfo) p_cardinfo->set_audin_source( ucontrol->value.enumerated.item[0]); else @@ -1872,19 +1876,19 @@ static int aml_card_dais_parse_of(struct snd_soc_card *card) init = NULL; /* CPU sub-node */ cpu_node = of_parse_phandle(np, "cpu_list", i); - if (cpu_node < 0) { + if (cpu_node == NULL) { dev_err(dev, "parse aml sound card cpu list error\n"); return -EINVAL; } /* CODEC sub-node */ codec_node = of_parse_phandle(np, "codec_list", i); - if (codec_node < 0) { + if (codec_node == NULL) { dev_err(dev, "parse aml sound card codec list error\n"); return ret; } /* Platform sub-node */ plat_node = of_parse_phandle(np, "plat_list", i); - if (plat_node < 0) { + if (plat_node == NULL) { dev_err(dev, "parse aml sound card platform list error\n"); return ret; diff --git a/sound/soc/codecs/amlogic/aml_codec_t9015.c b/sound/soc/codecs/amlogic/aml_codec_t9015.c index 05366321225c..9125aed630c9 100644 --- a/sound/soc/codecs/amlogic/aml_codec_t9015.c +++ b/sound/soc/codecs/amlogic/aml_codec_t9015.c @@ -72,13 +72,14 @@ static int aml_DAC_Gain_get_enum( struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { +#if 0 struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); struct snd_soc_codec *codec = snd_soc_component_to_codec(component); u32 add, val, val1, val2; - +#endif /*TODO: return 0 for tmp, this wolud modified later */ return 0; - +#if 0 if (codec == NULL) return -1; @@ -90,6 +91,7 @@ static int aml_DAC_Gain_get_enum( val = val1 | val2; ucontrol->value.enumerated.item[0] = val; return 0; + #endif } static int aml_DAC_Gain_set_enum( @@ -381,7 +383,10 @@ static int aml_T9015_audio_probe(struct snd_soc_codec *codec) { struct aml_T9015_audio_priv *T9015_audio = snd_soc_codec_get_drvdata(codec); - + if (!T9015_audio) { + pr_info("T9015_audio is null!\n"); + return -ENODEV; + } /*reset audio codec register*/ aml_T9015_audio_reset(codec); aml_T9015_audio_start_up(codec); diff --git a/sound/soc/codecs/amlogic/aml_codec_txlx_acodec.c b/sound/soc/codecs/amlogic/aml_codec_txlx_acodec.c index 1ffe723d7965..9261ddbffaab 100644 --- a/sound/soc/codecs/amlogic/aml_codec_txlx_acodec.c +++ b/sound/soc/codecs/amlogic/aml_codec_txlx_acodec.c @@ -458,38 +458,47 @@ static int txlx_acodec_dai_mute_stream(struct snd_soc_dai *dai, int mute, struct txlx_acodec_priv *aml_acodec = snd_soc_codec_get_drvdata(dai->codec); u32 reg; + int ret = 0; pr_debug("%s, mute:%d\n", __func__, mute); if (stream == SNDRV_PCM_STREAM_PLAYBACK) { /* DAC 1 */ - regmap_read(aml_acodec->regmap, + ret = regmap_read(aml_acodec->regmap, DAC_VOL_CTR_DAC_SOFT_MUTE, ®); + if (ret < 0) + pr_err("Failed to read dac1\n"); if (mute) reg |= DAC_SOFT_MUTE; else reg &= ~DAC_SOFT_MUTE; - regmap_write(aml_acodec->regmap, + ret = regmap_write(aml_acodec->regmap, DAC_VOL_CTR_DAC_SOFT_MUTE, reg); - + if (ret < 0) + pr_err("Failed to write dac1\n"); /* DAC 2 */ - regmap_read(aml_acodec->regmap, + ret = regmap_read(aml_acodec->regmap, ACODEC_DAC2_CONFIG2, ®); + if (ret < 0) + pr_err("Failed to read dac2\n"); + if (mute) reg |= DAC2_SOFT_MUTE; else reg &= ~DAC2_SOFT_MUTE; - regmap_write(aml_acodec->regmap, + ret = regmap_write(aml_acodec->regmap, ACODEC_DAC2_CONFIG2, reg); - } + if (ret < 0) + pr_err("Failed to write dac2\n"); + } return 0; } diff --git a/sound/soc/codecs/amlogic/ssm3515.c b/sound/soc/codecs/amlogic/ssm3515.c index d4552d4e6df9..90d79afcc5ce 100644 --- a/sound/soc/codecs/amlogic/ssm3515.c +++ b/sound/soc/codecs/amlogic/ssm3515.c @@ -130,13 +130,17 @@ static int WL2_amplifier_power_get(struct snd_kcontrol *kcontrol, int ret; int i; struct ssm3515 *ssm3515 = NULL; - + ret = -1; for (i = 0; i < device_num; i++) { if (!strcmp(g_ssm3515[i].amp_cfg, "WL2")) { ssm3515 = g_ssm3515+i; break; } } + if (!ssm3515) { + pr_info("no wl2 error"); + return ret; + } ret = regmap_read(ssm3515->regmap, SSM3515_REG_POWER_CTRL, &value); if (ret) return ret; @@ -149,13 +153,17 @@ static int WL2_amplifier_power_put(struct snd_kcontrol *kcontrol, { int value, ret, i; struct ssm3515 *ssm3515 = NULL; - + ret = -1; for (i = 0; i < device_num; i++) { if (!strcmp(g_ssm3515[i].amp_cfg, "WL2")) { ssm3515 = g_ssm3515+i; break; } } + if (!ssm3515) { + pr_info("no wl2 error"); + return ret; + } value = ucontrol->value.integer.value[0]; ret = regmap_write(ssm3515->regmap, SSM3515_REG_POWER_CTRL, value); if (ret) @@ -169,13 +177,17 @@ static int WR2_amplifier_power_get(struct snd_kcontrol *kcontrol, int value = 0; int ret, i; struct ssm3515 *ssm3515 = NULL; - + ret = -1; for (i = 0; i < device_num; i++) { if (!strcmp(g_ssm3515[i].amp_cfg, "WR2")) { ssm3515 = g_ssm3515+i; break; } } + if (!ssm3515) { + pr_info("no wr2 error"); + return ret; + } ret = regmap_read(ssm3515->regmap, SSM3515_REG_POWER_CTRL, &value); if (ret) return ret; @@ -188,13 +200,17 @@ static int WR2_amplifier_power_put(struct snd_kcontrol *kcontrol, { int value, ret, i; struct ssm3515 *ssm3515 = NULL; - + ret = -1; for (i = 0; i < device_num; i++) { if (!strcmp(g_ssm3515[i].amp_cfg, "WR2")) { ssm3515 = g_ssm3515+i; break; } } + if (!ssm3515) { + pr_info("no wr2 error"); + return ret; + } value = ucontrol->value.integer.value[0]; ret = regmap_write(ssm3515->regmap, SSM3515_REG_POWER_CTRL, value); if (ret) @@ -208,13 +224,17 @@ static int TL1_amplifier_power_get(struct snd_kcontrol *kcontrol, int value = 0; int ret, i; struct ssm3515 *ssm3515 = NULL; - + ret = -1; for (i = 0; i < device_num; i++) { if (!strcmp(g_ssm3515[i].amp_cfg, "TL1")) { ssm3515 = g_ssm3515+i; break; } } + if (!ssm3515) { + pr_info("no tl1 error"); + return ret; + } ret = regmap_read(ssm3515->regmap, SSM3515_REG_POWER_CTRL, &value); if (ret) return ret; @@ -227,13 +247,17 @@ static int TL1_amplifier_power_put(struct snd_kcontrol *kcontrol, { int value, ret, i; struct ssm3515 *ssm3515 = NULL; - + ret = -1; for (i = 0; i < device_num; i++) { if (!strcmp(g_ssm3515[i].amp_cfg, "TL1")) { ssm3515 = g_ssm3515+i; break; } } + if (!ssm3515) { + pr_info("no tl1 error"); + return ret; + } value = ucontrol->value.integer.value[0]; ret = regmap_write(ssm3515->regmap, SSM3515_REG_POWER_CTRL, value); if (ret) @@ -247,13 +271,17 @@ static int TR1_amplifier_power_get(struct snd_kcontrol *kcontrol, int value = 0; int ret, i; struct ssm3515 *ssm3515 = NULL; - + ret = -1; for (i = 0; i < device_num; i++) { if (!strcmp(g_ssm3515[i].amp_cfg, "TR1")) { ssm3515 = g_ssm3515+i; break; } } + if (!ssm3515) { + pr_info("no tr1 error"); + return ret; + } ret = regmap_read(ssm3515->regmap, SSM3515_REG_POWER_CTRL, &value); if (ret) return ret; @@ -266,13 +294,17 @@ static int TR1_amplifier_power_put(struct snd_kcontrol *kcontrol, { int value, ret, i; struct ssm3515 *ssm3515 = NULL; - + ret = -1; for (i = 0; i < device_num; i++) { if (!strcmp(g_ssm3515[i].amp_cfg, "TR1")) { ssm3515 = g_ssm3515+i; break; } } + if (!ssm3515) { + pr_info("no tl1 error"); + return ret; + } value = ucontrol->value.integer.value[0]; ret = regmap_write(ssm3515->regmap, SSM3515_REG_POWER_CTRL, value); if (ret) @@ -282,13 +314,13 @@ static int TR1_amplifier_power_put(struct snd_kcontrol *kcontrol, static struct snd_kcontrol_new ssm3515_snd_controls[] = { SOC_SINGLE_EXT("WR2 Amp Power Control", SND_SOC_NOPM, 0, 0xff, 0, - WR2_amplifier_power_get, WR2_amplifier_power_put), + WR2_amplifier_power_get, WR2_amplifier_power_put), SOC_SINGLE_EXT("WL2 Amp Power Control", SND_SOC_NOPM, 0, 0xff, 0, - WL2_amplifier_power_get, WL2_amplifier_power_put), + WL2_amplifier_power_get, WL2_amplifier_power_put), SOC_SINGLE_EXT("TL1 Amp Power Control", SND_SOC_NOPM, 0, 0xff, 0, - TL1_amplifier_power_get, TL1_amplifier_power_put), + TL1_amplifier_power_get, TL1_amplifier_power_put), SOC_SINGLE_EXT("TR1 Amp Power Control", SND_SOC_NOPM, 0, 0xff, 0, - TR1_amplifier_power_get, TR1_amplifier_power_put), + TR1_amplifier_power_get, TR1_amplifier_power_put), }; static int ssm3515_hw_params(struct snd_pcm_substream *substream, diff --git a/sound/soc/codecs/amlogic/ssm3525.c b/sound/soc/codecs/amlogic/ssm3525.c index 61807886a469..29059e08635a 100644 --- a/sound/soc/codecs/amlogic/ssm3525.c +++ b/sound/soc/codecs/amlogic/ssm3525.c @@ -163,13 +163,17 @@ static int WL1_amplifier_power_get(struct snd_kcontrol *kcontrol, int ret; int i; struct ssm3525 *ssm3525 = NULL; - + ret = -1; for (i = 0; i < device_num; i++) { if (!strcmp(g_ssm3525[i].amp_cfg, "WL1")) { ssm3525 = g_ssm3525+i; break; } } + if (!ssm3525) { + pr_info("no wl1 error"); + return ret; + } ret = regmap_read(ssm3525->regmap, SSM3525_REG_POWER_CTRL, &value); if (ret) return ret; @@ -182,13 +186,17 @@ static int WL1_amplifier_power_put(struct snd_kcontrol *kcontrol, { int value, ret, i; struct ssm3525 *ssm3525 = NULL; - + ret = -1; for (i = 0; i < device_num; i++) { if (!strcmp(g_ssm3525[i].amp_cfg, "WL1")) { ssm3525 = g_ssm3525+i; break; } } + if (!ssm3525) { + pr_info("no wl1 error"); + return ret; + } value = ucontrol->value.integer.value[0]; ret = regmap_write(ssm3525->regmap, SSM3525_REG_POWER_CTRL, value); if (ret) @@ -202,13 +210,17 @@ static int WR1_amplifier_power_get(struct snd_kcontrol *kcontrol, int value = 0; int ret, i; struct ssm3525 *ssm3525 = NULL; - + ret = -1; for (i = 0; i < device_num; i++) { if (!strcmp(g_ssm3525[i].amp_cfg, "WR1")) { ssm3525 = g_ssm3525+i; break; } } + if (!ssm3525) { + pr_info("no wr1 error"); + return ret; + } ret = regmap_read(ssm3525->regmap, SSM3525_REG_POWER_CTRL, &value); if (ret) return ret; @@ -221,13 +233,17 @@ static int WR1_amplifier_power_put(struct snd_kcontrol *kcontrol, { int value, ret, i; struct ssm3525 *ssm3525 = NULL; - + ret = -1; for (i = 0; i < device_num; i++) { if (!strcmp(g_ssm3525[i].amp_cfg, "WR1")) { ssm3525 = g_ssm3525+i; break; } } + if (!ssm3525) { + pr_info("no wr1 error"); + return ret; + } value = ucontrol->value.integer.value[0]; ret = regmap_write(ssm3525->regmap, SSM3525_REG_POWER_CTRL, value); if (ret) diff --git a/sound/soc/codecs/amlogic/tas5707.c b/sound/soc/codecs/amlogic/tas5707.c index 161c8a96e721..38c9d5d1c2e3 100644 --- a/sound/soc/codecs/amlogic/tas5707.c +++ b/sound/soc/codecs/amlogic/tas5707.c @@ -777,7 +777,7 @@ static int tas5707_parse_dt( reset_pin = of_get_named_gpio(np, "reset_pin", 0); if (reset_pin < 0) { pr_err("%s fail to get reset pin from dts!\n", __func__); - ret = -1; + //ret = -1; } else { pr_info("%s pdata->reset_pin = %d!\n", __func__, tas5707->pdata->reset_pin); @@ -836,7 +836,7 @@ static int tas5707_i2c_probe(struct i2c_client *i2c, "codec_name", &codec_name)) { pr_info("no codec name\n"); - ret = -1; + //ret = -1; } pr_info("aux name = %s\n", codec_name); if (codec_name)