From patchwork Thu Jul 6 02:45:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Shurong X-Patchwork-Id: 700011 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 53F46EB64DA for ; Thu, 6 Jul 2023 02:45:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233003AbjGFCpI (ORCPT ); Wed, 5 Jul 2023 22:45:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232740AbjGFCpH (ORCPT ); Wed, 5 Jul 2023 22:45:07 -0400 X-Greylist: delayed 41655 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 05 Jul 2023 19:45:05 PDT Received: from out203-205-221-235.mail.qq.com (out203-205-221-235.mail.qq.com [203.205.221.235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD80110E; Wed, 5 Jul 2023 19:45:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1688611503; bh=JnNzgLB8w6Q6LeQnG1yQwzv12sGbVpzF8oRa8zl++vM=; h=From:To:Cc:Subject:Date; b=md02HigfCnNlJgh8qtv48CQ5FDlSDY6wDLTggo4T+A7O1HVIawrXaZ8RnZSJippEq FnquL8tLNfY0fmNHA/HhbbzPV9eCstAv01xM4ka9fW1sBzkbrju26yFsUSev9ccP+2 9HHXBPKLkGcybijzqAbv76zJvgAzsExaj81WUMt4= Received: from KernelDevBox.byted.org ([180.184.84.173]) by newxmesmtplogicsvrsza12-0.qq.com (NewEsmtp) with SMTP id B4116088; Thu, 06 Jul 2023 10:45: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Dmo X-QQ-XMRINFO: Nq+8W0+stu50PRdwbJxPCL0= 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 v4] wifi: rtw89: debug: fix error code in rtw89_debug_priv_send_h2c_set() Date: Thu, 6 Jul 2023 10:45:00 +0800 X-OQ-MSGID: <20230706024500.2285151-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 Acked-by: Ping-Ke Shih --- Changes in v2: - fixed compile error Changes in v3: - Corrected the annotation of this patch - Used variable ret instead of err Changes in v4: - Corrected thr format of this patch --- 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