* [PATCH 1/2] ASoC: qcom: storm: allocate snd_soc_card struct dynamically.
@ 2015-06-09 13:34 Srinivas Kandagatla
2015-06-09 13:35 ` [PATCH 2/2] ASoC: qcom: storm: remove special casing EPROBE_DEFER Srinivas Kandagatla
2015-06-09 16:19 ` [PATCH 1/2] ASoC: qcom: storm: allocate snd_soc_card struct dynamically Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Srinivas Kandagatla @ 2015-06-09 13:34 UTC (permalink / raw)
To: Patrick Lai, Mark Brown, kwestfie
Cc: Rob Herring, Banajit Goswami, Liam Girdwood, Jaroslav Kysela,
Takashi Iwai, devicetree, linux-kernel, alsa-devel,
linux-arm-msm, Srinivas Kandagatla
This patch moves static allocation of snd_soc_card to dynamic allocation,
the reason to do this is to avoid holding up any dangling pointers
in this static structures. And I see no use for having this struct as static
given that the card->name is also populated dynamically from dt.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
sound/soc/qcom/storm.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/sound/soc/qcom/storm.c b/sound/soc/qcom/storm.c
index b8bd296..ee06613 100644
--- a/sound/soc/qcom/storm.c
+++ b/sound/soc/qcom/storm.c
@@ -69,11 +69,6 @@ static struct snd_soc_dai_link storm_dai_link = {
.ops = &storm_soc_ops,
};
-static struct snd_soc_card storm_soc_card = {
- .name = "ipq806x-storm",
- .dev = NULL,
-};
-
static int storm_parse_of(struct snd_soc_card *card)
{
struct snd_soc_dai_link *dai_link = card->dai_link;
@@ -99,14 +94,13 @@ static int storm_parse_of(struct snd_soc_card *card)
static int storm_platform_probe(struct platform_device *pdev)
{
- struct snd_soc_card *card = &storm_soc_card;
+ struct snd_soc_card *card;
int ret;
- if (card->dev) {
- dev_err(&pdev->dev, "%s() error, existing soundcard\n",
- __func__);
- return -ENODEV;
- }
+ card = devm_kzalloc(&pdev->dev, sizeof(*card), GFP_KERNEL);
+ if (!card)
+ return -ENOMEM;
+
card->dev = &pdev->dev;
platform_set_drvdata(pdev, card);
@@ -129,7 +123,6 @@ static int storm_platform_probe(struct platform_device *pdev)
ret = devm_snd_soc_register_card(&pdev->dev, card);
if (ret == -EPROBE_DEFER) {
- card->dev = NULL;
return ret;
} else if (ret) {
dev_err(&pdev->dev, "%s() error registering soundcard: %d\n",
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] ASoC: qcom: storm: remove special casing EPROBE_DEFER
2015-06-09 13:34 [PATCH 1/2] ASoC: qcom: storm: allocate snd_soc_card struct dynamically Srinivas Kandagatla
@ 2015-06-09 13:35 ` Srinivas Kandagatla
2015-06-09 16:19 ` [PATCH 1/2] ASoC: qcom: storm: allocate snd_soc_card struct dynamically Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Srinivas Kandagatla @ 2015-06-09 13:35 UTC (permalink / raw)
To: Patrick Lai, Mark Brown, kwestfie
Cc: Rob Herring, Banajit Goswami, Liam Girdwood, Jaroslav Kysela,
Takashi Iwai, devicetree, linux-kernel, alsa-devel,
linux-arm-msm, Srinivas Kandagatla
This patch removes special casing the EPROBE_DEFER error handling in the
driver.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
sound/soc/qcom/storm.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/sound/soc/qcom/storm.c b/sound/soc/qcom/storm.c
index ee06613..2d833bf 100644
--- a/sound/soc/qcom/storm.c
+++ b/sound/soc/qcom/storm.c
@@ -122,15 +122,12 @@ static int storm_platform_probe(struct platform_device *pdev)
}
ret = devm_snd_soc_register_card(&pdev->dev, card);
- if (ret == -EPROBE_DEFER) {
- return ret;
- } else if (ret) {
+ if (ret)
dev_err(&pdev->dev, "%s() error registering soundcard: %d\n",
__func__, ret);
- return ret;
- }
- return 0;
+ return ret;
+
}
#ifdef CONFIG_OF
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] ASoC: qcom: storm: allocate snd_soc_card struct dynamically.
2015-06-09 13:34 [PATCH 1/2] ASoC: qcom: storm: allocate snd_soc_card struct dynamically Srinivas Kandagatla
2015-06-09 13:35 ` [PATCH 2/2] ASoC: qcom: storm: remove special casing EPROBE_DEFER Srinivas Kandagatla
@ 2015-06-09 16:19 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2015-06-09 16:19 UTC (permalink / raw)
To: Srinivas Kandagatla
Cc: Patrick Lai, kwestfie, Rob Herring, Banajit Goswami,
Liam Girdwood, Jaroslav Kysela, Takashi Iwai, devicetree,
linux-kernel, alsa-devel, linux-arm-msm
[-- Attachment #1: Type: text/plain, Size: 383 bytes --]
On Tue, Jun 09, 2015 at 02:34:21PM +0100, Srinivas Kandagatla wrote:
> This patch moves static allocation of snd_soc_card to dynamic allocation,
> the reason to do this is to avoid holding up any dangling pointers
> in this static structures. And I see no use for having this struct as static
> given that the card->name is also populated dynamically from dt.
Applied both, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-06-09 16:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-09 13:34 [PATCH 1/2] ASoC: qcom: storm: allocate snd_soc_card struct dynamically Srinivas Kandagatla
2015-06-09 13:35 ` [PATCH 2/2] ASoC: qcom: storm: remove special casing EPROBE_DEFER Srinivas Kandagatla
2015-06-09 16:19 ` [PATCH 1/2] ASoC: qcom: storm: allocate snd_soc_card struct dynamically Mark Brown
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).