* [PATCH 1/2] ASoC: Samsung: return error if drvdata is not set
@ 2013-04-02 11:23 Padmavathi Venna
2013-04-02 11:23 ` [PATCH 2/2] ASoC: Samsung: set drvdata before adding secondary device Padmavathi Venna
2013-04-03 16:57 ` [PATCH 1/2] ASoC: Samsung: return error if drvdata is not set Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Padmavathi Venna @ 2013-04-02 11:23 UTC (permalink / raw)
To: linux-arm-kernel
From: Prathyush K <prathyush.k@samsung.com>
This patch fixes a possible crash in case drvdata for the secondary
device is not set.
Signed-off-by: Prathyush K <prathyush.k@samsung.com>
Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
---
Based on Kukjin for-next branch
sound/soc/samsung/i2s.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index d7231e3..f1fc064 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -1107,6 +1107,10 @@ static int samsung_i2s_probe(struct platform_device *pdev)
if (samsung_dai_type == TYPE_SEC) {
sec_dai = dev_get_drvdata(&pdev->dev);
+ if (!sec_dai) {
+ dev_err(&pdev->dev, "Unable to get drvdata\n");
+ return -EFAULT;
+ }
snd_soc_register_dai(&sec_dai->pdev->dev,
&sec_dai->i2s_dai_drv);
asoc_dma_platform_register(&pdev->dev);
--
1.7.4.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] ASoC: Samsung: set drvdata before adding secondary device
2013-04-02 11:23 [PATCH 1/2] ASoC: Samsung: return error if drvdata is not set Padmavathi Venna
@ 2013-04-02 11:23 ` Padmavathi Venna
2013-04-03 16:57 ` [PATCH 1/2] ASoC: Samsung: return error if drvdata is not set Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Padmavathi Venna @ 2013-04-02 11:23 UTC (permalink / raw)
To: linux-arm-kernel
From: Prathyush K <prathyush.k@samsung.com>
Currently, a new platform device is created for secondary device
by calling platform_device_register_resndata and then the drvdata
is set for this device.
The following patch has been added to driver core:
"driver core: fix possible missing of device probe".
This results in the added device getting probed immediately but
the drvdata for the secondary device is not yet set.
This patch removes the platform_device_register_resndata call and
instead calls platform_device_alloc, platform_set_drvdata and
platform_device_add which fixes the above issue.
Signed-off-by: Prathyush K <prathyush.k@samsung.com>
Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
---
Based on Kukjin for-next branch
sound/soc/samsung/i2s.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index f1fc064..6bbeb0b 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -972,6 +972,7 @@ static const struct snd_soc_dai_ops samsung_i2s_dai_ops = {
static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec)
{
struct i2s_dai *i2s;
+ int ret;
i2s = devm_kzalloc(&pdev->dev, sizeof(struct i2s_dai), GFP_KERNEL);
if (i2s == NULL)
@@ -996,15 +997,17 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec)
i2s->i2s_dai_drv.capture.channels_max = 2;
i2s->i2s_dai_drv.capture.rates = SAMSUNG_I2S_RATES;
i2s->i2s_dai_drv.capture.formats = SAMSUNG_I2S_FMTS;
+ dev_set_drvdata(&i2s->pdev->dev, i2s);
} else { /* Create a new platform_device for Secondary */
- i2s->pdev = platform_device_register_resndata(NULL,
- "samsung-i2s-sec", -1, NULL, 0, NULL, 0);
+ i2s->pdev = platform_device_alloc("samsung-i2s-sec", -1);
if (IS_ERR(i2s->pdev))
return NULL;
- }
- /* Pre-assign snd_soc_dai_set_drvdata */
- dev_set_drvdata(&i2s->pdev->dev, i2s);
+ platform_set_drvdata(i2s->pdev, i2s);
+ ret = platform_device_add(i2s->pdev);
+ if (ret < 0)
+ return NULL;
+ }
return i2s;
}
--
1.7.4.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 1/2] ASoC: Samsung: return error if drvdata is not set
2013-04-02 11:23 [PATCH 1/2] ASoC: Samsung: return error if drvdata is not set Padmavathi Venna
2013-04-02 11:23 ` [PATCH 2/2] ASoC: Samsung: set drvdata before adding secondary device Padmavathi Venna
@ 2013-04-03 16:57 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2013-04-03 16:57 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Apr 02, 2013 at 04:53:01PM +0530, Padmavathi Venna wrote:
> From: Prathyush K <prathyush.k@samsung.com>
>
> This patch fixes a possible crash in case drvdata for the secondary
> device is not set.
Applied both, thanks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130403/78b589c9/attachment-0001.sig>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-04-03 16:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-02 11:23 [PATCH 1/2] ASoC: Samsung: return error if drvdata is not set Padmavathi Venna
2013-04-02 11:23 ` [PATCH 2/2] ASoC: Samsung: set drvdata before adding secondary device Padmavathi Venna
2013-04-03 16:57 ` [PATCH 1/2] ASoC: Samsung: return error if drvdata is not set 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).