public inbox for linux-mediatek@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Bluetooth: fix recv_buf() return value
@ 2023-12-11 16:40 Francesco Dolcini
  2023-12-11 16:40 ` [PATCH v2 2/3] Bluetooth: btmtkuart: " Francesco Dolcini
  2023-12-12 16:20 ` [PATCH v2 0/3] Bluetooth: " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Francesco Dolcini @ 2023-12-11 16:40 UTC (permalink / raw)
  To: Sean Wang, Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	Matthias Brugger, AngeloGioacchino Del Regno, Amitkumar Karwar,
	Neeraj Kale
  Cc: Francesco Dolcini, linux-bluetooth, linux-mediatek, linux-kernel,
	linux-arm-kernel, Jiri Slaby

From: Francesco Dolcini <francesco.dolcini@toradex.com>

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().

In addition to that a small cleanup patch is added on btnxpuart to remove a useless assignment.

v2:
 - improved commit messages

Francesco Dolcini (3):
  Bluetooth: btnxpuart: fix recv_buf() return value
  Bluetooth: btmtkuart: fix recv_buf() return value
  Bluetooth: btnxpuart: remove useless assignment

 drivers/bluetooth/btmtkuart.c | 11 +++--------
 drivers/bluetooth/btnxpuart.c |  8 +++-----
 2 files changed, 6 insertions(+), 13 deletions(-)

-- 
2.25.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 2/3] Bluetooth: btmtkuart: fix recv_buf() return value
  2023-12-11 16:40 [PATCH v2 0/3] Bluetooth: fix recv_buf() return value Francesco Dolcini
@ 2023-12-11 16:40 ` Francesco Dolcini
  2023-12-12 16:20 ` [PATCH v2 0/3] Bluetooth: " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: Francesco Dolcini @ 2023-12-11 16:40 UTC (permalink / raw)
  To: Sean Wang, Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: Francesco Dolcini, linux-bluetooth, linux-mediatek, linux-kernel,
	linux-arm-kernel, Jiri Slaby

From: Francesco Dolcini <francesco.dolcini@toradex.com>

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 <francesco.dolcini@toradex.com>
---
 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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 0/3] Bluetooth: fix recv_buf() return value
  2023-12-11 16:40 [PATCH v2 0/3] Bluetooth: fix recv_buf() return value Francesco Dolcini
  2023-12-11 16:40 ` [PATCH v2 2/3] Bluetooth: btmtkuart: " Francesco Dolcini
@ 2023-12-12 16:20 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2023-12-12 16:20 UTC (permalink / raw)
  To: Francesco Dolcini
  Cc: sean.wang, marcel, johan.hedberg, luiz.dentz, matthias.bgg,
	angelogioacchino.delregno, amitkumar.karwar, neeraj.sanjaykale,
	francesco.dolcini, linux-bluetooth, linux-mediatek, linux-kernel,
	linux-arm-kernel, jirislaby

Hello:

This series was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Mon, 11 Dec 2023 17:40:17 +0100 you wrote:
> From: Francesco Dolcini <francesco.dolcini@toradex.com>
> 
> 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().
> 
> In addition to that a small cleanup patch is added on btnxpuart to remove a useless assignment.
> 
> [...]

Here is the summary with links:
  - [v2,1/3] Bluetooth: btnxpuart: fix recv_buf() return value
    https://git.kernel.org/bluetooth/bluetooth-next/c/7954bbcdd7ea
  - [v2,2/3] Bluetooth: btmtkuart: fix recv_buf() return value
    https://git.kernel.org/bluetooth/bluetooth-next/c/687d2de93b11
  - [v2,3/3] Bluetooth: btnxpuart: remove useless assignment
    https://git.kernel.org/bluetooth/bluetooth-next/c/99f188d71731

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-12 16:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-11 16:40 [PATCH v2 0/3] Bluetooth: fix recv_buf() return value Francesco Dolcini
2023-12-11 16:40 ` [PATCH v2 2/3] Bluetooth: btmtkuart: " Francesco Dolcini
2023-12-12 16:20 ` [PATCH v2 0/3] Bluetooth: " patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox