Re: [PATCH 2/7] drivers/hwmon: add local variable for newly allocated attribute_group**

From: Max Kellermann
Date: Mon Oct 09 2023 - 13:28:25 EST


On Mon, Oct 9, 2023 at 7:19 PM Guenter Roeck <linux@xxxxxxxxxxxx> wrote:
> I have no idea what this is about, and I don't see how that would
> improve anything, but ...

Later, we can make lots of global variables "const", which puts them
in ".rodata" (write-protected at runtime). This is some
micro-hardening.

> CHECK: multiple assignments should be avoided
> #101: FILE: drivers/hwmon/hwmon.c:794:
> + hwdev->groups = new_groups = kcalloc(ngroups, sizeof(*new_groups), GFP_KERNEL);

What program emitted this warning? checkpatch.pl had no error. I'll
change it in all patches.

> either case, this change is not acceptable.

Because of the multi-assignment, or is there something else?