Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4094813rdb; Mon, 11 Dec 2023 08:40:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IHGzI/u4VDhw+tCHwh+J0QT8XUyW4LXGEKoLJaHIRogaWhhtyaWIZ5Cph5Zze0aajwpHCzX X-Received: by 2002:a05:6512:e97:b0:50b:efbb:c59e with SMTP id bi23-20020a0565120e9700b0050befbbc59emr2847978lfb.29.1702312843816; Mon, 11 Dec 2023 08:40:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702312843; cv=none; d=google.com; s=arc-20160816; b=iSyBkt9F+zvZyZBy7Bn/0g8bOFOuD/iR3xA77sg145xU/xuWkvhVIgQXFYRHTIh4Wq 1nUwwZ45ZPZwek98R7bOIj78cyZ4xsAT2VpKYVGWlUr4pSc7SP+9HM1uZFQMN1ejWWkf 6z3y3z350IL+l3n6wkKE2f7l/VyqZCr2awvsECDnn+J+zTpTCAlSyQK4AJ/8fAe/h+tw xXxB72XPL6sEmqci98dxJbobrO61wUGY1WCdIF+3mQ8cgfKAX+OoEv9Ca25FYqspLpb2 TdVR21iCPhZcnW49GqQF+HAdbmldxHT7LODhWgM7H5JfKEcQTxKzCShyn8RXeopIMhkE RVtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=UJ10r3dh2xTS/vsXAUEpXnY7lGrUG6apo4MyF3nuVt0=; fh=E5ZDEIMiF+yL9ul64AXuEgXkfXW3l10EE2utCLzvVN8=; b=yS7Gl9qoNElCNuMp78c9BFoYQCK2stvzI7NLaWH6pvujwnhmF0daZ/ELXrOfv0fCRY SHFzlnKo5Qqli2r3XQi6RGTu2MVQ+usYZFI0QLavhuCTdTnNJ7GR2RV0ihT+nBMVB9uP z9J03eY1S+PJ+Ls6clJF8WXum7shOJ1LcmOdwuypeGF2FUP0Fuy8P5CGaRf7vLm8ZFf/ uTP7m21ihryUNltmYDX91PhEm7X7LSyDTYY39jEDiHjFW7ZunzbLp+gqD/weSrNi6Z+l gPviSz30zkUv31Tb36/QBCSqPJP+5eC1I++bRtK7W7MohznSFoYUs2eC8N+sydMKvSxB rmOw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth+bounces-520-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-520-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id v24-20020a1709064e9800b00a1b76fe4c81si3731312eju.721.2023.12.11.08.40.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 08:40:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-520-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth+bounces-520-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-520-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8CEC71F216D9 for ; Mon, 11 Dec 2023 16:40:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 661783B785; Mon, 11 Dec 2023 16:40:34 +0000 (UTC) X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail11.truemail.it (mail11.truemail.it [217.194.8.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECC5CBD; Mon, 11 Dec 2023 08:40:27 -0800 (PST) Received: from francesco-nb.pivistrello.it (93-49-2-63.ip317.fastwebnet.it [93.49.2.63]) by mail11.truemail.it (Postfix) with ESMTPA id 17F492094C; Mon, 11 Dec 2023 17:40:26 +0100 (CET) From: Francesco Dolcini To: Sean Wang , Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , Matthias Brugger , AngeloGioacchino Del Regno Cc: Francesco Dolcini , linux-bluetooth@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jiri Slaby Subject: [PATCH v2 2/3] Bluetooth: btmtkuart: fix recv_buf() return value Date: Mon, 11 Dec 2023 17:40:19 +0100 Message-Id: <20231211164020.173253-3-francesco@dolcini.it> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231211164020.173253-1-francesco@dolcini.it> References: <20231211164020.173253-1-francesco@dolcini.it> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Francesco Dolcini Serdev recv_buf() callback is supposed to return the amount of bytes consumed, therefore an int in between 0 and count. Do not return negative number in case of issue, just print an error and return count. This fixes a WARN in ttyport_receive_buf(). Link: https://lore.kernel.org/all/087be419-ec6b-47ad-851a-5e1e3ea5cfcc@kernel.org/ Fixes: 7237c4c9ec92 ("Bluetooth: mediatek: Add protocol support for MediaTek serial devices") Signed-off-by: Francesco Dolcini --- drivers/bluetooth/btmtkuart.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/bluetooth/btmtkuart.c b/drivers/bluetooth/btmtkuart.c index 935feab815d9..203a000a84e3 100644 --- a/drivers/bluetooth/btmtkuart.c +++ b/drivers/bluetooth/btmtkuart.c @@ -336,7 +336,7 @@ mtk_stp_split(struct btmtkuart_dev *bdev, const unsigned char *data, int count, return data; } -static int btmtkuart_recv(struct hci_dev *hdev, const u8 *data, size_t count) +static void btmtkuart_recv(struct hci_dev *hdev, const u8 *data, size_t count) { struct btmtkuart_dev *bdev = hci_get_drvdata(hdev); const unsigned char *p_left = data, *p_h4; @@ -375,25 +375,20 @@ static int btmtkuart_recv(struct hci_dev *hdev, const u8 *data, size_t count) bt_dev_err(bdev->hdev, "Frame reassembly failed (%d)", err); bdev->rx_skb = NULL; - return err; + return; } sz_left -= sz_h4; p_left += sz_h4; } - - return 0; } static int btmtkuart_receive_buf(struct serdev_device *serdev, const u8 *data, size_t count) { struct btmtkuart_dev *bdev = serdev_device_get_drvdata(serdev); - int err; - err = btmtkuart_recv(bdev->hdev, data, count); - if (err < 0) - return err; + btmtkuart_recv(bdev->hdev, data, count); bdev->hdev->stat.byte_rx += count; -- 2.25.1