From patchwork Mon Jun 13 12:03:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 12879706 X-Patchwork-Delegate: nbd@nbd.name 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F393C43334 for ; Mon, 13 Jun 2022 15:01:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243217AbiFMPBd (ORCPT ); Mon, 13 Jun 2022 11:01:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242962AbiFMPBY (ORCPT ); Mon, 13 Jun 2022 11:01:24 -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 79E78EA89F for ; Mon, 13 Jun 2022 05:03:39 -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 CB3E560D57 for ; Mon, 13 Jun 2022 12:03:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84587C34114; Mon, 13 Jun 2022 12:03:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655121818; bh=kTAkhvM3Lw7dZhEszrD3t69FD2AF6yt7tgJKDF9GWhs=; h=From:To:Cc:Subject:Date:From; b=m0LZU0dOxWud8YJuYayQwxcuPGJQ1DhbUiyOXjAn6as7TAyP/ItESNJLSrDVixhiU CJG4vuc9cvx4OGicDn5XBr2Qu1lCRCM1E3lyTMA14wRD06GjFIixZf60WyHPterpn+ tNqW4Yw8qL/VFr4qyAA0jbU5hOTaBRby90zD6K8Kab1CZTKoK4KgeHbq7YKALfIKp2 sSp3AtJJpf0eg2QB3sxg3Dt0Nfziad0EtGhcKibBaNCnuU0N1P/UcPKnTK8rdrMUwi YpOjsY94VAGG45J5D+iB+cvx39pzJfQsJW0QSXYWm0ETOKzd6ie/0qvBxQhreTTZfp NH9aEn9JZgxzw== From: Lorenzo Bianconi To: nbd@nbd.name Cc: linux-wireless@vger.kernel.org Subject: [PATCH] mt76: mt7615: do not update pm stats in case of error Date: Mon, 13 Jun 2022 14:03:28 +0200 Message-Id: <84b00fe0e608523e52d2da385250997b5ff715c7.1655121764.git.lorenzo@kernel.org> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Do not update pm stats if mt7615_mcu_fw_pmctrl returns an error. Fixes: abe912ae3cd42 ("mt76: mt7663: add awake and doze time accounting") Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c index 52635fa430af..294a6f0e0136 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c @@ -338,10 +338,11 @@ static int mt7615_mcu_fw_pmctrl(struct mt7615_dev *dev) } mt7622_trigger_hif_int(dev, false); - - pm->stats.last_doze_event = jiffies; - pm->stats.awake_time += pm->stats.last_doze_event - - pm->stats.last_wake_event; + if (!err) { + pm->stats.last_doze_event = jiffies; + pm->stats.awake_time += pm->stats.last_doze_event - + pm->stats.last_wake_event; + } out: mutex_unlock(&pm->mutex);