On Tue, May 26, 2026 at 12:01 AM Rosen Penev <[email protected]> wrote:

> Turn the separately allocated pinctrl_pin_desc array into a flexible
> array member of struct rza2_pinctrl_priv, annotated with
> __counted_by(npins). The pin count is now computed before allocation so
> struct_size() can size the combined object, collapsing two allocations
> into one.
>
> Assisted-by: Claude:Opus-4.7
> Signed-off-by: Rosen Penev <[email protected]>

Overall this looks interesting!

>         struct rza2_pinctrl_priv *priv;
> +       int npins;

unsigned int npins

Fix the variable in the struct too if it's just an int.

>         int ret;
>
> -       priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> +       npins = (int)(uintptr_t)of_device_get_match_data(&pdev->dev) *
> +                     RZA2_PINS_PER_PORT;

Uh a double cast, why? Just cast to (unsigned int).

I know this was in the code before, but take this opportunity to fix it.

Yours,
Linus Walleij

Reply via email to