From patchwork Tue Jul 4 16:50:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Shurong X-Patchwork-Id: 699217 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 82950EB64D9 for ; Tue, 4 Jul 2023 16:51:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230326AbjGDQvo (ORCPT ); Tue, 4 Jul 2023 12:51:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229595AbjGDQvn (ORCPT ); Tue, 4 Jul 2023 12:51:43 -0400 Received: from out162-62-57-137.mail.qq.com (out162-62-57-137.mail.qq.com [162.62.57.137]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27CE91AC; Tue, 4 Jul 2023 09:51:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1688489496; bh=cIg2PICXNPUsFX6awcRmfhx7g4SJNWbhIdMrQNCN3aY=; h=From:To:Cc:Subject:Date; b=eX+biQaka25vcEH843I6gO/gfaVVGlzdGFZzNFXntPEbqfDTLfLE3TeS/sahRdCxK or2kRbIJBN+pdqd/crbgTDDiD831eSNVgnNSqESey6is3ajJbo16cQgzSxJUmJSxzE Mqa0AorvmoquItSqnxnlClmjd3ZzCHUZ9QvJMnvE= Received: from localhost.localdomain ([119.136.250.51]) by newxmesmtplogicsvrszc2-0.qq.com (NewEsmtp) with SMTP id C85AE8D9; Wed, 05 Jul 2023 00:50:05 +0800 X-QQ-mid: xmsmtpt1688489405tni7sipgq Message-ID: X-QQ-XMAILINFO: NKDEJ657lpu+v/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@kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Zhang Shurong Subject: [PATCH] wifi: rtw89: debug: fix error code in rtw89_debug_priv_send_h2c_set() Date: Wed, 5 Jul 2023 00:50:02 +0800 X-OQ-MSGID: <20230704165002.30911-1-zhang_shurong@foxmail.com> X-Mailer: git-send-email 2.41.0 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. Signed-off-by: Zhang Shurong --- 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..96481dd2b1d3 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 err = 0; 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); + err = rtw89_fw_h2c_raw(rtwdev, h2c, h2c_len); kfree(h2c); - return count; + return err ? ERR_PTR(err) : count; } static int