Thanks. Another little issue here:

 

ad1836: fix a memory leak if another ad1836 is registered

 

ad1836 is allocated in ad1836_spi_probe() but is not freed if ad1836_register()

return -EINVAL (if another ad1836 is registered).

 

Signed-off-by: Axel Lin <[email protected]>

Acked-by: Barry Song <[email protected]>

---

 sound/soc/codecs/ad1836.c |    1 +

 1 files changed, 1 insertions(+), 0 deletions(-)

 

diff --git a/sound/soc/codecs/ad1836.c b/sound/soc/codecs/ad1836.c

index 2175384..a01006c 100644

--- a/sound/soc/codecs/ad1836.c

+++ b/sound/soc/codecs/ad1836.c

@@ -272,6 +272,7 @@ static int ad1836_register(struct ad1836_priv *ad1836)

 

        if (ad1836_codec) {

               dev_err(codec->dev, "Another ad1836 is registered\n");

+              kfree(ad1836);

               return -EINVAL;

        }

 

And there are maybe same problems in other Analog codec drivers like ad193x…

-Barry

 

From: [email protected] 
[mailto:[email protected]] On Behalf Of 
[email protected]
Sent: Monday, July 26, 2010 7:08 PM
To: [email protected]
Subject: [Linux-kernel-commits] [9014] trunk/sound/soc/codecs/ad183x.c: fix 
small use before NULL checking bug

 

Revision

9014 
<http://blackfin.uclinux.org/gf/project/linux-kernel/scmsvn/?action=browse&path=/&view=rev&root=linux-kernel&revision=9014>
 

Author

lliubbo <http://blackfin.uclinux.org/gf/user/lliubbo/> 

Date

2010-07-26 07:08:27 -0400 (Mon, 26 Jul 2010)


Log Message


fix small use before NULL checking bug


Modified Paths


·         trunk/sound/soc/codecs/ad183x.c


Diff


Modified: trunk/sound/soc/codecs/ad183x.c (9013 => 9014)

 

--- trunk/sound/soc/codecs/ad183x.c     2010-07-26 11:05:48 UTC (rev 9013)

+++ trunk/sound/soc/codecs/ad183x.c     2010-07-26 11:08:27 UTC (rev 9014)

@@ -495,8 +495,8 @@

 {

  struct snd_soc_device *socdev = platform_get_drvdata(pdev);

  struct snd_soc_codec *codec;

+ struct ad183x_priv *ad183x;

+ struct ad183x_chl_ctrls *chl_ctrl;

  int ret = 0;

 

  if (ad183x_codec == NULL) {

@@ -504,6 +504,8 @@

         return -ENODEV;

  }

 

+ ad183x = ad183x_codec->private_data;

+ chl_ctrl = &ad183x->chl_ctrl;

  socdev->card->codec = ad183x_codec;

  codec = ad183x_codec;

 

_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to