Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3087619rwb; Mon, 15 Aug 2022 17:49:39 -0700 (PDT) X-Google-Smtp-Source: AA6agR6cwBCD45zdu2SWm6tUWfNFRIATTZWe4VjdYp3xeC0QUc8WLZ3t7PuyFz+oUoTaDlcmhjUx X-Received: by 2002:a17:906:5d07:b0:730:9e98:8fbf with SMTP id g7-20020a1709065d0700b007309e988fbfmr11795768ejt.610.1660610979015; Mon, 15 Aug 2022 17:49:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660610979; cv=none; d=google.com; s=arc-20160816; b=NTfPDRnju/0HjVLUOt2nR+5nF/pVLxkeEuGF2eXWyW8IFq/90F6tR9QKnzid5CR8WO ZRizXdU2DmTyBCjctJddwxi4rQRdCFNagcIVU2vKQ0gX1N7JAnjMeXbE735E6NazZA2i FcEroHaMJ4w6/xjGn8202j2AtBj4Mtp2jGBpC9x8Cytt7nb4hgBpdAyNp99Mtvz48W7M GXU7qG7+UpPMLXuWc4ONglqyDqdSbPOQPPkpbr0+62olbC8TOKN6aZeDqP4J1X1KJb2n YGFkG02UT4pk6ip80FSRlk5tPhNhKWdXI536fMCGaUxRNxOzRg4nHkrXz+xfJIrrOcdM j5tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=g4fh1SNDF0XCkGQpc0iDpKgbcBKHVklKFTj3uLuQV/I=; b=bgm78r+PvFF42i9MT52g8+g0rqTD/gwVfns8Pvx1fjS14ji9tALDLXIfCzpolbVind E6shTytTE8Jmx5X2+DwGsX0PEjRp3W4qBeKROs9H3C7fPnLflTZ6pBIT/l5EMHjcv6KX rzkI9lLRix+JUVj/9ZuSZSyiT9+jcKs7hza/fSxQ4Gw+ZwZW0vGkga/7S53rETYRcaVy Fj9BuPS4k96G5n0RJA+nek0+nl0f1+VS/sgxrg2I6lYpUPEhemcxmLYc92FceA1CeCqQ ABaGyljc37sTOu1if8hpDdpFwhBErs4UCHq1njWFvc8FCYm2tojZvCVwLrClqbgEEdfU 5w5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m1nAOoez; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n15-20020a50934f000000b004422925e5bfsi7517688eda.468.2022.08.15.17.49.13; Mon, 15 Aug 2022 17:49:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m1nAOoez; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354669AbiHOX5I (ORCPT + 99 others); Mon, 15 Aug 2022 19:57:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355304AbiHOXvw (ORCPT ); Mon, 15 Aug 2022 19:51:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C92891D1A; Mon, 15 Aug 2022 13:16:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 095796069F; Mon, 15 Aug 2022 20:16:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C064C433D6; Mon, 15 Aug 2022 20:16:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594587; bh=UiwS0woC9t2O9OGl5uIZCvA0IgPGyEzpElFJIVaIBUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m1nAOoezASS226ihH4SN0jfdsOdyUk9VRV8UYeALoo+lSU9Hd5JLC7SLZSsRTiObZ 3amKQsTclMIdxeYjhnyo/Zp1qAm+ui4b418OotBaSmKdLsD622TSMc8ZV8mlQqe5U3 plN+NcCsV4cWhttA42JKXDqeiKO7alBOAPLnmv0k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YN Chen , Lorenzo Bianconi , Deren Wu , Felix Fietkau , Sasha Levin Subject: [PATCH 5.19 0478/1157] mt76: mt7921s: fix possible sdio deadlock in command fail Date: Mon, 15 Aug 2022 19:57:14 +0200 Message-Id: <20220815180458.747796390@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Deren Wu [ Upstream commit 364718c94ac2ea4e51958ac0aa15c9092c785a3a ] Move sdio_release_host() to final resource handing Fixes: b12deb5e86fa ("mt76: mt7921s: fix mt7921s_mcu_[fw|drv]_pmctrl") Reported-by: YN Chen Co-developed-by: Lorenzo Bianconi Signed-off-by: Lorenzo Bianconi Signed-off-by: Deren Wu Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7921/sdio_mcu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/sdio_mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/sdio_mcu.c index 54a5c712a3c3..c572a3107b8b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/sdio_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/sdio_mcu.c @@ -136,8 +136,8 @@ int mt7921s_mcu_fw_pmctrl(struct mt7921_dev *dev) struct sdio_func *func = dev->mt76.sdio.func; struct mt76_phy *mphy = &dev->mt76.phy; struct mt76_connac_pm *pm = &dev->pm; - int err = 0; u32 status; + int err; sdio_claim_host(func); @@ -148,7 +148,7 @@ int mt7921s_mcu_fw_pmctrl(struct mt7921_dev *dev) 2000, 1000000); if (err < 0) { dev_err(dev->mt76.dev, "mailbox ACK not cleared\n"); - goto err; + goto out; } } @@ -156,18 +156,18 @@ int mt7921s_mcu_fw_pmctrl(struct mt7921_dev *dev) err = readx_poll_timeout(mt76s_read_pcr, &dev->mt76, status, !(status & WHLPCR_IS_DRIVER_OWN), 2000, 1000000); +out: sdio_release_host(func); -err: if (err < 0) { dev_err(dev->mt76.dev, "firmware own failed\n"); clear_bit(MT76_STATE_PM, &mphy->state); - err = -EIO; + return -EIO; } pm->stats.last_doze_event = jiffies; pm->stats.awake_time += pm->stats.last_doze_event - pm->stats.last_wake_event; - return err; + return 0; } -- 2.35.1