Re: [PATCH v3 1/2] gpio: sim: fix an invalid __free() usage
From: Linus Torvalds
Date: Sun Sep 17 2023 - 12:47:38 EST
On Sun, 17 Sept 2023 at 02:12, Bartosz Golaszewski <brgl@xxxxxxxx> wrote:
>
> + has_line_names = true;
> + max_offset = max(line->offset, max_offset);
I really don't understand why you kept this old broken logic.
I sent a much better version of this function that didn't need that
pointless has_line_names thing or the 'max()' thing, by just making
the code a lot simpler.
Whatever.
> + line_names_size = gpio_sim_get_line_names_size(bank);
> + if (line_names_size) {
> + line_names = kcalloc(line_names_size, sizeof(*line_names),
> + GFP_KERNEL);
> + if (!line_names)
> + return ERR_PTR(-ENOMEM);
> +
> + gpio_sim_set_line_names(bank, line_names);
>
> - if (line_names)
> properties[prop_idx++] = PROPERTY_ENTRY_STRING_ARRAY_LEN(
> "gpio-line-names",
> line_names, line_names_size);
> + }
But I do like this reorganization.
Linus