All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: simple-card: fix a bug where cinfo will be NULL before using it
@ 2014-01-09  9:19 ` Xiubo Li
  0 siblings, 0 replies; 3+ messages in thread
From: Xiubo Li @ 2014-01-09  9:19 UTC (permalink / raw)
  To: broonie; +Cc: alsa-devel, linux-kernel, Xiubo Li

If the dt is not used, the cinfo will be always NULL before using it.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 sound/soc/generic/simple-card.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index c67d2db..51a4784 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -225,8 +225,8 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 			}
 		}
 	} else {
-		cinfo->snd_card.dev = &pdev->dev;
 		cinfo = pdev->dev.platform_data;
+		cinfo->snd_card.dev = &pdev->dev;
 	}
 
 	if (!cinfo) {
-- 
1.8.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] ASoC: simple-card: fix a bug where cinfo will be NULL before using it
@ 2014-01-09  9:19 ` Xiubo Li
  0 siblings, 0 replies; 3+ messages in thread
From: Xiubo Li @ 2014-01-09  9:19 UTC (permalink / raw)
  To: broonie; +Cc: alsa-devel, linux-kernel, Xiubo Li

If the dt is not used, the cinfo will be always NULL before using it.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 sound/soc/generic/simple-card.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index c67d2db..51a4784 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -225,8 +225,8 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 			}
 		}
 	} else {
-		cinfo->snd_card.dev = &pdev->dev;
 		cinfo = pdev->dev.platform_data;
+		cinfo->snd_card.dev = &pdev->dev;
 	}
 
 	if (!cinfo) {
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: simple-card: fix a bug where cinfo will be NULL before using it
  2014-01-09  9:19 ` Xiubo Li
  (?)
@ 2014-01-09 17:37 ` Mark Brown
  -1 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2014-01-09 17:37 UTC (permalink / raw)
  To: Xiubo Li; +Cc: alsa-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 380 bytes --]

On Thu, Jan 09, 2014 at 05:19:08PM +0800, Xiubo Li wrote:

>  	} else {
> -		cinfo->snd_card.dev = &pdev->dev;
>  		cinfo = pdev->dev.platform_data;
> +		cinfo->snd_card.dev = &pdev->dev;
>  	}

I've applied this since not crashing is good but it's a bug to be
writing to the platform data at all, it should be constant.  If it needs
to be written to a copy should be being used.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-01-09 17:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-09  9:19 [PATCH] ASoC: simple-card: fix a bug where cinfo will be NULL before using it Xiubo Li
2014-01-09  9:19 ` Xiubo Li
2014-01-09 17:37 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.