mm/damon/sysfs: remove repeat container_of() in damon_sysfs_kdamond_release()
Subsystems (2)
PATCH 1/1 mm/damon/sysfs: remove repeat container_of() in damon_sysfs_kdamond_release()
In damon_sysfs_kdamond_release(), we have use container_of() to get "kdamond" pointer, so there no need to get it once again.
Signed-off-by Xin Hao <[email protected]>
--- mm/damon/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/damon/sysfs.c +1 -1
@@ -2432,7 +2432,7 @@ static void damon_sysfs_kdamond_release(struct kobject *kobj)if (kdamond->damon_ctx)damon_destroy_ctx (kdamond->damon_ctx); -kfree (container_of(kobj ,struct damon_sysfs_kdamond ,kobj )); +kfree (kdamond); } static struct kobj_attribute damon_sysfs_kdamond_state_attr =
Signature · 1 line
2.27.0
Hi Xin,
Quoted 2 lines · On Thu, 3 Mar 2022 15:53:14 +0800 Xin Hao <[email protected]> wrote:
In
damon_sysfs_kdamond_release(), we have usecontainer_of()to get "kdamond" pointer, so there no need to get it once again.
Good catch! Thank you always :)
Quoted 2 lines
Signed-off-by Xin Hao <[email protected]>
Reviewed-by SeongJae Park <[email protected]>
Thanks,
SJ
Quoted 19 lines
--- mm/damon/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/damon/sysfs.c +1
-1@@ -2432,7 +2432,7 @@ static void damon_sysfs_kdamond_release(struct kobject *kobj)if (kdamond->damon_ctx)damon_destroy_ctx (kdamond->damon_ctx); -kfree (container_of(kobj ,struct damon_sysfs_kdamond ,kobj )); +kfree (kdamond); } static struct kobj_attribute damon_sysfs_kdamond_state_attr =Signature · 1 line
2.27.0