2024-01-05 18:12:28

by Erick Archer

[permalink] [raw]
Subject: [PATCH] PM / QOS: Use kcalloc() instead of kzalloc()

Use 2-factor multiplication argument form kcalloc() instead
of kzalloc().

Link: https://github.com/KSPP/linux/issues/162
Signed-off-by: Erick Archer <[email protected]>
---
drivers/base/power/qos.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c
index 8e93167f1783..bd77f6734f14 100644
--- a/drivers/base/power/qos.c
+++ b/drivers/base/power/qos.c
@@ -201,7 +201,7 @@ static int dev_pm_qos_constraints_allocate(struct device *dev)
if (!qos)
return -ENOMEM;

- n = kzalloc(3 * sizeof(*n), GFP_KERNEL);
+ n = kcalloc(3, sizeof(*n), GFP_KERNEL);
if (!n) {
kfree(qos);
return -ENOMEM;
--
2.42.0



2024-01-05 18:17:52

by Gustavo A. R. Silva

[permalink] [raw]
Subject: Re: [PATCH] PM / QOS: Use kcalloc() instead of kzalloc()



On 1/5/24 12:11, Erick Archer wrote:
> Use 2-factor multiplication argument form kcalloc() instead
> of kzalloc().
>
> Link: https://github.com/KSPP/linux/issues/162
> Signed-off-by: Erick Archer <[email protected]>

Reviewed-by: Gustavo A. R. Silva <[email protected]>

Thanks!
--
Gustavo

> ---
> drivers/base/power/qos.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c
> index 8e93167f1783..bd77f6734f14 100644
> --- a/drivers/base/power/qos.c
> +++ b/drivers/base/power/qos.c
> @@ -201,7 +201,7 @@ static int dev_pm_qos_constraints_allocate(struct device *dev)
> if (!qos)
> return -ENOMEM;
>
> - n = kzalloc(3 * sizeof(*n), GFP_KERNEL);
> + n = kcalloc(3, sizeof(*n), GFP_KERNEL);
> if (!n) {
> kfree(qos);
> return -ENOMEM;
> --
> 2.42.0
>
>

2024-01-09 13:57:52

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH] PM / QOS: Use kcalloc() instead of kzalloc()

On Fri, Jan 5, 2024 at 7:17 PM Gustavo A. R. Silva
<[email protected]> wrote:
>
>
>
> On 1/5/24 12:11, Erick Archer wrote:
> > Use 2-factor multiplication argument form kcalloc() instead
> > of kzalloc().
> >
> > Link: https://github.com/KSPP/linux/issues/162
> > Signed-off-by: Erick Archer <[email protected]>
>
> Reviewed-by: Gustavo A. R. Silva <[email protected]>

Applied as 6.8-rc1 material, thanks!

> > ---
> > drivers/base/power/qos.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c
> > index 8e93167f1783..bd77f6734f14 100644
> > --- a/drivers/base/power/qos.c
> > +++ b/drivers/base/power/qos.c
> > @@ -201,7 +201,7 @@ static int dev_pm_qos_constraints_allocate(struct device *dev)
> > if (!qos)
> > return -ENOMEM;
> >
> > - n = kzalloc(3 * sizeof(*n), GFP_KERNEL);
> > + n = kcalloc(3, sizeof(*n), GFP_KERNEL);
> > if (!n) {
> > kfree(qos);
> > return -ENOMEM;
> > --
> > 2.42.0
> >
> >