Re: [PATCH v7 43/49] x86/resctrl: Prefer alloc(sizeof(*foo)) idiom in rdt_init_fs_context()

From: Fenghua Yu
Date: Thu Mar 06 2025 - 21:23:54 EST



On 2/28/25 11:59, James Morse wrote:
From: Dave Martin <Dave.Martin@xxxxxxx>

rdt_init_fs_context() sizes a typed allocation using an explicit
sizeof(type) expression, which checkpatch.pl complains about.

Since this code is about to be factored out and made generic, this
is a good opportunity to fix the code to size the allocation based
on the target pointer instead, to reduce the chance of future mis-
maintenance.

Fix it.

No functional change.

Signed-off-by: Dave Martin <Dave.Martin@xxxxxxx>
Signed-off-by: James Morse <james.morse@xxxxxxx>

Reviewed-by: Fenghua Yu <fenghuay@xxxxxxxxxx>

Thanks.

-Fenghua