From patchwork Sat Jul 15 12:51:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Shurong X-Patchwork-Id: 703542 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 2AFE2EB64DC for ; Sat, 15 Jul 2023 12:52:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229796AbjGOMwj (ORCPT ); Sat, 15 Jul 2023 08:52:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229552AbjGOMwi (ORCPT ); Sat, 15 Jul 2023 08:52:38 -0400 Received: from out203-205-221-205.mail.qq.com (out203-205-221-205.mail.qq.com [203.205.221.205]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3651A35B5; Sat, 15 Jul 2023 05:52:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1689425535; bh=ZavfJ3sl0BIdu9qU/Btv2uDCTKqWbE0OwBWuVN/30zo=; h=From:To:Cc:Subject:Date; b=awfmRGi3i8FeUigI0LF58aw+jVInz9kTg0VuR33SS9wO7ITU0YL5xrPdONHabxZov YM82j7lGY2hAw+ZpPKqnLE7wo4uZl4JFddwU/IE6Vo5B+ySysJj8bGH/p0xFN4AIsQ g3eZi44FyOEidLiETarQADuoLzuInv9nLFM0P1TI= Received: from KernelDevBox.byted.org ([180.184.51.70]) by newxmesmtplogicsvrszc5-0.qq.com (NewEsmtp) with SMTP id D0C9C832; Sat, 15 Jul 2023 20:52:12 +0800 X-QQ-mid: xmsmtpt1689425532twcg2r5io Message-ID: X-QQ-XMAILINFO: Ma+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kdJqqOxksAyMhp7vE7xJdHFW6R0W899T5comYKqm+yru4npc= X-QQ-XMRINFO: Nq+8W0+stu50PRdwbJxPCL0= 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 v3] wifi: rtw89: debug: fix error code in Date: Sat, 15 Jul 2023 20:51:45 +0800 X-OQ-MSGID: <20230715125145.1771474-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 returning the count driectly. Fix this bug with the following changes: - Return an error code instead of a count after a failed call of the function "kstrtobool_from_user". - Omit the label "out" with this source code correction. Fixes: e3ec7017f6a2 ("rtw89: add Realtek 802.11ax driver") Signed-off-by: Zhang Shurong --- Changes in v2: - Corrected the format of this patch - Used variable ret instead of goto out Changes in v3: - 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; }