* [PATCH] gpio: sim: Use correct order for the parameters of devm_kcalloc()
@ 2022-05-20 19:21 Christophe JAILLET
2022-05-22 20:10 ` Bartosz Golaszewski
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2022-05-20 19:21 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-gpio
We should have 'n', then 'size', not the opposite.
This is harmless because the 2 values are just multiplied, but having
the correct order silence a (unpublished yet) smatch warning.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/gpio/gpio-sim.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c
index 41c31b10ae84..98109839102f 100644
--- a/drivers/gpio/gpio-sim.c
+++ b/drivers/gpio/gpio-sim.c
@@ -314,8 +314,8 @@ static int gpio_sim_setup_sysfs(struct gpio_sim_chip *chip)
for (i = 0; i < num_lines; i++) {
attr_group = devm_kzalloc(dev, sizeof(*attr_group), GFP_KERNEL);
- attrs = devm_kcalloc(dev, sizeof(*attrs),
- GPIO_SIM_NUM_ATTRS, GFP_KERNEL);
+ attrs = devm_kcalloc(dev, GPIO_SIM_NUM_ATTRS, sizeof(*attrs),
+ GFP_KERNEL);
val_attr = devm_kzalloc(dev, sizeof(*val_attr), GFP_KERNEL);
pull_attr = devm_kzalloc(dev, sizeof(*pull_attr), GFP_KERNEL);
if (!attr_group || !attrs || !val_attr || !pull_attr)
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] gpio: sim: Use correct order for the parameters of devm_kcalloc()
2022-05-20 19:21 [PATCH] gpio: sim: Use correct order for the parameters of devm_kcalloc() Christophe JAILLET
@ 2022-05-22 20:10 ` Bartosz Golaszewski
0 siblings, 0 replies; 2+ messages in thread
From: Bartosz Golaszewski @ 2022-05-22 20:10 UTC (permalink / raw)
To: Christophe JAILLET
Cc: Linus Walleij, Linux Kernel Mailing List, kernel-janitors,
open list:GPIO SUBSYSTEM
On Fri, May 20, 2022 at 9:21 PM Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
>
> We should have 'n', then 'size', not the opposite.
> This is harmless because the 2 values are just multiplied, but having
> the correct order silence a (unpublished yet) smatch warning.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> drivers/gpio/gpio-sim.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c
> index 41c31b10ae84..98109839102f 100644
> --- a/drivers/gpio/gpio-sim.c
> +++ b/drivers/gpio/gpio-sim.c
> @@ -314,8 +314,8 @@ static int gpio_sim_setup_sysfs(struct gpio_sim_chip *chip)
>
> for (i = 0; i < num_lines; i++) {
> attr_group = devm_kzalloc(dev, sizeof(*attr_group), GFP_KERNEL);
> - attrs = devm_kcalloc(dev, sizeof(*attrs),
> - GPIO_SIM_NUM_ATTRS, GFP_KERNEL);
> + attrs = devm_kcalloc(dev, GPIO_SIM_NUM_ATTRS, sizeof(*attrs),
> + GFP_KERNEL);
> val_attr = devm_kzalloc(dev, sizeof(*val_attr), GFP_KERNEL);
> pull_attr = devm_kzalloc(dev, sizeof(*pull_attr), GFP_KERNEL);
> if (!attr_group || !attrs || !val_attr || !pull_attr)
> --
> 2.34.1
>
Applied with an added Fixes tag.
Bart
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-05-22 20:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-20 19:21 [PATCH] gpio: sim: Use correct order for the parameters of devm_kcalloc() Christophe JAILLET
2022-05-22 20:10 ` Bartosz Golaszewski
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.