Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1620646

[PATCH 2/2] ASoC: hisilicon: Minor fixups to hi6210 i2s audio driver

From John Stultz <john.stultz@linaro.org>
Newsgroups linux.kernel
Subject [PATCH 2/2] ASoC: hisilicon: Minor fixups to hi6210 i2s audio driver
Date 2017-04-10 21:40 +0200
Message-ID <tuNkm-56T-11@gated-at.bofh.it> (permalink)
References <tuNkm-56T-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Mark had a few minor fixups he requested to the hi6210 i2s
driver, so this patch proves them.

This patch adds a few extra error returns in cases that
shouldn't happen, some style nits adding breaks to final
default cases in switch statements, and tweaks to use
devm_ variant of snd_soc_register_component.

Cc: Zhangfei Gao <zhangfei.gao@linaro.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Wei Xu <xuwei5@hisilicon.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Andy Green <andy@warmcat.com>
Cc: Dave Long <dave.long@linaro.org>
Cc: Guodong Xu <guodong.xu@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
 sound/soc/hisilicon/hi6210-i2s.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/sound/soc/hisilicon/hi6210-i2s.c b/sound/soc/hisilicon/hi6210-i2s.c
index 45691b70..bdbf982 100644
--- a/sound/soc/hisilicon/hi6210-i2s.c
+++ b/sound/soc/hisilicon/hi6210-i2s.c
@@ -324,6 +324,7 @@ static int hi6210_i2s_hw_params(struct snd_pcm_substream *substream,
 	default:
 		i2s->bits = 16;
 		dma_data->addr_width = 2;
+		break;
 	}
 	i2s->rate = params_rate(params);
 	i2s->channels = params_channels(params);
@@ -395,6 +396,7 @@ static int hi6210_i2s_hw_params(struct snd_pcm_substream *substream,
 		break;
 	default:
 		WARN_ONCE(1, "Invalid i2s->fmt MASTER_MASK. This shouldn't happen\n");
+		return -EINVAL;
 	}
 
 	switch (i2s->format & SND_SOC_DAIFMT_FORMAT_MASK) {
@@ -409,6 +411,7 @@ static int hi6210_i2s_hw_params(struct snd_pcm_substream *substream,
 		break;
 	default:
 		WARN_ONCE(1, "Invalid i2s->fmt FORMAT_MASK. This shouldn't happen\n");
+		return -EINVAL;
 	}
 
 	val = hi6210_read_reg(i2s, HII2S_I2S_CFG);
@@ -440,6 +443,7 @@ static int hi6210_i2s_hw_params(struct snd_pcm_substream *substream,
 		val = hi6210_read_reg(i2s, HII2S_I2S_CFG);
 		val &= ~HII2S_I2S_CFG__S2_FRAME_MODE;
 		hi6210_write_reg(i2s, HII2S_I2S_CFG, val);
+		break;
 	}
 
 	/* clear loopback, set signed type and word length */
@@ -587,20 +591,14 @@ static int hi6210_i2s_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	ret = snd_soc_register_component(&pdev->dev, &hi6210_i2s_i2s_comp,
+	ret = devm_snd_soc_register_component(&pdev->dev, &hi6210_i2s_i2s_comp,
 					 &i2s->dai, 1);
-	if (ret) {
-		dev_err(&pdev->dev, "Failed to register dai\n");
-		return ret;
-	}
-
-	return 0;
+	return ret;
 }
 
 static int hi6210_i2s_remove(struct platform_device *pdev)
 {
 	snd_soc_unregister_component(&pdev->dev);
-	dev_set_drvdata(&pdev->dev, NULL);
 
 	return 0;
 }
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] ASoC: Improve hi6210-i2s DT bindings John Stultz <john.stultz@linaro.org> - 2017-04-10 21:40 +0200
  [PATCH 2/2] ASoC: hisilicon: Minor fixups to hi6210 i2s audio driver John Stultz <john.stultz@linaro.org> - 2017-04-10 21:40 +0200
    Re: [PATCH 2/2] ASoC: hisilicon: Minor fixups to hi6210 i2s audio  driver Mark Brown <broonie@kernel.org> - 2017-04-11 20:40 +0200
      Re: [PATCH 2/2] ASoC: hisilicon: Minor fixups to hi6210 i2s audio driver John Stultz <john.stultz@linaro.org> - 2017-04-11 21:10 +0200

csiph-web