Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2930334rwb; Mon, 15 Aug 2022 14:16:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR6yEmBVJmN2aKND1/nHotSi+WuZOkP6KFv+VIMDas9gzT4cV9fBCTIdRzzmMZ8Wq234NjAg X-Received: by 2002:a17:907:86a1:b0:731:5567:3648 with SMTP id qa33-20020a17090786a100b0073155673648mr11538038ejc.339.1660598170310; Mon, 15 Aug 2022 14:16:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660598170; cv=none; d=google.com; s=arc-20160816; b=r0NkWJ6fZgA2qxrSf1yZOueDjR0ukqeHCBouXnhCBzhq2PKCNypbYOR7QkWCknrNuy QKsXL1KltUii/8IFlxqztD+e9eigRCoZyc7/ZDp3PyP0DhqPBXJNqVuVqEhbIfTqZL20 M+2SEGTfYepoW44wFg/80qTJboEHd6qosryDV+sIyldS6R0qqHYtso44UynrYaqgbUpg 6p1eh6Z1LxfPQx/4zcTHRHZbB23tiwF4p9dGQY0L/FmPM0Ny6Al+P6b/0cHfgkxMmxCk TYPLradqQ0IoM9pTDIW6AMsC4PvaPr3w3iD9OTpEMbYooinMtWq40Bltql0ANu9yLV9T 2rmQ== 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=eXD8kVCebVF93FbzR9zXNHaTTz0UYyKLjAxj3q+epoIA9zSykaRxF3iOnOsl6IVeRv cOAvOfvwNVAV3YgX1y1+B0NQxngLd9gkT7FGFceHblTPw+GoJwUNbuTX7+ni/oCDxKMm Aimhw2nqWoBYJgJnpjFZotKIo9Rkis8xEkV6AAetWfEAY9hLekkhwczgX0OcafjxXP7m D2lVOxq85SgrCMWnYzSLsq+0p8nIXiuPDCf5+ea4o08WlGe/cpnf844vSVZBVcJu9ybt 3yIGf/vHKIscHnV3n1xcX9cBEQbxelbkh8NxNSTXgqIwDhyD/OeYjtRI/SkzdXjLmZ/E YdTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=l0srZjpW; 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 u4-20020aa7d884000000b00440608ba4d1si7873802edq.151.2022.08.15.14.15.43; Mon, 15 Aug 2022 14:16:10 -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=l0srZjpW; 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 S242459AbiHOVOM (ORCPT + 99 others); Mon, 15 Aug 2022 17:14:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347942AbiHOVHr (ORCPT ); Mon, 15 Aug 2022 17:07:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C43D72D1D5; Mon, 15 Aug 2022 12:16:57 -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 ams.source.kernel.org (Postfix) with ESMTPS id 7C88AB8107A; Mon, 15 Aug 2022 19:16:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B640DC433C1; Mon, 15 Aug 2022 19:16:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591015; bh=UiwS0woC9t2O9OGl5uIZCvA0IgPGyEzpElFJIVaIBUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l0srZjpWYH5kRaz6uqSkQtBaMV+JYVVxm2Bs1/Xevx/W4EBKvw67JqCJCKi90LUMa /xN0K3GjaRoQ80sa53t7WE4PKPr9s0NbZL4o/e0LWzwqRInd2NvvspmXqhY2Nk3XWl ivJ7bCgiMCqXsCQum7ucUySztjRbHwVLLkc9baL8= 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.18 0445/1095] mt76: mt7921s: fix possible sdio deadlock in command fail Date: Mon, 15 Aug 2022 19:57:24 +0200 Message-Id: <20220815180448.051714585@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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