Skip to contentSkip to conversation

ASoC: Samsung: i2s: Fix crash in i2s driver

PATCH New Padmavathi Venna 4 participants 4 messages May 7, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: Samsung: i2s: Fix crash in i2s driver

This patch fixes a null pointer deference in i2s driver in DT case

---

This patch is dependent on below patch posted by Thomas Abraham.
https://patchwork.kernel.org/patch/2224801/

 sound/soc/samsung/i2s.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/samsung/i2s.c +1 -1
index 7ce7c50..eaf6439 100644
@@ -1182,7 +1182,7 @@ static int samsung_i2s_probe(struct platform_device *pdev)
 		pri_dai->sec_dai = sec_dai;
 	}
 
-	if (i2s_pdata->cfg_gpio && i2s_pdata->cfg_gpio(pdev)) {
+	if (i2s_pdata && i2s_pdata->cfg_gpio && i2s_pdata->cfg_gpio(pdev)) {
 		dev_err(&pdev->dev, "Unable to configure gpio\n");
 		ret = -EINVAL;
 		goto err;
Signature · 1 line
1.7.4.4
maintainer
#1 lore raw

PATCH 1/1 ASoC: Samsung: i2s: Fix crash in i2s driver

Quoted 8 lines · Padmavathi Venna

This patch fixes a null pointer deference in i2s driver in DT case

---

This patch is dependent on below patch posted by Thomas Abraham.
https://patchwork.kernel.org/patch/2224801/

Please don't submit patches that can't be applied, the two patches need to be submitted together. Please also remember to include human readable descriptions of patches in e-mails for the benefit of human readers, commit IDs and URLs aren't immediately comprehensible.

Please further note my new e-mail address.
-------------- 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/20130507/79a558c2/attachment.sig>

#2 lore raw

PATCH 1/1 ASoC: Samsung: i2s: Fix crash in i2s driver

In reply to Padmavathi Venna

Hi Padmavathi,

Quoted 17 lines · On Tuesday 07 of May 2013 09:09:01 Padmavathi Venna wrote:

This patch fixes a null pointer deference in i2s driver in DT case

---

This patch is dependent on below patch posted by Thomas Abraham.
https://patchwork.kernel.org/patch/2224801/

 sound/soc/samsung/i2s.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/samsung/i2s.c +0 -0
index 7ce7c50..eaf6439 100644

sound/soc/samsung/i2s.c static int samsung_i2s_probe(struct platform_device · line 1185

Quoted 5 lines
sound/soc/samsung/i2s.c +1 -1
@@ -1182,7 +1182,7 @@ static int samsung_i2s_probe(struct platform_device
 *pdev) pri_dai->sec_dai = sec_dai;
 	}
 
-	if (i2s_pdata->cfg_gpio && i2s_pdata->cfg_gpio(pdev)) {
+	if (i2s_pdata && i2s_pdata->cfg_gpio && i2s_pdata->cfg_gpio(pdev)) {

This is a problem that needs to be fixed indeed. However the same problem exists in samsung_i2s_remove() as well (at least in latest linux-next).

This makes me wonder what happens with i2s_pdata in DT case. Most of drivers allocate a pdata struct anyway and fill it with data parsed from device tree. This allows rest of the code to remain unmodified and consider DT and non-DT cases equal.

Best regards,

Signature · 3 lines
Tomasz Figa
Samsung Poland R&D Center
SW Solution Development, Kernel and System Framework
#3 lore raw

PATCH 1/1 ASoC: Samsung: i2s: Fix crash in i2s driver

Hi Tomasz,

Quoted 23 lines · Tomasz Figa

Hi Padmavathi,

Quoted 20 lines · On Tuesday 07 of May 2013 09:09:01 Padmavathi Venna wrote:

This patch fixes a null pointer deference in i2s driver in DT case

---

This patch is dependent on below patch posted by Thomas Abraham.
https://patchwork.kernel.org/patch/2224801/

 sound/soc/samsung/i2s.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/samsung/i2s.c +0 -0
index 7ce7c50..eaf6439 100644
@@ -1182,7 +1182,7 @@ static int samsung_i2s_probe(struct platform_device
 *pdev) pri_dai->sec_dai = sec_dai;
      }
 
Quoted 5 lines

sound/soc/samsung/i2s.c static int samsung_i2s_probe(struct platform_device *pdev) · line 1185

Quoted 2 lines
sound/soc/samsung/i2s.c +1 -1
-     if (i2s_pdata->cfg_gpio && i2s_pdata->cfg_gpio(pdev)) {
+     if (i2s_pdata && i2s_pdata->cfg_gpio && i2s_pdata->cfg_gpio(pdev)) {

This is a problem that needs to be fixed indeed. However the same problem exists in samsung_i2s_remove() as well (at least in latest linux-next).

This will go off once Thomas "ASoC: samsung: let device core setup the default pin configuration"
patch get merged.

Quoted 5 lines

This makes me wonder what happens with i2s_pdata in DT case. Most of drivers allocate a pdata struct anyway and fill it with data parsed from device tree. This allows rest of the code to remain unmodified and consider DT and non-DT cases equal.

This driver doesn't allocate the i2s_pdata in DT case. It directly parse the information form DT file
and assign that information to i2s_dai.

Thanks
Padma

Quoted 7 lines

Best regards,
--
Tomasz Figa
Samsung Poland R&D Center
SW Solution Development, Kernel and System Framework