gpio: sim: Use correct order for the parameters of devm_kcalloc()

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2071835
Tested: This is one of a series of patch sets to enable Arm SystemReady IR
 support in the kernel for NXP i.MX8 platforms.  This set updates GPIO
 support.  It has been tested via simple boot tests and by using the
 kernel GPIO tools to verify pins are being identified and can be used.

commit c680c6a814a2269427fad9ac417ab16756bceae9
Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date:   Fri May 20 21:21:56 2022 +0200

    gpio: sim: Use correct order for the parameters of devm_kcalloc()

    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.

    Fixes: cb8c474e79be ("gpio: sim: new testing module")
    Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
    (cherry picked from commit c680c6a814a2269427fad9ac417ab16756bceae9)

Signed-off-by: Al Stone <ahs3@redhat.com>
This commit is contained in:
Al Stone 2022-08-24 13:28:59 -06:00
parent d3dcc2321c
commit 6cf0c1cd5e
1 changed files with 2 additions and 2 deletions

View File

@ -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)