From: Tejun Heo tj@kernel.org
mainline inclusion from mainline-5.4-rc1 commit 86a5bba5c252e90d264c7460e29a0b9e633777e7 category: feature bugzilla: 38688 CVE: NA
---------------------------
For policies which can do enough initialization from ->cpd_alloc_fn(), make ->cpd_init_fn() optional.
Signed-off-by: Tejun Heo tj@kernel.org Signed-off-by: Jens Axboe axboe@kernel.dk Signed-off-by: Yu Kuai yukuai3@huawei.com Reviewed-by: Hou Tao houtao1@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- block/blk-cgroup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 6d218ac900715..8038c2b83f853 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -1570,7 +1570,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); } }