From: Rosen Penev Date: Fri, 20 Mar 2026 01:05:17 +0000 (-0700) Subject: reset: sti: kzalloc + kcalloc to kzalloc X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=223af4a569d1f491e55d4de8ed40333c938622d0;p=thirdparty%2Fkernel%2Flinux.git reset: sti: kzalloc + kcalloc to kzalloc Simplify allocation. Signed-off-by: Rosen Penev Reviewed-by: Patrice Chotard Signed-off-by: Philipp Zabel --- diff --git a/drivers/reset/sti/reset-syscfg.c b/drivers/reset/sti/reset-syscfg.c index 2324060b747c8..38f78d78fa4fb 100644 --- a/drivers/reset/sti/reset-syscfg.c +++ b/drivers/reset/sti/reset-syscfg.c @@ -41,7 +41,7 @@ struct syscfg_reset_channel { struct syscfg_reset_controller { struct reset_controller_dev rst; bool active_low; - struct syscfg_reset_channel *channels; + struct syscfg_reset_channel channels[]; }; #define to_syscfg_reset_controller(_rst) \ @@ -135,15 +135,10 @@ static int syscfg_reset_controller_register(struct device *dev, struct syscfg_reset_controller *rc; int i, err; - rc = devm_kzalloc(dev, sizeof(*rc), GFP_KERNEL); + rc = devm_kzalloc(dev, struct_size(rc, channels, data->nr_channels), GFP_KERNEL); if (!rc) return -ENOMEM; - rc->channels = devm_kcalloc(dev, data->nr_channels, - sizeof(*rc->channels), GFP_KERNEL); - if (!rc->channels) - return -ENOMEM; - rc->rst.ops = &syscfg_reset_ops; rc->rst.of_node = dev->of_node; rc->rst.nr_resets = data->nr_channels;