All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] ASoC: cs43130: Fix possible Oops with invalid dev_id
@ 2017-09-04 13:54 Takashi Iwai
  2017-09-04 13:54 ` [PATCH v2 2/2] ASoC: cs43130: Fix unused compiler warnings for PM runtime Takashi Iwai
  0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2017-09-04 13:54 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel

As compiler spotted out, there is the potential NULL-dereference in
the code when dc-measure OF is given for other than 43130/43131:
  sound/soc/codecs/cs43130.c:2089:18: warning: ‘hpload_seq’ may be used uninitialized in this function [-Wmaybe-uninitialized]

Warn it and return before triggering Oops.

Fixes: 8f1e5bf9b440 ("ASoC: cs43130: Add support for CS43130 codec")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/soc/codecs/cs43130.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sound/soc/codecs/cs43130.c b/sound/soc/codecs/cs43130.c
index 220e30199c5b..3fe3b8d644b7 100644
--- a/sound/soc/codecs/cs43130.c
+++ b/sound/soc/codecs/cs43130.c
@@ -2079,6 +2079,10 @@ static void cs43130_imp_meas(struct work_struct *wk)
 	case CS43131_CHIP_ID:
 		hpload_seq = hpload_seq2;
 		seq_size = ARRAY_SIZE(hpload_seq2);
+		break;
+	default:
+		WARN(1, "Invalid dev_id for meas: %d", cs43130->dev_id);
+		return;
 	}
 
 	i = 0;
-- 
2.14.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [PATCH v2 2/2] ASoC: cs43130: Fix unused compiler warnings for PM runtime
  2017-09-04 13:54 [PATCH v2 1/2] ASoC: cs43130: Fix possible Oops with invalid dev_id Takashi Iwai
@ 2017-09-04 13:54 ` Takashi Iwai
  2017-09-04 14:31   ` Daniel Baluta
  2017-09-04 14:49   ` Applied "ASoC: cs43130: Fix unused compiler warnings for PM runtime" to the asoc tree Mark Brown
  0 siblings, 2 replies; 7+ messages in thread
From: Takashi Iwai @ 2017-09-04 13:54 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel

Add __maybe_unused prefix for addressing the following warnings:
  sound/soc/codecs/cs43130.c:2615:12: warning: ‘cs43130_runtime_resume’ defined but not used [-Wunused-function]
  sound/soc/codecs/cs43130.c:2596:12: warning: ‘cs43130_runtime_suspend’ defined but not used [-Wunused-function]

Fixes: 8f1e5bf9b440 ("ASoC: cs43130: Add support for CS43130 codec")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
v1->v2: Put the prefix to correct functions

 sound/soc/codecs/cs43130.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/cs43130.c b/sound/soc/codecs/cs43130.c
index 3fe3b8d644b7..92b7f0e102b0 100644
--- a/sound/soc/codecs/cs43130.c
+++ b/sound/soc/codecs/cs43130.c
@@ -2597,7 +2597,7 @@ static int cs43130_i2c_remove(struct i2c_client *client)
 	return 0;
 }
 
-static int cs43130_runtime_suspend(struct device *dev)
+static int __maybe_unused cs43130_runtime_suspend(struct device *dev)
 {
 	struct cs43130_private *cs43130 = dev_get_drvdata(dev);
 
@@ -2616,7 +2616,7 @@ static int cs43130_runtime_suspend(struct device *dev)
 	return 0;
 }
 
-static int cs43130_runtime_resume(struct device *dev)
+static int __maybe_unused cs43130_runtime_resume(struct device *dev)
 {
 	struct cs43130_private *cs43130 = dev_get_drvdata(dev);
 	int ret;
-- 
2.14.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [PATCH v2 2/2] ASoC: cs43130: Fix unused compiler warnings for PM runtime
  2017-09-04 13:54 ` [PATCH v2 2/2] ASoC: cs43130: Fix unused compiler warnings for PM runtime Takashi Iwai
@ 2017-09-04 14:31   ` Daniel Baluta
  2017-09-04 14:34     ` Takashi Iwai
  2017-09-04 14:49   ` Applied "ASoC: cs43130: Fix unused compiler warnings for PM runtime" to the asoc tree Mark Brown
  1 sibling, 1 reply; 7+ messages in thread
From: Daniel Baluta @ 2017-09-04 14:31 UTC (permalink / raw)
  To: broonie, tiwai; +Cc: alsa-devel

On Lu, 2017-09-04 at 15:54 +0200, Takashi Iwai wrote:
> Add __maybe_unused prefix for addressing the following warnings:
>   sound/soc/codecs/cs43130.c:2615:12: warning: ‘cs43130_runtime_resume’ defined but not used [-Wunused-function]
>   sound/soc/codecs/cs43130.c:2596:12: warning: ‘cs43130_runtime_suspend’ defined but not used [-Wunused-function]
> 

Isn't it better to guard it with CONFIG_PM?

thanks,
Daniel.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [PATCH v2 2/2] ASoC: cs43130: Fix unused compiler warnings for PM runtime
  2017-09-04 14:31   ` Daniel Baluta
@ 2017-09-04 14:34     ` Takashi Iwai
  2017-09-04 14:44       ` Mark Brown
  0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2017-09-04 14:34 UTC (permalink / raw)
  To: Daniel Baluta; +Cc: alsa-devel, broonie

On Mon, 04 Sep 2017 16:31:03 +0200,
Daniel Baluta wrote:
> 
> On Lu, 2017-09-04 at 15:54 +0200, Takashi Iwai wrote:
> > Add __maybe_unused prefix for addressing the following warnings:
> >   sound/soc/codecs/cs43130.c:2615:12: warning: ‘cs43130_runtime_resume’ defined but not used [-Wunused-function]
> >   sound/soc/codecs/cs43130.c:2596:12: warning: ‘cs43130_runtime_suspend’ defined but not used [-Wunused-function]
> > 
> 
> Isn't it better to guard it with CONFIG_PM?

It's a matter of taste, and people seem prefer this option nowadays,
so I follow that style.


Takashi
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [PATCH v2 2/2] ASoC: cs43130: Fix unused compiler warnings for PM runtime
  2017-09-04 14:34     ` Takashi Iwai
@ 2017-09-04 14:44       ` Mark Brown
  2017-09-04 15:46         ` Daniel Baluta
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Brown @ 2017-09-04 14:44 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel, Daniel Baluta


[-- Attachment #1.1: Type: text/plain, Size: 446 bytes --]

On Mon, Sep 04, 2017 at 04:34:47PM +0200, Takashi Iwai wrote:
> Daniel Baluta wrote:

> > Isn't it better to guard it with CONFIG_PM?

> It's a matter of taste, and people seem prefer this option nowadays,
> so I follow that style.

The ifdefs are a complete pain every time someone decides they want to
do something amusing with the configuration for PM or if people want to
share things between the runtime and system suspend paths.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

* Applied "ASoC: cs43130: Fix unused compiler warnings for PM runtime" to the asoc tree
  2017-09-04 13:54 ` [PATCH v2 2/2] ASoC: cs43130: Fix unused compiler warnings for PM runtime Takashi Iwai
  2017-09-04 14:31   ` Daniel Baluta
@ 2017-09-04 14:49   ` Mark Brown
  1 sibling, 0 replies; 7+ messages in thread
From: Mark Brown @ 2017-09-04 14:49 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel, Mark Brown

[-- Attachment #1: Type: text/plain, Size: 2574 bytes --]

The patch

   ASoC: cs43130: Fix unused compiler warnings for PM runtime

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 7051334672e54fae67e02d5d3296fb62b3343be7 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Mon, 4 Sep 2017 15:54:48 +0200
Subject: [PATCH] ASoC: cs43130: Fix unused compiler warnings for PM runtime
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Add __maybe_unused prefix for addressing the following warnings:
  sound/soc/codecs/cs43130.c:2615:12: warning: ‘cs43130_runtime_resume’ defined but not used [-Wunused-function]
  sound/soc/codecs/cs43130.c:2596:12: warning: ‘cs43130_runtime_suspend’ defined but not used [-Wunused-function]

Fixes: 8f1e5bf9b440 ("ASoC: cs43130: Add support for CS43130 codec")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/cs43130.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/cs43130.c b/sound/soc/codecs/cs43130.c
index 4229a95e2859..643e37fc218e 100644
--- a/sound/soc/codecs/cs43130.c
+++ b/sound/soc/codecs/cs43130.c
@@ -2597,7 +2597,7 @@ static int cs43130_i2c_remove(struct i2c_client *client)
 	return 0;
 }
 
-static int cs43130_runtime_suspend(struct device *dev)
+static int __maybe_unused cs43130_runtime_suspend(struct device *dev)
 {
 	struct cs43130_private *cs43130 = dev_get_drvdata(dev);
 
@@ -2616,7 +2616,7 @@ static int cs43130_runtime_suspend(struct device *dev)
 	return 0;
 }
 
-static int cs43130_runtime_resume(struct device *dev)
+static int __maybe_unused cs43130_runtime_resume(struct device *dev)
 {
 	struct cs43130_private *cs43130 = dev_get_drvdata(dev);
 	int ret;
-- 
2.14.1


[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

* Re: [PATCH v2 2/2] ASoC: cs43130: Fix unused compiler warnings for PM runtime
  2017-09-04 14:44       ` Mark Brown
@ 2017-09-04 15:46         ` Daniel Baluta
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Baluta @ 2017-09-04 15:46 UTC (permalink / raw)
  To: broonie, tiwai; +Cc: alsa-devel

On Lu, 2017-09-04 at 15:44 +0100, Mark Brown wrote:
> On Mon, Sep 04, 2017 at 04:34:47PM +0200, Takashi Iwai wrote:
> > 
> > Daniel Baluta wrote:
> > 
> > > 
> > > Isn't it better to guard it with CONFIG_PM?
> > 
> > It's a matter of taste, and people seem prefer this option nowadays,
> > so I follow that style.
> The ifdefs are a complete pain every time someone decides they want to
> do something amusing with the configuration for PM or if people want to
> share things between the runtime and system suspend paths.

Fine by me. It's just that most of the time I've seen CONFIG_PM approach :).
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

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

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-04 13:54 [PATCH v2 1/2] ASoC: cs43130: Fix possible Oops with invalid dev_id Takashi Iwai
2017-09-04 13:54 ` [PATCH v2 2/2] ASoC: cs43130: Fix unused compiler warnings for PM runtime Takashi Iwai
2017-09-04 14:31   ` Daniel Baluta
2017-09-04 14:34     ` Takashi Iwai
2017-09-04 14:44       ` Mark Brown
2017-09-04 15:46         ` Daniel Baluta
2017-09-04 14:49   ` Applied "ASoC: cs43130: Fix unused compiler warnings for PM runtime" to the asoc tree Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.