linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] ASoC: hisilicon: Add error returns even for cases that shouldn't happen.
@ 2017-04-11 19:15 John Stultz
  2017-04-11 19:15 ` [PATCH 2/3] ASoC: hisilicon: Address style nit to use break in final default of switch statement John Stultz
  2017-04-11 19:15 ` [PATCH 3/3] ASoC: hisilicon: Use devm_snd_soc_register_component John Stultz
  0 siblings, 2 replies; 3+ messages in thread
From: John Stultz @ 2017-04-11 19:15 UTC (permalink / raw)
  To: lkml
  Cc: John Stultz, Zhangfei Gao, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Wei Xu, Rob Herring, Andy Green, Dave Long,
	Guodong Xu

This patch addresses feedback from Mark Brown, adding a few
extra error returns in cases that shouldn't happen

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 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/hisilicon/hi6210-i2s.c b/sound/soc/hisilicon/hi6210-i2s.c
index 45691b70..1909bfc 100644
--- a/sound/soc/hisilicon/hi6210-i2s.c
+++ b/sound/soc/hisilicon/hi6210-i2s.c
@@ -395,6 +395,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 +410,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);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/3] ASoC: hisilicon: Address style nit to use break in final default of switch statement
  2017-04-11 19:15 [PATCH 1/3] ASoC: hisilicon: Add error returns even for cases that shouldn't happen John Stultz
@ 2017-04-11 19:15 ` John Stultz
  2017-04-11 19:15 ` [PATCH 3/3] ASoC: hisilicon: Use devm_snd_soc_register_component John Stultz
  1 sibling, 0 replies; 3+ messages in thread
From: John Stultz @ 2017-04-11 19:15 UTC (permalink / raw)
  To: lkml
  Cc: John Stultz, Zhangfei Gao, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Wei Xu, Rob Herring, Andy Green, Dave Long,
	Guodong Xu

Mark Brown suggested a style change to use break in the final
default of a switch statement, so this patch addresses that.

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 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/hisilicon/hi6210-i2s.c b/sound/soc/hisilicon/hi6210-i2s.c
index 1909bfc..27553dc 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);
@@ -442,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 */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 3/3] ASoC: hisilicon: Use devm_snd_soc_register_component
  2017-04-11 19:15 [PATCH 1/3] ASoC: hisilicon: Add error returns even for cases that shouldn't happen John Stultz
  2017-04-11 19:15 ` [PATCH 2/3] ASoC: hisilicon: Address style nit to use break in final default of switch statement John Stultz
@ 2017-04-11 19:15 ` John Stultz
  1 sibling, 0 replies; 3+ messages in thread
From: John Stultz @ 2017-04-11 19:15 UTC (permalink / raw)
  To: lkml
  Cc: John Stultz, Zhangfei Gao, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Wei Xu, Rob Herring, Andy Green, Dave Long,
	Guodong Xu

Per feedback from Mark Brown, this patch updates the hi6210-i2s
driver to use devm_snd_soc_register_component which simplifies
the logic a bit.

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 | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/sound/soc/hisilicon/hi6210-i2s.c b/sound/soc/hisilicon/hi6210-i2s.c
index 27553dc..45163e5 100644
--- a/sound/soc/hisilicon/hi6210-i2s.c
+++ b/sound/soc/hisilicon/hi6210-i2s.c
@@ -591,22 +591,9 @@ 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;
-}
-
-static int hi6210_i2s_remove(struct platform_device *pdev)
-{
-	snd_soc_unregister_component(&pdev->dev);
-	dev_set_drvdata(&pdev->dev, NULL);
-
-	return 0;
+	return ret;
 }
 
 static const struct of_device_id hi6210_i2s_dt_ids[] = {
@@ -618,7 +605,6 @@ MODULE_DEVICE_TABLE(of, hi6210_i2s_dt_ids);
 
 static struct platform_driver hi6210_i2s_driver = {
 	.probe = hi6210_i2s_probe,
-	.remove = hi6210_i2s_remove,
 	.driver = {
 		.name = "hi6210_i2s",
 		.of_match_table = hi6210_i2s_dt_ids,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-11 19:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-11 19:15 [PATCH 1/3] ASoC: hisilicon: Add error returns even for cases that shouldn't happen John Stultz
2017-04-11 19:15 ` [PATCH 2/3] ASoC: hisilicon: Address style nit to use break in final default of switch statement John Stultz
2017-04-11 19:15 ` [PATCH 3/3] ASoC: hisilicon: Use devm_snd_soc_register_component John Stultz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).