]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
spi: Use kcalloc() in spi_register_board_info()
authorMarkus Elfring <elfring@users.sourceforge.net>
Fri, 13 Jan 2017 11:28:04 +0000 (12:28 +0100)
committerMark Brown <broonie@kernel.org>
Tue, 17 Jan 2017 18:21:12 +0000 (18:21 +0000)
A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus reuse the corresponding function "kcalloc".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi.c

index 656dd3e3220c5062b43b5a162a078f245f90630c..8c05f27bf6422cd20307b605af6fe19def7ba6ef 100644 (file)
@@ -672,7 +672,7 @@ int spi_register_board_info(struct spi_board_info const *info, unsigned n)
        if (!n)
                return -EINVAL;
 
-       bi = kzalloc(n * sizeof(*bi), GFP_KERNEL);
+       bi = kcalloc(n, sizeof(*bi), GFP_KERNEL);
        if (!bi)
                return -ENOMEM;