From patchwork Sat Jul 15 13:42:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Shurong X-Patchwork-Id: 13314480 X-Patchwork-Delegate: kvalo@adurom.com 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 AEBADEB64DC for ; Sat, 15 Jul 2023 13:43:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229596AbjGONnL (ORCPT ); Sat, 15 Jul 2023 09:43:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229549AbjGONnK (ORCPT ); Sat, 15 Jul 2023 09:43:10 -0400 Received: from out203-205-221-202.mail.qq.com (out203-205-221-202.mail.qq.com [203.205.221.202]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 982E82723; Sat, 15 Jul 2023 06:43:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1689428580; bh=dNz+OjNDlEUgComoIKSnoAm4Bz3z0vkm3h5nOzFr4OQ=; h=From:To:Cc:Subject:Date; b=mKONzNztJXodzzw/CkXykbombfvQ2uVvMtGyajakZF9CVHSC2+Sov3a/DS0a+55M8 skF7IP0HHNJIxnTAAEDoqsPeMpXCzqmVc1S606dRSXE9g3xdBnZcDoqVgFg6euVIev JBaeir6vnqiC7s5N7O9GvN3ekFJGdgCNQB1SPoUU= Received: from KernelDevBox.byted.org ([180.184.51.70]) by newxmesmtplogicsvrszb9-0.qq.com (NewEsmtp) with SMTP id ABA2A299; Sat, 15 Jul 2023 21:42:58 +0800 X-QQ-mid: xmsmtpt1689428578tn155qoz3 Message-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D7D4it2Ydth8lof1oDkWhBmSFocIl6cil/cB1yee X-QQ-XMRINFO: MPJ6Tf5t3I/ycC2BItcBVIA= From: Zhang Shurong To: pkshih@realtek.com, Markus.Elfring@web.de, kuba@kernel.org Cc: kvalo@kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Zhang Shurong Subject: [PATCH v4] wifi: rtw89: debug: Fix error handling in rtw89_debug_priv_btc_manual_set() Date: Sat, 15 Jul 2023 21:42:57 +0800 X-OQ-MSGID: <20230715134257.1847511-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 a negative error code instead of returning the count directly. Fix this bug by returning an error code instead of a count after a failed call of the function "kstrtobool_from_user". Moreover I omitted the label "out" with this source code correction. Fixes: e3ec7017f6a2 ("rtw89: add Realtek 802.11ax driver") Signed-off-by: Zhang Shurong Acked-by: Ping-Ke Shih --- Changes in v2: - Corrected the format of this patch - Used variable ret instead of goto out Changes in v3: - Improved change description Changes in v4: - Improved change description drivers/net/wireless/realtek/rtw89/debug.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw89/debug.c b/drivers/net/wireless/realtek/rtw89/debug.c index a4bbac916e22..ce5a9ac08145 100644 --- a/drivers/net/wireless/realtek/rtw89/debug.c +++ b/drivers/net/wireless/realtek/rtw89/debug.c @@ -3193,12 +3193,14 @@ 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)) - goto out; + ret = kstrtobool_from_user(user_buf, count, &btc_manual); + if (ret) + return ret; btc->ctrl.manual = btc_manual; -out: + return count; }