From patchwork Wed Feb 17 09:09:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 8335551 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9742DC02AA for ; Wed, 17 Feb 2016 09:13:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CA15420357 for ; Wed, 17 Feb 2016 09:13:15 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 82AAE20320 for ; Wed, 17 Feb 2016 09:13:14 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 93339265AA1; Wed, 17 Feb 2016 10:13:13 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 5FFD12660C7; Wed, 17 Feb 2016 10:11:37 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id D6D182666B3; Wed, 17 Feb 2016 10:11:35 +0100 (CET) Received: from mail-yw0-f172.google.com (mail-yw0-f172.google.com [209.85.161.172]) by alsa0.perex.cz (Postfix) with ESMTP id 0BE62265FB4 for ; Wed, 17 Feb 2016 10:10:16 +0100 (CET) Received: by mail-yw0-f172.google.com with SMTP id g127so8224956ywf.2 for ; Wed, 17 Feb 2016 01:10:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=24af8qY/fU6wa7x874HBnFgPMynS72tvnepk5so8+Cg=; b=q9IOHnOuLFKF1V8mjf9HEGqL8pfIJe2wXiK7cFxEUqRBBiG49tfnFGEaArrvYjytyq 1DPCYklXBjJUNI/7ctgB1CP+nAr56cFO8p3xqYxygRqtyTcbACAMK4tm7CYYKT7pJq1q wcFIeJjBwEfpiDSCTtxM8fIKTow1U2BgOQGyvSkcKaYKyPm/3E/mNMKutFdPZuk2hNx3 MXaF9J0MBe83Btx+zHgvQXNRytrCvcKsZPfW9q0A5wApVu8wQ4lsSHF1MO1VLEb6ohRz BXUJazNaXpGiZgsp2il8E048y3Jk9Esa3WsJHVe95NoNVxNoAAWLLyscR+n/Ll2h0FV7 lOnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=24af8qY/fU6wa7x874HBnFgPMynS72tvnepk5so8+Cg=; b=ikzrv8uJh8lG5KmG32hYEXmen6ctxXtV5oDHf2wbxfGxwGeDF2X2BC0nunFU7xFkP4 iJGQCAiOalAhARMMUfXbCMoeizen21tZeFmMxWWp226/d1aP8EFVUxdPwaQFvfnMyNak pn0RTfi55LmQgcsvzJY7sft+dGhDHcFPFJ5kP3l4CeCChzAjONqZOwMQoOBfRQ492sTU R2PhXnNQvnMp4jlyoDssnAmlaybjhPyDqHL0ujxAI/mtLM9/GQhJtaDQANlWgBEtotBY CVe83KU0uurMkIpLGeXbki96/nR+CAdIzY9SmATG32omDo1rwZb0dIJYwyGSg3u2tX7Y 6Gxw== X-Gm-Message-State: AG10YOTSCR7Mj0cDw2oG7m/SslAkt0B+U3sfkrKaJCvnbfIa1eaBOFnCncEdr9CWG206NQ== X-Received: by 10.129.94.66 with SMTP id s63mr182190ywb.309.1455700215212; Wed, 17 Feb 2016 01:10:15 -0800 (PST) Received: from localhost.localdomain ([187.64.228.119]) by smtp.gmail.com with ESMTPSA id b3sm199680ywc.24.2016.02.17.01.10.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 17 Feb 2016 01:10:14 -0800 (PST) From: Fabio Estevam To: broonie@kernel.org Date: Wed, 17 Feb 2016 07:09:59 -0200 Message-Id: <1455700199-18691-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.9.1 Cc: Fabio Estevam , jeeja.kp@intel.com, alsa-devel@alsa-project.org, subhransu.s.prusty@intel.com, dan.carpenter@oracle.com Subject: [alsa-devel] [PATCH] ASoC: hdac_hdmi: Dereference 'edev' after checking for NULL X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Fabio Estevam Commit 4a3478debf36 ("ASoC: hdac_hdmi: Add jack reporting") leads to the following Smatch complaint: sound/soc/codecs/hdac_hdmi.c:971 hdac_hdmi_present_sense() warn: variable dereferenced before check 'edev' (see line 967) ,so deference 'edev' after checking for NULL. Reported-by: Dan Carpenter Signed-off-by: Fabio Estevam --- sound/soc/codecs/hdac_hdmi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c index 36f1200..920af2f 100644 --- a/sound/soc/codecs/hdac_hdmi.c +++ b/sound/soc/codecs/hdac_hdmi.c @@ -964,13 +964,15 @@ static int hdac_hdmi_add_cvt(struct hdac_ext_device *edev, hda_nid_t nid) static void hdac_hdmi_present_sense(struct hdac_hdmi_pin *pin, int repoll) { struct hdac_ext_device *edev = pin->edev; - struct hdac_hdmi_priv *hdmi = edev->private_data; + struct hdac_hdmi_priv *hdmi; struct hdac_hdmi_pcm *pcm; int val; if (!edev) return; + hdmi = edev->private_data; + pin->repoll_count = repoll; pm_runtime_get_sync(&edev->hdac.dev);