diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2017-04-25 14:17:50 +0200 |
---|---|---|
committer | Sebastian Reichel <sre@kernel.org> | 2017-06-08 13:21:43 +0200 |
commit | 67ddd75771b6b860bc0cebb3b7fd4cbebeda9cd4 (patch) | |
tree | 470eaf9150825fe46725563342eda337651e56b8 /drivers/hsi | |
parent | de7c98eb7c6f72bbfa87afc5b7e2d3b0188a8d83 (diff) | |
download | lwn-67ddd75771b6b860bc0cebb3b7fd4cbebeda9cd4.tar.gz lwn-67ddd75771b6b860bc0cebb3b7fd4cbebeda9cd4.zip |
HSI: core: Use kcalloc() in two functions
Multiplications for the size determination of memory allocations
indicated that array data structures should be processed.
Thus use 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: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Diffstat (limited to 'drivers/hsi')
-rw-r--r-- | drivers/hsi/hsi_core.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/hsi/hsi_core.c b/drivers/hsi/hsi_core.c index c2a2a9795b0b..9065efd21851 100644 --- a/drivers/hsi/hsi_core.c +++ b/drivers/hsi/hsi_core.c @@ -267,14 +267,13 @@ static void hsi_add_client_from_dt(struct hsi_port *port, cl->rx_cfg.num_channels = cells; cl->tx_cfg.num_channels = cells; - - cl->rx_cfg.channels = kzalloc(cells * sizeof(channel), GFP_KERNEL); + cl->rx_cfg.channels = kcalloc(cells, sizeof(channel), GFP_KERNEL); if (!cl->rx_cfg.channels) { err = -ENOMEM; goto err; } - cl->tx_cfg.channels = kzalloc(cells * sizeof(channel), GFP_KERNEL); + cl->tx_cfg.channels = kcalloc(cells, sizeof(channel), GFP_KERNEL); if (!cl->tx_cfg.channels) { err = -ENOMEM; goto err2; @@ -485,7 +484,7 @@ struct hsi_controller *hsi_alloc_controller(unsigned int n_ports, gfp_t flags) hsi = kzalloc(sizeof(*hsi), flags); if (!hsi) return NULL; - port = kzalloc(sizeof(*port)*n_ports, flags); + port = kcalloc(n_ports, sizeof(*port), flags); if (!port) { kfree(hsi); return NULL; |