From patchwork Wed Jul 5 15:10:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Shurong X-Patchwork-Id: 701489 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 C8739C0015E for ; Wed, 5 Jul 2023 15:19:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233161AbjGEPTM (ORCPT ); Wed, 5 Jul 2023 11:19:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231676AbjGEPTM (ORCPT ); Wed, 5 Jul 2023 11:19:12 -0400 Received: from out203-205-221-155.mail.qq.com (out203-205-221-155.mail.qq.com [203.205.221.155]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 682BD170B; Wed, 5 Jul 2023 08:19:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1688570346; bh=2d4C37vHOrdi0OO9Rhqhynwy01/E8ygnR5bhbW9of4c=; h=From:To:Cc:Subject:Date; b=J3bPwYiuTNcKrv9uudBp97Hli+sKQ10EQ2BsQzdwHC6pay5LMfCGvH+6rrP4Yp6ZE SzCOgADoygFJXmf4/RwqqgwbqoqOY4kurzmP1VQFpnU2TEpIarX2Qq4QTjIeJa6QZP cN1FU5JqURzpQI4OzcFSNv8IKBmIYoh4YPC5jYqs= Received: from KernelDevBox.byted.org ([180.184.49.4]) by newxmesmtplogicsvrszc5-0.qq.com (NewEsmtp) with SMTP id 2AE37A77; Wed, 05 Jul 2023 23:10:46 +0800 X-QQ-mid: xmsmtpt1688569846t1sorvnm6 Message-ID: X-QQ-XMAILINFO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N4Ny6FSmKK/uo/jdU= From: Zhang Shurong To: pkshih@realtek.com Cc: kvalo@kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Zhang Shurong Subject: [PATCH v3] wifi: rtw89: debug: fix error code in rtw89_debug_priv_send_h2c_set() Date: Wed, 5 Jul 2023 23:10:44 +0800 X-OQ-MSGID: <20230705151044.1159881-1-zhang_shurong@foxmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org If there is a failure during rtw89_fw_h2c_raw() rtw89_debug_priv_send_h2c should return negative error code instead of a positive value count. Fix this bug by returning correct error code. Fixes: e3ec7017f6a2 ("rtw89: add Realtek 802.11ax driver") Signed-off-by: Zhang Shurong --- Changes in v2: - fixed compile error Changes in v3: - Corrected the annotation of this patch - Used variable ret instead of err --- drivers/net/wireless/realtek/rtw89/debug.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw89/debug.c b/drivers/net/wireless/realtek/rtw89/debug.c index 1db2d59d33ff..a4bbac916e22 100644 --- a/drivers/net/wireless/realtek/rtw89/debug.c +++ b/drivers/net/wireless/realtek/rtw89/debug.c @@ -3026,17 +3026,18 @@ static ssize_t rtw89_debug_priv_send_h2c_set(struct file *filp, struct rtw89_debugfs_priv *debugfs_priv = filp->private_data; struct rtw89_dev *rtwdev = debugfs_priv->rtwdev; u8 *h2c; + int ret; u16 h2c_len = count / 2; h2c = rtw89_hex2bin_user(rtwdev, user_buf, count); if (IS_ERR(h2c)) return -EFAULT; - rtw89_fw_h2c_raw(rtwdev, h2c, h2c_len); + ret = rtw89_fw_h2c_raw(rtwdev, h2c, h2c_len); kfree(h2c); - return count; + return ret ? ret : count; } static int