lkml.org 
[lkml]   [2010]   [Nov]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 6/8] ASoC: simone: fix resource leak in simone_init error path
    On Thu, Nov 25, 2010 at 03:12:30PM +0800, Axel Lin wrote:
    > Fix the error path to properly free allocated resources.
    >
    > Signed-off-by: Axel Lin <axel.lin@gmail.com>

    Acked-by: Mika Westerberg <mika.westerberg@iki.fi>

    Thanks for catching this.

    > ---
    > sound/soc/ep93xx/simone.c | 18 ++++++++++--------
    > 1 files changed, 10 insertions(+), 8 deletions(-)
    >
    > diff --git a/sound/soc/ep93xx/simone.c b/sound/soc/ep93xx/simone.c
    > index 4b0d199..2868179 100644
    > --- a/sound/soc/ep93xx/simone.c
    > +++ b/sound/soc/ep93xx/simone.c
    > @@ -54,24 +54,26 @@ static int __init simone_init(void)
    >
    > ret = platform_device_add(simone_snd_ac97_device);
    > if (ret)
    > - goto fail;
    > + goto fail1;
    >
    > simone_snd_device = platform_device_alloc("soc-audio", -1);
    > if (!simone_snd_device) {
    > ret = -ENOMEM;
    > - goto fail;
    > + goto fail2;
    > }
    >
    > platform_set_drvdata(simone_snd_device, &snd_soc_simone);
    > ret = platform_device_add(simone_snd_device);
    > - if (ret) {
    > - platform_device_put(simone_snd_device);
    > - goto fail;
    > - }
    > + if (ret)
    > + goto fail3;
    >
    > - return ret;
    > + return 0;
    >
    > -fail:
    > +fail3:
    > + platform_device_put(simone_snd_device);
    > +fail2:
    > + platform_device_del(simone_snd_ac97_device);
    > +fail1:
    > platform_device_put(simone_snd_ac97_device);
    > return ret;
    > }
    > --
    > 1.7.2
    >
    >


    \
     
     \ /
      Last update: 2010-11-25 09:09    [W:4.145 / U:0.072 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site