All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liam Girdwood <lrg@slimlogic.co.uk>
To: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Cc: alsa-devel@alsa-project.org,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	patches@opensource.wolfsonmicro.com, Timur@alsa-project.org,
	Tabi <timur@freescale.com>
Subject: Re: [PATCH] ASoC: soc-core: Add support for NULL default register caches
Date: Mon, 10 Jan 2011 21:48:58 +0000	[thread overview]
Message-ID: <1294696138.3416.237.camel@odin> (raw)
In-Reply-To: <1294654256-1012-1-git-send-email-dp@opensource.wolfsonmicro.com>

On Mon, 2011-01-10 at 10:10 +0000, Dimitris Papastamos wrote:
> The infrastructure for handling NULL default register maps is already
> included in the soc-cache code, just ensure that we don't try to dereference
> a NULL pointer while accessing a NULL register cache.
> 
> Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
> ---
>  sound/soc/soc-core.c |   12 +++++++-----
>  1 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
> index bac7291..a9f19c1 100644
> --- a/sound/soc/soc-core.c
> +++ b/sound/soc/soc-core.c
> @@ -3503,11 +3503,13 @@ int snd_soc_register_codec(struct device *dev,
>  		 * kernel might have freed the array by the time we initialize
>  		 * the cache.
>  		 */
> -		codec->reg_def_copy = kmemdup(codec_drv->reg_cache_default,
> -					      reg_size, GFP_KERNEL);
> -		if (!codec->reg_def_copy) {
> -			ret = -ENOMEM;
> -			goto fail;
> +		if (codec_drv->reg_cache_default) {
> +			codec->reg_def_copy = kmemdup(codec_drv->reg_cache_default,
> +						      reg_size, GFP_KERNEL);
> +			if (!codec->reg_def_copy) {
> +				ret = -ENOMEM;
> +				goto fail;
> +			}
>  		}
>  	}
>  

Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

  reply	other threads:[~2011-01-10 21:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-10 10:10 [PATCH] ASoC: soc-core: Add support for NULL default register caches Dimitris Papastamos
2011-01-10 21:48 ` Liam Girdwood [this message]
2011-01-10 22:10 ` Timur Tabi
2011-01-10 22:29   ` Mark Brown
2011-01-10 22:40     ` Timur Tabi
2011-01-10 23:48       ` Mark Brown
2011-01-10 22:25 ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1294696138.3416.237.camel@odin \
    --to=lrg@slimlogic.co.uk \
    --cc=Timur@alsa-project.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=dp@opensource.wolfsonmicro.com \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=timur@freescale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.