ASoC: cs43130: Fix possible Oops with invalid dev_id
Subsystems (3)
PATCH 1/2 ASoC: cs43130: Fix possible Oops with invalid dev_id
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.
--- sound/soc/codecs/cs43130.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/soc/codecs/cs43130.c +4 -0
@@ -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 ;
Signature · 6 lines
2.14.1 _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 2/2 ASoC: cs43130: Fix unused compiler warnings for PM runtime
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]
--- sound/soc/codecs/cs43130.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/cs43130.c +2 -2
@@ -2563,7 +2563,7 @@ static int cs43130_i2c_probe(struct i2c_client *client,return ret; } -static int cs43130_i2c_remove (struct i2c_client *client) +static int __maybe_unused cs43130_i2c_remove (struct i2c_client *client) {struct cs43130_private *cs43130 =i2c_get_clientdata (client);
@@ -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);
Signature · 6 lines
2.14.1 _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH 2/2] ASoC: cs43130: Fix unused compiler warnings for PM runtime
Quoted 7 lines · Takashi Iwai
Add
__maybe_unusedprefix 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 <[email protected]>
Scratch this one, I obviously put to a wrong line. Will resubmit. Sorry for the inconvenience!
Takashi
Quoted 29 lines
--- sound/soc/codecs/cs43130.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)sound/soc/codecs/cs43130.c +2
-2@@ -2563,7 +2563,7 @@ static int cs43130_i2c_probe(struct i2c_client *client,return ret; } -static int cs43130_i2c_remove (struct i2c_client *client) +static int __maybe_unused cs43130_i2c_remove (struct i2c_client *client) {struct cs43130_private *cs43130 =i2c_get_clientdata (client);@@ -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);Signature · 1 line
2.14.1
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainerApplied "ASoC: cs43130: Fix possible Oops with invalid dev_id" to the asoc tree
In reply to Takashi IwaiThe patch
ASoC: cs43130: Fix possible Oops with invalid dev_id
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
Quoted 1 line
From
f31877a16b0926dea4d1d9b72917a3eca9be19b6Mon Sep 17 00:00:00 2001
From: Takashi Iwai <[email protected]>
Date: Mon, 4 Sep 2017 15:54:47 +0200
Subject: [PATCH] ASoC: cs43130: Fix possible Oops with invalid dev_id
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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.
--- sound/soc/codecs/cs43130.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/soc/codecs/cs43130.c +4 -0
@@ -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 ;
Signature · 1 line
2.14.1