From patchwork Mon Aug 22 08:52:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Lin X-Patchwork-Id: 9293265 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 833AB607FF for ; Mon, 22 Aug 2016 08:57:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 730B628822 for ; Mon, 22 Aug 2016 08:57:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 67BA9288EA; Mon, 22 Aug 2016 08:57:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20FBB28822 for ; Mon, 22 Aug 2016 08:57:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754335AbcHVI4x (ORCPT ); Mon, 22 Aug 2016 04:56:53 -0400 Received: from lucky1.263xmail.com ([211.157.147.133]:39986 "EHLO lucky1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754491AbcHVI4v (ORCPT ); Mon, 22 Aug 2016 04:56:51 -0400 Received: from shawn.lin?rock-chips.com (unknown [192.168.167.78]) by lucky1.263xmail.com (Postfix) with ESMTP id 1F72153FD9; Mon, 22 Aug 2016 16:56:46 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 1 X-MAIL-DELIVERY: 0 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 0 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTP id 3469143A; Mon, 22 Aug 2016 16:56:45 +0800 (CST) X-RL-SENDER: shawn.lin@rock-chips.com X-FST-TO: ulf.hansson@linaro.org X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: shawn.lin@rock-chips.com X-UNIQUE-TAG: <0eb7b62227a75a186cd71a82131736e3> X-ATTACHMENT-NUM: 0 X-SENDER: lintao@rock-chips.com X-DNS-TYPE: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith ESMTP id 266805CYGOQ; Mon, 22 Aug 2016 16:56:46 +0800 (CST) From: Shawn Lin To: Ulf Hansson Cc: Kevin Hilman , linux-mmc@vger.kernel.org, Shawn Lin Subject: [PATCH] MMC: meson: don't use priv host structure before we verify it Date: Mon, 22 Aug 2016 16:52:25 +0800 Message-Id: <1471855945-16264-1-git-send-email-shawn.lin@rock-chips.com> X-Mailer: git-send-email 1.8.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The code of meson_mmc_irq is going to use mmeson_host before the santity check of WARN_ON. I believe this's not the code's intention, fix it. Signed-off-by: Shawn Lin --- drivers/mmc/host/meson-gxbb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/meson-gxbb.c b/drivers/mmc/host/meson-gxbb.c index 10eac41..bb60535 100644 --- a/drivers/mmc/host/meson-gxbb.c +++ b/drivers/mmc/host/meson-gxbb.c @@ -626,7 +626,7 @@ static int meson_mmc_read_resp(struct mmc_host *mmc, struct mmc_command *cmd) static irqreturn_t meson_mmc_irq(int irq, void *dev_id) { struct meson_host *host = dev_id; - struct mmc_request *mrq = host->mrq; + struct mmc_request *mrq; struct mmc_command *cmd = host->cmd; u32 irq_en, status, raw_status; irqreturn_t ret = IRQ_HANDLED; @@ -634,6 +634,8 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id) if (WARN_ON(!host)) return IRQ_NONE; + mrq = host->mrq; + if (WARN_ON(!mrq)) return IRQ_NONE;