pmdomain: qcom: cpr: simplify main allocation

Remove kcalloc by using a flexible array member to combine allocations.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
Rosen Penev
2026-03-15 14:41:53 -07:00
committed by Ulf Hansson
parent d797ecf3ff
commit 66ab322c61

View File

@@ -239,7 +239,6 @@ struct cpr_drv {
u32 gcnt;
unsigned long flags;
struct fuse_corner *fuse_corners;
struct corner *corners;
const struct cpr_desc *desc;
@@ -247,6 +246,8 @@ struct cpr_drv {
const struct cpr_fuse *cpr_fuses;
struct dentry *debugfs;
struct fuse_corner fuse_corners[];
};
static bool cpr_is_allowed(struct cpr_drv *drv)
@@ -1600,19 +1601,15 @@ static int cpr_probe(struct platform_device *pdev)
if (!data || !data->cpr_desc || !data->acc_desc)
return -EINVAL;
drv = devm_kzalloc(dev, sizeof(*drv), GFP_KERNEL);
drv = devm_kzalloc(dev,
struct_size(drv, fuse_corners, data->cpr_desc->num_fuse_corners),
GFP_KERNEL);
if (!drv)
return -ENOMEM;
drv->dev = dev;
drv->desc = data->cpr_desc;
drv->acc_desc = data->acc_desc;
drv->fuse_corners = devm_kcalloc(dev, drv->desc->num_fuse_corners,
sizeof(*drv->fuse_corners),
GFP_KERNEL);
if (!drv->fuse_corners)
return -ENOMEM;
np = of_parse_phandle(dev->of_node, "acc-syscon", 0);
if (!np)
return -ENODEV;