From patchwork Wed Oct 19 21:54:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 13012361 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D7564C433FE for ; Wed, 19 Oct 2022 21:56:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HCLnsP44deR/ljGtUAxFq9DBXj0JnfOqyuJhm2qOl2A=; b=ZJog3KMoTACN6G gtpAJeX3zCtvDF4yiwvnZvFmTXFb3J49+3QGjIBemuohWx8IDpmEgkk7dJeUtaRB3OXvKI3aVwpk3 qM8hTHw9v0/l3lj3NmA0z24TMpBsaE09Swz7HGxvOoAcEqoeXx8eA8Fg1r7BwWkhEzpbC5z/hWgXC +sRHPlxpvtuWfJbpzr9QwZ4U9tYWSZ67thFMeHQcoZ6zk2bV5qO18aps/7aTQiT/0FtJz2nyRTTaL AxPgzgxK4g5STEaPe5mz4O3Ivk6WCgreh8kUGLOoc1vRXLIvtE31ydyHhlf5AaphEcRcTL3KQQlas woPkBL/3l+wvfXfcFmZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1olH1t-005MOs-Ce; Wed, 19 Oct 2022 21:55:13 +0000 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1olH1j-005MLZ-0p for linux-arm-kernel@lists.infradead.org; Wed, 19 Oct 2022 21:55:04 +0000 Received: by mail-pj1-x102f.google.com with SMTP id p6-20020a17090a748600b002103d1ef63aso1232535pjk.1 for ; Wed, 19 Oct 2022 14:55:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IbNbprVwcMSh5axZvXvg/6/Lf17+C73zGfmFV0q4APA=; b=jtc5lQ401QtVqG1hgM5C8nhqiLVLg/sUDSKTS1D2u8U8fBBwlC0CdcdAz0f5osiCdj 2xjAgzGdyS3CHjlU1Sk4hXJybQubvQjcO7XWn3h9H8+wa4RBvF1yedA6C43RCQURquc8 1Kx+U/fZ4Czw7qxoo3ox60jKt3Bdk8T81A02Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IbNbprVwcMSh5axZvXvg/6/Lf17+C73zGfmFV0q4APA=; b=1ijn87zKR0BlLa9eRmUCViJtQ7AAPTWWQ1fPK4nbAho03rpe3RCQA7v8GMuX0YBa/N c0cv12vcjUu5NxT5Z3HDRJ88k/AaDIJn0Y4v+bDK81Pcqgd+nvisLpMzirh0HmbDHbRI ty/4HCAyD/rR9Gg1qwlVMdKcDdighM9X4kJxo7ouaSQ1u2zC5ZI2whlHisSwdRsMdgde /JDVPo+64ImKcTIxakCR55T1GOLEzTSoGULcSk8lJihTqFyJBYCvK5PsD+bNRL0/2CuP AvhM4+kLI7H9iTYVG2ruQnc3Rt6QiG53L1KVf00gpMvRyGwUBslhVClvm/N+sr3VGiA9 jZKw== X-Gm-Message-State: ACrzQf1kXxXC9qpf8tv95JPLHABU1BHNcAzLS/Brfsa0rkboMmRodeAN kN67ZZV1KeVbE52YFPwndpDE6g== X-Google-Smtp-Source: AMsMyM6biSOLBTJXDiepLZa0bJF7XTtefUmddHCt+LNdnoBA/Qap1OlbiXCBCai37p9OD4hzq8ZSUw== X-Received: by 2002:a17:902:bd46:b0:17e:8ee5:7b61 with SMTP id b6-20020a170902bd4600b0017e8ee57b61mr10878542plx.44.1666216501002; Wed, 19 Oct 2022 14:55:01 -0700 (PDT) Received: from localhost ([2620:15c:9d:2:57b7:1f0e:44d1:f252]) by smtp.gmail.com with UTF8SMTPSA id q13-20020a170902f34d00b0017680faa1a8sm11113715ple.112.2022.10.19.14.54.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Oct 2022 14:55:00 -0700 (PDT) From: Brian Norris To: Ulf Hansson Cc: Shawn Lin , Shawn Guo , Fabio Estevam , Haibo Chen , Broadcom internal kernel review list , NXP Linux Team , Pengutronix Kernel Team , Florian Fainelli , Michal Simek , Faiz Abbas , linux-mmc@vger.kernel.org, Jonathan Hunter , Al Cooper , linux-arm-kernel@lists.infradead.org, Sowjanya Komatineni , linux-kernel@vger.kernel.org, Thierry Reding , Adrian Hunter , Sascha Hauer , Brian Norris , stable@vger.kernel.org Subject: [PATCH v2 1/7] mmc: cqhci: Handle deactivate() when not yet initialized Date: Wed, 19 Oct 2022 14:54:34 -0700 Message-Id: <20221019145246.v2.1.Ie85faa09432bfe1b0890d8c24ff95e17f3097317@changeid> X-Mailer: git-send-email 2.38.0.413.g74048e4d9e-goog In-Reply-To: <20221019215440.277643-1-briannorris@chromium.org> References: <20221019215440.277643-1-briannorris@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221019_145503_115574_8C38FFA8 X-CRM114-Status: GOOD ( 15.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Several SDHCI drivers need to deactivate command queueing in their reset hook (see sdhci_cqhci_reset() / sdhci-pci-core.c, for example), and several more are coming. Such drivers also tend to initialize CQHCI support after they've already performed one or more resets. Rather than rely on careful ordering of cqhci_init() within the host setup and reset sequence, let's do a simple NULL check -- deactivating a non-initialized CQHCI instance is harmless. This is an important prerequisite patch for several SDHCI controller bugfixes that follow. Cc: Signed-off-by: Brian Norris --- Changes in v2: - New in v2 drivers/mmc/host/cqhci-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/host/cqhci-core.c b/drivers/mmc/host/cqhci-core.c index b3d7d6d8d654..1fa1d24abb2e 100644 --- a/drivers/mmc/host/cqhci-core.c +++ b/drivers/mmc/host/cqhci-core.c @@ -315,7 +315,7 @@ int cqhci_deactivate(struct mmc_host *mmc) { struct cqhci_host *cq_host = mmc->cqe_private; - if (cq_host->enabled && cq_host->activated) + if (cq_host && cq_host->enabled && cq_host->activated) __cqhci_disable(cq_host); return 0;