Re: [PATCH] drivers: base: Remove statistics group if encryption group not created
From: Justin Tee
Date: Mon Jun 08 2026 - 17:12:54 EST
Hi Ewan,
Thanks for bringing this to attention. So, I have two comments:
1.) In the err_del_statistics label, should we check for if (tcont->statistics) and only then sysfs_remove_group(&classdev->kobj, tcont->statistics) could be called?
err_del_statistics:
if (tcont->statistics)
sysfs_remove_group(&classdev->kobj, tcont->statistics);
2.) In general, if the tcont->encryption sysfs group couldn’t be created, why would we remove the tcont->statistics sysfs group? The tcont->statistics and tcont->encryption are independent of each other. Just because the tcont->encryption sysfs group couldn’t be created shouldn’t mean that we need to remove the tcont->statistics sysfs group too. And, clean up of the tcont->statistics sysfs group is not lost. When transport_remove_classdev is called, the tcont->statistics sysfs group is cleaned up at that time.
Regards,
Justin