[02/10] blkcg: make ->cpd_init_fn() optional
diff mbox series

Message ID 20190710205128.1316483-3-tj@kernel.org
State New
Headers show
Series
  • [01/10] blkcg: pass @q and @blkcg into blkcg_pol_alloc_pd_fn()
Related show

Commit Message

Tejun Heo July 10, 2019, 8:51 p.m. UTC
For policies which can do enough initialization from ->cpd_alloc_fn(),
make ->cpd_init_fn() optional.

Signed-off-by: Tejun Heo <tj@kernel.org>
---
 block/blk-cgroup.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 75f7f78b87b2..818e50b4cc7a 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -1478,7 +1478,8 @@  int blkcg_policy_register(struct blkcg_policy *pol)
 			blkcg->cpd[pol->plid] = cpd;
 			cpd->blkcg = blkcg;
 			cpd->plid = pol->plid;
-			pol->cpd_init_fn(cpd);
+			if (pol->cpd_init_fn)
+				pol->cpd_init_fn(cpd);
 		}
 	}