[PATCH v1 0/3] Bluetooth: fix recv_buf() return value

Francesco Dolcini posted 3 patches 2 years ago
There is a newer version of this series
drivers/bluetooth/btmtkuart.c | 11 +++--------
drivers/bluetooth/btnxpuart.c |  8 +++-----
2 files changed, 6 insertions(+), 13 deletions(-)
[PATCH v1 0/3] Bluetooth: fix recv_buf() return value
Posted by Francesco Dolcini 2 years ago
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.

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
Re: [PATCH v1 0/3] Bluetooth: fix recv_buf() return value
Posted by Francesco Dolcini 2 years ago
Hello Jiri,

On Mon, Nov 27, 2023 at 08:14:05PM +0100, Francesco Dolcini 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.

I have also a patch ready to convert the return value of serdev
recv_buf() from int to size_t.

I would be inclined to wait for this series to go though first, given
that these are fixes, while the change from int to size_t is just a
cleanup to prevent future mistakes. Do you agree of would you do it
differently?

Francesco
Re: [PATCH v1 0/3] Bluetooth: fix recv_buf() return value
Posted by Jiri Slaby 2 years ago
Hi,

On 27. 11. 23, 20:23, Francesco Dolcini wrote:
> On Mon, Nov 27, 2023 at 08:14:05PM +0100, Francesco Dolcini 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.
> 
> I have also a patch ready to convert the return value of serdev
> recv_buf() from int to size_t.
> 
> I would be inclined to wait for this series to go though first, given
> that these are fixes, while the change from int to size_t is just a
> cleanup to prevent future mistakes. Do you agree of would you do it
> differently?

Fine by me either way. You can include it in this series at the end. 
Fixes can be picked up by stable too, the rest would go to mainline only.

thanks,
-- 
js
suse labs