Skip to contentSkip to conversation

ASoC: Intel: bxt-da7219-max98357a: return -EINVAL on unrecognized speaker amplifier

PATCH In review Colin King 3 participants 3 messages Jul 2, 2020 – Jul 3, 2020

Subsystems (4)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 ASoC: Intel: bxt-da7219-max98357a: return -EINVAL on unrecognized speaker amplifier

From: Colin Ian King <[email protected]>

Currently if the ctx->spkamp is not recognized an error message is reported but the code continues to set up the device with uninitialized variables such as the number of widgets. Fix this by returning -EINVAL for unrecognized speaker amplifier types.

Addresses-Coverity: ("Uninitialized scalar variable")

Fixes e1435a1feb18 ("ASoC: Intel: bxt-da7219-max98357a: support MAX98390 speaker amp")
---
 sound/soc/intel/boards/bxt_da7219_max98357a.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/boards/bxt_da7219_max98357a.c +1 -1
index 4d39253e796b..0c0a717823c4 100644
@@ -677,7 +677,7 @@ static int bxt_card_late_probe(struct snd_soc_card *card)
 		break;
 	default:
 		dev_err(card->dev, "Invalid speaker amplifier %d\n", ctx->spkamp);
-		break;
+		return -EINVAL;
 	}
 
 	err = snd_soc_dapm_new_controls(&card->dapm, widgets, num_widgets);
Signature · 1 line
2.27.0
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Colin King

From: Colin Ian King <[email protected]>

Currently if the ctx->spkamp is not recognized an error message is reported but the code continues to set up the device with uninitialized variables such as the number of widgets. Fix this by returning -EINVAL for unrecognized speaker amplifier types.

Addresses-Coverity: ("Uninitialized scalar variable")

Fixes e1435a1feb18 ("ASoC: Intel: bxt-da7219-max98357a: support MAX98390 speaker amp")

Sounds good, thanks Colin.

Quoted 18 lines
---
  sound/soc/intel/boards/bxt_da7219_max98357a.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/boards/bxt_da7219_max98357a.c +1 -1
index 4d39253e796b..0c0a717823c4 100644
@@ -677,7 +677,7 @@ static int bxt_card_late_probe(struct snd_soc_card *card)
  		break;
  	default:
  		dev_err(card->dev, "Invalid speaker amplifier %d\n", ctx->spkamp);
-		break;
+		return -EINVAL;
  	}
 
  	err = snd_soc_dapm_new_controls(&card->dapm, widgets, num_widgets);
maintainer
#2 lore raw
In reply to Colin King
Quoted 4 lines · Colin King

Currently if the ctx->spkamp is not recognized an error message is reported but the code continues to set up the device with uninitialized variables such as the number of widgets. Fix this by returning -EINVAL for unrecognized speaker amplifier types.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: Intel: bxt-da7219-max98357a: return -EINVAL on unrecognized speaker amplifier

      commit: c950e9fcc79b8fedd3126ede4dcd70add8ea5339

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