Re: [PATCH v4] staging: rtl8723bs: replace ternary min comparison with min()

From: Dan Carpenter

Date: Mon Feb 09 2026 - 02:09:30 EST


On Sat, Feb 07, 2026 at 05:01:36PM -0500, William Hansen-Baird wrote:
> Change type of local variable wpa_ie_len from int to u8.
> wpa_ie_len gets its value either from elems->wpa_ie_len or
> elems->rsn_ie_len which are both u8, and thus there's no reason
> to cast them to int.
>
> This allows rewriting ternary min comparison using the min() function from
> linux/minmax.h as now both sides are unsigned.
>
> Rewrite as well wpa_ie_len + 2 to wpa_ie_len + 2u,
> to keep the expression unsigned and avoid overflows.
>
> Signed-off-by: William Hansen-Baird <william.hansen.baird@xxxxxxxxx>
> ---

LGTM.

Reviewed-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

regards,
dan carpenter