From patchwork Sun Jul 9 09:59:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Shurong X-Patchwork-Id: 701481 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 3909DEB64DC for ; Sun, 9 Jul 2023 09:59:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230226AbjGIJ7Q (ORCPT ); Sun, 9 Jul 2023 05:59:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229534AbjGIJ7P (ORCPT ); Sun, 9 Jul 2023 05:59:15 -0400 Received: from out162-62-57-49.mail.qq.com (out162-62-57-49.mail.qq.com [162.62.57.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F525129; Sun, 9 Jul 2023 02:59:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1688896749; bh=Ok2UwAr6nX11lqE2tuCWc4B2WooiEHa6YY7cWJtYm5c=; h=From:To:Cc:Subject:Date; b=cQd5gBrxZo7fGbwbn8T4madSXQbDYcfpj+xEqi3vrAmdhK5wJYlOLAvSfIquDdCdw ZZhKXSDF6rQRqCb1SOknbbX4PgEWeaIgf8C+yEaDrhE3VADIfjJwp9TMCj1+ZIa0Br OvzgCboAkku91IR0wGAxDMXWUIfNdNuTVGyCDwfo= Received: from KernelDevBox.byted.org ([180.184.51.70]) by newxmesmtplogicsvrszb6-0.qq.com (NewEsmtp) with SMTP id EC6B723B; Sun, 09 Jul 2023 17:59:06 +0800 X-QQ-mid: xmsmtpt1688896746txvus3ima Message-ID: X-QQ-XMAILINFO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hxQsoeAVDbp3OJHYyFg= 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] wifi: rtw89: debug: fix error code in rtw89_debug_priv_btc_manual_set Date: Sun, 9 Jul 2023 17:59:06 +0800 X-OQ-MSGID: <20230709095906.1162670-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 kstrtobool_from_user() rtw89_debug_priv_btc_manual_set 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 --- drivers/net/wireless/realtek/rtw89/debug.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtw89/debug.c b/drivers/net/wireless/realtek/rtw89/debug.c index 1db2d59d33ff..35fe6b4ad9b3 100644 --- a/drivers/net/wireless/realtek/rtw89/debug.c +++ b/drivers/net/wireless/realtek/rtw89/debug.c @@ -3192,9 +3192,13 @@ static ssize_t rtw89_debug_priv_btc_manual_set(struct file *filp, struct rtw89_dev *rtwdev = debugfs_priv->rtwdev; struct rtw89_btc *btc = &rtwdev->btc; bool btc_manual; + int ret; - if (kstrtobool_from_user(user_buf, count, &btc_manual)) + ret = kstrtobool_from_user(user_buf, count, &btc_manual); + if (ret) { + count = ret; goto out; + } btc->ctrl.manual = btc_manual; out: