On Tue, Oct 13, 2026 at 03:39:43PM -0700, Ian Rogers wrote:
> sclp_init_mem() allocated a single array of struct sclp_mem with
> kzalloc_objs() and registered each embedded kobject using a kobj_type
> without a .release callback. Allocate each struct sclp_mem individually
> with kzalloc_obj() instead and add sclp_mem_release() to free it.
> 
> Fixes: ff18dcb19aab ("s390/sclp: Add support for dynamic (de)configuration of 
> memory")
> Assisted-by: Antigravity:gemini-3.1-pro
> Signed-off-by: Ian Rogers <[email protected]>

Hi Ian,

The entries under /sys/firmware/memory/memoryX in sclp_mem.c are
permanent. They are backed by a single array allocated at boot and
remain for the lifetime of the system.

Memory hotplug can add or remove memory blocks under
/sys/devices/system/memory/, but it does not remove these firmware
entries. The /sys/firmware/memory/memoryX kobjects are never
unregistered or freed, so I think there is no need for
kobject_put() and no execution of a .release callback.

Instead, could this follow the approach used in Patch 11 of this series?
static const struct kobj_type ktype = {
        .release = NULL, /* Permanent firmware kobjects, never freed */
        .sysfs_ops = &kobj_sysfs_ops,
};

Thank you

Reply via email to