* [PATCH 1/2] ASoC: samsung: Update sound-card name for Snow
@ 2014-07-04 8:52 Tushar Behera
2014-07-04 8:53 ` [PATCH 2/2] ASoC: core: Fix possible NULL pointer dereference Tushar Behera
2014-07-04 19:32 ` [PATCH 1/2] ASoC: samsung: Update sound-card name for Snow Mark Brown
0 siblings, 2 replies; 4+ messages in thread
From: Tushar Behera @ 2014-07-04 8:52 UTC (permalink / raw)
To: alsa-devel, linux-samsung-soc
Cc: linux-kernel, devicetree, dianders, tiwai, perex, broonie,
lgirdwood, galak, kgene.kim, ijc+devicetree, mark.rutland,
pawel.moll, robh+dt, trblinux
Snow sound-card driver supports multiple boards with different
audio codecs. Updating the sound card name per board basis would provide
some more information to the end-user.
Signed-off-by: Tushar Behera <tushar.b@samsung.com>
---
Documentation/devicetree/bindings/sound/snow.txt | 4 ++++
sound/soc/samsung/snow.c | 3 +++
2 files changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/snow.txt b/Documentation/devicetree/bindings/sound/snow.txt
index e0b7a82..6df74f1 100644
--- a/Documentation/devicetree/bindings/sound/snow.txt
+++ b/Documentation/devicetree/bindings/sound/snow.txt
@@ -8,11 +8,15 @@ Required properties:
- samsung,i2s-controller: The phandle of the Samsung I2S controller
- samsung,audio-codec: The phandle of the audio codec
+Optional:
+- samsung,model: The name of the sound-card
+
Example:
sound {
compatible = "google,snow-audio-max98095";
+ samsung,model = "Snow-I2S-MAX98095";
samsung,i2s-controller = <&i2s0>;
samsung,audio-codec = <&max98095>;
};
diff --git a/sound/soc/samsung/snow.c b/sound/soc/samsung/snow.c
index 8bbd348..0acf5d0 100644
--- a/sound/soc/samsung/snow.c
+++ b/sound/soc/samsung/snow.c
@@ -92,6 +92,9 @@ static int snow_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
+ /* Update card-name if provided through DT, else use default name */
+ snd_soc_of_parse_card_name(card, "samsung,model");
+
ret = devm_snd_soc_register_card(&pdev->dev, card);
if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
--
1.7.9.5
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 2/2] ASoC: core: Fix possible NULL pointer dereference
2014-07-04 8:52 [PATCH 1/2] ASoC: samsung: Update sound-card name for Snow Tushar Behera
@ 2014-07-04 8:53 ` Tushar Behera
2014-07-09 8:07 ` Mark Brown
2014-07-04 19:32 ` [PATCH 1/2] ASoC: samsung: Update sound-card name for Snow Mark Brown
1 sibling, 1 reply; 4+ messages in thread
From: Tushar Behera @ 2014-07-04 8:53 UTC (permalink / raw)
To: alsa-devel, linux-samsung-soc
Cc: linux-kernel, devicetree, dianders, tiwai, perex, broonie,
lgirdwood, galak, kgene.kim, ijc+devicetree, mark.rutland,
pawel.moll, robh+dt, trblinux
snd_soc_of_parse_card_name() may be called before card->dev has been
set, which results in a kernel panic.
Unable to handle kernel NULL pointer dereference at virtual address 00000210
PC is at snd_soc_of_parse_card_name+0x18/0x54
LR is at snow_probe+0x5c/0xd4
Add an error check in snd_soc_of_parse_card_name() to take care of this
case and print out a message in case of error.
Signed-off-by: Tushar Behera <tushar.b@samsung.com>
---
sound/soc/soc-core.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index c4db07f..2e4bdc0 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -4391,9 +4391,16 @@ EXPORT_SYMBOL_GPL(snd_soc_unregister_codec);
int snd_soc_of_parse_card_name(struct snd_soc_card *card,
const char *propname)
{
- struct device_node *np = card->dev->of_node;
+ struct device_node *np;
int ret;
+ if (!card->dev) {
+ pr_err("card->dev is not set before calling %s\n", __func__);
+ return -EINVAL;
+ }
+
+ np = card->dev->of_node;
+
ret = of_property_read_string_index(np, propname, 0, &card->name);
/*
* EINVAL means the property does not exist. This is fine providing
--
1.7.9.5
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 2/2] ASoC: core: Fix possible NULL pointer dereference
2014-07-04 8:53 ` [PATCH 2/2] ASoC: core: Fix possible NULL pointer dereference Tushar Behera
@ 2014-07-09 8:07 ` Mark Brown
0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2014-07-09 8:07 UTC (permalink / raw)
To: Tushar Behera
Cc: alsa-devel, linux-samsung-soc, linux-kernel, devicetree,
dianders, tiwai, perex, lgirdwood, galak, kgene.kim,
ijc+devicetree, mark.rutland, pawel.moll, robh+dt, trblinux
[-- Attachment #1: Type: text/plain, Size: 192 bytes --]
On Fri, Jul 04, 2014 at 02:23:00PM +0530, Tushar Behera wrote:
> snd_soc_of_parse_card_name() may be called before card->dev has been
> set, which results in a kernel panic.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] ASoC: samsung: Update sound-card name for Snow
2014-07-04 8:52 [PATCH 1/2] ASoC: samsung: Update sound-card name for Snow Tushar Behera
2014-07-04 8:53 ` [PATCH 2/2] ASoC: core: Fix possible NULL pointer dereference Tushar Behera
@ 2014-07-04 19:32 ` Mark Brown
1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2014-07-04 19:32 UTC (permalink / raw)
To: Tushar Behera
Cc: alsa-devel, linux-samsung-soc, linux-kernel, devicetree,
dianders, tiwai, perex, lgirdwood, galak, kgene.kim,
ijc+devicetree, mark.rutland, pawel.moll, robh+dt, trblinux
[-- Attachment #1: Type: text/plain, Size: 262 bytes --]
On Fri, Jul 04, 2014 at 02:22:59PM +0530, Tushar Behera wrote:
> Snow sound-card driver supports multiple boards with different
> audio codecs. Updating the sound card name per board basis would provide
> some more information to the end-user.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-07-09 8:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-04 8:52 [PATCH 1/2] ASoC: samsung: Update sound-card name for Snow Tushar Behera
2014-07-04 8:53 ` [PATCH 2/2] ASoC: core: Fix possible NULL pointer dereference Tushar Behera
2014-07-09 8:07 ` Mark Brown
2014-07-04 19:32 ` [PATCH 1/2] ASoC: samsung: Update sound-card name for Snow Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®