diff mbox

[2/5] ASoC: intel: log an error on double free

Message ID 1413799148-6368-3-git-send-email-vinod.koul@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Vinod Koul Oct. 20, 2014, 9:59 a.m. UTC
the stream context should be freed only once on stream cleanup. If we ever
hit a chance that stream context is getting double freed, though not an
cause of panic as memory allocator can deal with this, we should still log
this to help in finding issues and debugging

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
 sound/soc/intel/sst/sst_drv_interface.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Comments

Takashi Iwai Oct. 20, 2014, 11:30 a.m. UTC | #1
At Mon, 20 Oct 2014 15:29:05 +0530,
Vinod Koul wrote:
> 
> the stream context should be freed only once on stream cleanup. If we ever
> hit a chance that stream context is getting double freed, though not an
> cause of panic as memory allocator can deal with this, we should still log
> this to help in finding issues and debugging
> 
> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
> ---
>  sound/soc/intel/sst/sst_drv_interface.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/sound/soc/intel/sst/sst_drv_interface.c b/sound/soc/intel/sst/sst_drv_interface.c
> index aadb0db..423c5ff 100644
> --- a/sound/soc/intel/sst/sst_drv_interface.c
> +++ b/sound/soc/intel/sst/sst_drv_interface.c
> @@ -55,6 +55,8 @@ int free_stream_context(struct intel_sst_drv *ctx, unsigned int str_id)
>  		if (ret)
>  			sst_clean_stream(&ctx->streams[str_id]);
>  		return ret;
> +	} else {
> +		dev_err(ctx->dev, "we tried to free stream context %d which was freed!!!", str_id);

Missing line feed at the end of the string.


Takashi


>  	}
>  	return ret;
>  }
> -- 
> 1.7.0.4
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
Vinod Koul Oct. 20, 2014, 1:14 p.m. UTC | #2
On Mon, Oct 20, 2014 at 01:30:05PM +0200, Takashi Iwai wrote:
> At Mon, 20 Oct 2014 15:29:05 +0530,
> Vinod Koul wrote:
> > 
> > the stream context should be freed only once on stream cleanup. If we ever
> > hit a chance that stream context is getting double freed, though not an
> > cause of panic as memory allocator can deal with this, we should still log
> > this to help in finding issues and debugging
> > 
> > Signed-off-by: Vinod Koul <vinod.koul@intel.com>
> > ---
> >  sound/soc/intel/sst/sst_drv_interface.c |    2 ++
> >  1 files changed, 2 insertions(+), 0 deletions(-)
> > 
> > diff --git a/sound/soc/intel/sst/sst_drv_interface.c b/sound/soc/intel/sst/sst_drv_interface.c
> > index aadb0db..423c5ff 100644
> > --- a/sound/soc/intel/sst/sst_drv_interface.c
> > +++ b/sound/soc/intel/sst/sst_drv_interface.c
> > @@ -55,6 +55,8 @@ int free_stream_context(struct intel_sst_drv *ctx, unsigned int str_id)
> >  		if (ret)
> >  			sst_clean_stream(&ctx->streams[str_id]);
> >  		return ret;
> > +	} else {
> > +		dev_err(ctx->dev, "we tried to free stream context %d which was freed!!!", str_id);
> 
> Missing line feed at the end of the string.
Thanks for pointing :)
diff mbox

Patch

diff --git a/sound/soc/intel/sst/sst_drv_interface.c b/sound/soc/intel/sst/sst_drv_interface.c
index aadb0db..423c5ff 100644
--- a/sound/soc/intel/sst/sst_drv_interface.c
+++ b/sound/soc/intel/sst/sst_drv_interface.c
@@ -55,6 +55,8 @@  int free_stream_context(struct intel_sst_drv *ctx, unsigned int str_id)
 		if (ret)
 			sst_clean_stream(&ctx->streams[str_id]);
 		return ret;
+	} else {
+		dev_err(ctx->dev, "we tried to free stream context %d which was freed!!!", str_id);
 	}
 	return ret;
 }