[PATCH v3 6/9] xen/sys-hypervisor: Add release callback to hyp_sysfs_kobj_type

Juergen Gross jgross at suse.com
Sun Nov 8 22:56:39 PST 2026


On 08.11.26 23:39, Ian Rogers wrote:
> hypervisor_init() in drivers/base/hypervisor.c creates hypervisor_kobj
> with kobject_create_and_add() (which allocates a dynamic kobject using
> dynamic_kobj_ktype), and hypervisor_subsys_init() in
> drivers/xen/sys-hypervisor.c then overwrites hypervisor_kobj->ktype with
> &hyp_sysfs_kobj_type, which had no .release callback.
> 
> Add hyp_sysfs_release() calling kfree(kobj) to preserve the dynamic
> kobject release behavior.
> 
> Fixes: cff7e81b3dd7 ("xen: add /sys/hypervisor support")
> Signed-off-by: Ian Rogers <irogers at google.com>
> ---
>   drivers/xen/sys-hypervisor.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/xen/sys-hypervisor.c b/drivers/xen/sys-hypervisor.c
> index 91923242a5ae..0e8a2cd69fd6 100644
> --- a/drivers/xen/sys-hypervisor.c
> +++ b/drivers/xen/sys-hypervisor.c
> @@ -659,7 +659,13 @@ static const struct sysfs_ops hyp_sysfs_ops = {
>   	.store = hyp_sysfs_store,
>   };
>   
> +static void hyp_sysfs_release(struct kobject *kobj)
> +{
> +	kfree(kobj);
> +}
> +
>   static const struct kobj_type hyp_sysfs_kobj_type = {
> +	.release = hyp_sysfs_release,
>   	.sysfs_ops = &hyp_sysfs_ops,
>   };
>   

Wouldn't it make sense to have a common function for just kfree(kobj)?

In your series there are 3 instances of .release just doing kfree(kobj).

In case this is not wanted or with using the suggested common .release
helper you can add my

Reviewed-by: Juergen Gross <jgross at suse.com>


Juergen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20261109/0173e064/attachment-0001.sig>


More information about the linux-mtd mailing list