* [PATCH] reset: sti: kzalloc + kcalloc to kzalloc
@ 2026-03-20 1:05 Rosen Penev
2026-03-20 8:16 ` Patrice CHOTARD
2026-03-20 10:12 ` Philipp Zabel
0 siblings, 2 replies; 3+ messages in thread
From: Rosen Penev @ 2026-03-20 1:05 UTC (permalink / raw)
To: linux-kernel
Cc: Patrice Chotard, Philipp Zabel,
moderated list:ARM/STI ARCHITECTURE
Simplify allocation.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/reset/sti/reset-syscfg.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/reset/sti/reset-syscfg.c b/drivers/reset/sti/reset-syscfg.c
index 2324060b747c..38f78d78fa4f 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;
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] reset: sti: kzalloc + kcalloc to kzalloc
2026-03-20 1:05 [PATCH] reset: sti: kzalloc + kcalloc to kzalloc Rosen Penev
@ 2026-03-20 8:16 ` Patrice CHOTARD
2026-03-20 10:12 ` Philipp Zabel
1 sibling, 0 replies; 3+ messages in thread
From: Patrice CHOTARD @ 2026-03-20 8:16 UTC (permalink / raw)
To: Rosen Penev, linux-kernel
Cc: Philipp Zabel, moderated list:ARM/STI ARCHITECTURE
On 3/20/26 02:05, Rosen Penev wrote:
> Simplify allocation.
>
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
> drivers/reset/sti/reset-syscfg.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/reset/sti/reset-syscfg.c b/drivers/reset/sti/reset-syscfg.c
> index 2324060b747c..38f78d78fa4f 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;
Hi Rosen
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Thanks
Patrice
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] reset: sti: kzalloc + kcalloc to kzalloc
2026-03-20 1:05 [PATCH] reset: sti: kzalloc + kcalloc to kzalloc Rosen Penev
2026-03-20 8:16 ` Patrice CHOTARD
@ 2026-03-20 10:12 ` Philipp Zabel
1 sibling, 0 replies; 3+ messages in thread
From: Philipp Zabel @ 2026-03-20 10:12 UTC (permalink / raw)
To: Rosen Penev, linux-kernel
Cc: Patrice Chotard, moderated list:ARM/STI ARCHITECTURE
On Do, 2026-03-19 at 18:05 -0700, Rosen Penev wrote:
> Simplify allocation.
>
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
Applied to reset/next, thanks!
[1/1] reset: sti: kzalloc + kcalloc to kzalloc
https://git.pengutronix.de/cgit/pza/linux/commit/?id=223af4a569d1
regards
Philipp
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-20 10:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-20 1:05 [PATCH] reset: sti: kzalloc + kcalloc to kzalloc Rosen Penev
2026-03-20 8:16 ` Patrice CHOTARD
2026-03-20 10:12 ` Philipp Zabel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox