Re: [PATCH v2 01/11] staging: stl8723bs: Use common round_up macro

From: Dan Carpenter

Date: Mon Feb 23 2026 - 02:12:34 EST


On Sat, Feb 21, 2026 at 03:41:27PM -0400, Vivek BalachandharTN wrote:
> Subject has a typo. Please correct it.
>
> How did you test this? The driver code appears largely AI-generated unless
> it has been validated on actual hardware, such as Pine64 Wi-Fi module or
> another board compatible with rtl8723bs considering these changes are not
> just indentation based.
>

The patch doesn't introduce any bugs.

#define _RND(sz, r) ((((sz)+((r)-1))/(r))*(r))

This is the canonical way to implement a round up macro. It's how
roundup() is implemented in the kernel.

The patch uses round_up() instead which is a faster version but it only
works for power of 2 rounds. psdio->block_transfer_len is 512 so it's
fine. I probably would prefer to use roundup() for that even though
round_up() works as well.

We maybe should create a static checker rule to warn about using
round_up() for non-power of 2 values:

KTODO: create a Smatch rule to use roundup() instead of round_up()
for user supplied values, or non-power of 2.

regards,
dan carpenter