From patchwork Wed Mar 2 02:24:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: libin.yang@linux.intel.com X-Patchwork-Id: 8477291 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3C8089FC87 for ; Wed, 2 Mar 2016 02:29:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7E3772022A for ; Wed, 2 Mar 2016 02:29:00 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id A2EDE2037F for ; Wed, 2 Mar 2016 02:28:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A83376E796; Wed, 2 Mar 2016 02:28:57 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id D4C626E796 for ; Wed, 2 Mar 2016 02:28:55 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 01 Mar 2016 18:28:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,526,1449561600"; d="scan'208";a="914890860" Received: from younglee-grantley.sh.intel.com ([10.239.159.22]) by fmsmga001.fm.intel.com with ESMTP; 01 Mar 2016 18:28:53 -0800 From: libin.yang@linux.intel.com To: intel-gfx@lists.freedesktop.org, conselvan2@gmail.com, jani.nikula@linux.intel.com, ville.syrjala@linux.intel.com, daniel.vetter@intel.com, tiwai@suse.de Date: Wed, 2 Mar 2016 10:24:31 +0800 Message-Id: <1456885471-29344-1-git-send-email-libin.yang@linux.intel.com> X-Mailer: git-send-email 1.9.1 Cc: Libin Yang Subject: [Intel-gfx] [PATCH] drm/i915: add audio_ptr pointer check X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Libin Yang check to make sure audio_ptr is not NULL before using it. Signed-off-by: Libin Yang --- drivers/gpu/drm/i915/intel_audio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c index 31f6d21..667596d 100644 --- a/drivers/gpu/drm/i915/intel_audio.c +++ b/drivers/gpu/drm/i915/intel_audio.c @@ -529,7 +529,8 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder) intel_dig_port->audio_connector = connector; mutex_unlock(&dev_priv->av_mutex); - if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) + if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify && + acomp->audio_ops->audio_ptr) acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr, (int) port); } @@ -556,7 +557,8 @@ void intel_audio_codec_disable(struct intel_encoder *intel_encoder) intel_dig_port->audio_connector = NULL; mutex_unlock(&dev_priv->av_mutex); - if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) + if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify && + acomp->audio_ops->audio_ptr) acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr, (int) port); }