From: Dan Carpenter Subject: [patch] move dereference after null check Date: Mon, 16 Nov 2009 11:06:33 +0200 (SAST) Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-bw0-f217.google.com (mail-bw0-f217.google.com [209.85.218.217]) by alsa0.perex.cz (Postfix) with ESMTP id ECDEC103842 for ; Mon, 16 Nov 2009 10:06:40 +0100 (CET) Received: by bwz9 with SMTP id 9so15372894bwz.32 for ; Mon, 16 Nov 2009 01:06:40 -0800 (PST) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: alsa-devel@alsa-project.org Cc: broonie@opensource.wolfsonmicro.com, lrg@slimlogic.co.uk List-Id: alsa-devel@alsa-project.org The 'jack' variable was dereference before the NULL check so this patch moves the dereference later. regards, dan carpenter Signed-off-by: Dan Carpenter --- orig/sound/soc/soc-jack.c 2009-11-14 11:04:04.000000000 +0200 +++ devel/sound/soc/soc-jack.c 2009-11-14 11:05:01.000000000 +0200 @@ -58,7 +58,7 @@ */ void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask) { - struct snd_soc_codec *codec = jack->card->codec; + struct snd_soc_codec *codec; struct snd_soc_jack_pin *pin; int enable; int oldstatus; @@ -67,6 +67,7 @@ WARN_ON_ONCE(!jack); return; } + codec = jack->card->codec; mutex_lock(&codec->mutex);