From patchwork Wed Jul 30 12:18:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jie, Yang" X-Patchwork-Id: 4647651 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8B452C0338 for ; Wed, 30 Jul 2014 12:19:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ABDF02015E for ; Wed, 30 Jul 2014 12:19:43 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 4DC5620121 for ; Wed, 30 Jul 2014 12:19:38 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 57F332617B6; Wed, 30 Jul 2014 14:19:37 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id B0E01261AA0; Wed, 30 Jul 2014 14:18:46 +0200 (CEST) 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 E3BFD261AB0; Wed, 30 Jul 2014 14:18:45 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by alsa0.perex.cz (Postfix) with ESMTP id 94D2B2608D3 for ; Wed, 30 Jul 2014 14:17:49 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 30 Jul 2014 05:17:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,764,1400050800"; d="scan'208";a="581167473" Received: from keyon-u1310.sh.intel.com ([10.239.13.105]) by orsmga002.jf.intel.com with ESMTP; 30 Jul 2014 05:17:32 -0700 From: Jie Yang To: alsa-devel@alsa-project.org Date: Wed, 30 Jul 2014 20:18:32 +0800 Message-Id: <1406722712-8323-1-git-send-email-yang.jie@intel.com> X-Mailer: git-send-email 1.8.3.2 Cc: mengdong.lin@intel.com, broonie@kernel.org, liam.r.girdwood@intel.com Subject: [alsa-devel] [PATCH] ASoC: Intel: Check ops before we derefference pointers. 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: Liam Girdwood Check ops pointer members before we can derefference them. Signed-off-by: Liam Girdwood Signed-off-by: Jie Yang --- sound/soc/intel/sst-dsp.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sound/soc/intel/sst-dsp.c b/sound/soc/intel/sst-dsp.c index 0b715b2..cd23060 100644 --- a/sound/soc/intel/sst-dsp.c +++ b/sound/soc/intel/sst-dsp.c @@ -224,19 +224,23 @@ EXPORT_SYMBOL_GPL(sst_dsp_shim_update_bits64); void sst_dsp_dump(struct sst_dsp *sst) { - sst->ops->dump(sst); + if (sst->ops->dump) + sst->ops->dump(sst); } EXPORT_SYMBOL_GPL(sst_dsp_dump); void sst_dsp_reset(struct sst_dsp *sst) { - sst->ops->reset(sst); + if (sst->ops->reset) + sst->ops->reset(sst); } EXPORT_SYMBOL_GPL(sst_dsp_reset); int sst_dsp_boot(struct sst_dsp *sst) { - sst->ops->boot(sst); + if (sst->ops->boot) + sst->ops->boot(sst); + return 0; } EXPORT_SYMBOL_GPL(sst_dsp_boot);