summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-ppc4xx.c
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2017-01-13 14:30:43 +0100
committerMark Brown <broonie@kernel.org>2017-01-17 18:34:25 +0000
commit797236f10a095a1742373bca5f284c5ec8afb446 (patch)
treef53c25716f83d86d0cfea7387cf22ba7373fcfff /drivers/spi/spi-ppc4xx.c
parentffcaef5ac27b62b480b94036615b3ae4f1b725fe (diff)
downloadlinux-797236f10a095a1742373bca5f284c5ec8afb446.tar.bz2
spi/ppc4xx: Use kcalloc() in spi_ppc4xx_of_probe()
* 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. * Replace the specification of a data type by a pointer dereference to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-ppc4xx.c')
-rw-r--r--drivers/spi/spi-ppc4xx.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/spi/spi-ppc4xx.c b/drivers/spi/spi-ppc4xx.c
index b2df63c66494..967d94844b30 100644
--- a/drivers/spi/spi-ppc4xx.c
+++ b/drivers/spi/spi-ppc4xx.c
@@ -411,7 +411,7 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)
if (num_gpios > 0) {
int i;
- hw->gpios = kzalloc(sizeof(int) * num_gpios, GFP_KERNEL);
+ hw->gpios = kcalloc(num_gpios, sizeof(*hw->gpios), GFP_KERNEL);
if (!hw->gpios) {
ret = -ENOMEM;
goto free_master;