diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-04 17:28:22 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-04 17:28:22 -0400 |
commit | c9946d014fe8da95257a118ba946bd4bd44a0c86 (patch) | |
tree | 5c9581b89130180861c124f65ba46808002e381c /drivers/hsi | |
parent | a897a10141ae4deb43346fbf2ae2a5149bd7fd5a (diff) | |
parent | 67ddd75771b6b860bc0cebb3b7fd4cbebeda9cd4 (diff) |
Merge tag 'hsi-for-4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi
Pull HSI updates from Sebastian Reichel:
"Misc cleanups"
* tag 'hsi-for-4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi:
HSI: core: Use kcalloc() in two functions
HSI: Use kcalloc() in hsi_register_board_info()
HSI: omap_ssi: Delete an error message for a failed memory allocation in ssi_add_controller()
HSI: omap_ssi: Fix a typo in a comment line
HSI: omap_ssi: Use devm_kcalloc() in ssi_add_controller()
HSI: nokia-modem: Add a space character for better code readability in nokia_modem_probe()
HSI: nokia-modem: Delete error messages for a failed memory allocation in two functions
HSI: nokia-modem: Use devm_kcalloc() in nokia_modem_gpio_probe()
Diffstat (limited to 'drivers/hsi')
-rw-r--r-- | drivers/hsi/clients/nokia-modem.c | 15 | ||||
-rw-r--r-- | drivers/hsi/controllers/omap_ssi_core.c | 10 | ||||
-rw-r--r-- | drivers/hsi/hsi_boardinfo.c | 2 | ||||
-rw-r--r-- | drivers/hsi/hsi_core.c | 7 |
4 files changed, 14 insertions, 20 deletions
diff --git a/drivers/hsi/clients/nokia-modem.c b/drivers/hsi/clients/nokia-modem.c index c000780d931f..f78cca98266f 100644 --- a/drivers/hsi/clients/nokia-modem.c +++ b/drivers/hsi/clients/nokia-modem.c | |||
@@ -102,12 +102,10 @@ static int nokia_modem_gpio_probe(struct device *dev) | |||
102 | return -EINVAL; | 102 | return -EINVAL; |
103 | } | 103 | } |
104 | 104 | ||
105 | modem->gpios = devm_kzalloc(dev, gpio_count * | 105 | modem->gpios = devm_kcalloc(dev, gpio_count, sizeof(*modem->gpios), |
106 | sizeof(struct nokia_modem_gpio), GFP_KERNEL); | 106 | GFP_KERNEL); |
107 | if (!modem->gpios) { | 107 | if (!modem->gpios) |
108 | dev_err(dev, "Could not allocate memory for gpios\n"); | ||
109 | return -ENOMEM; | 108 | return -ENOMEM; |
110 | } | ||
111 | 109 | ||
112 | modem->gpio_amount = gpio_count; | 110 | modem->gpio_amount = gpio_count; |
113 | 111 | ||
@@ -156,10 +154,9 @@ static int nokia_modem_probe(struct device *dev) | |||
156 | } | 154 | } |
157 | 155 | ||
158 | modem = devm_kzalloc(dev, sizeof(*modem), GFP_KERNEL); | 156 | modem = devm_kzalloc(dev, sizeof(*modem), GFP_KERNEL); |
159 | if (!modem) { | 157 | if (!modem) |
160 | dev_err(dev, "Could not allocate memory for nokia_modem_device\n"); | ||
161 | return -ENOMEM; | 158 | return -ENOMEM; |
162 | } | 159 | |
163 | dev_set_drvdata(dev, modem); | 160 | dev_set_drvdata(dev, modem); |
164 | modem->device = dev; | 161 | modem->device = dev; |
165 | 162 | ||
@@ -182,7 +179,7 @@ static int nokia_modem_probe(struct device *dev) | |||
182 | } | 179 | } |
183 | enable_irq_wake(irq); | 180 | enable_irq_wake(irq); |
184 | 181 | ||
185 | if(pm) { | 182 | if (pm) { |
186 | err = nokia_modem_gpio_probe(dev); | 183 | err = nokia_modem_gpio_probe(dev); |
187 | if (err < 0) { | 184 | if (err < 0) { |
188 | dev_err(dev, "Could not probe GPIOs\n"); | 185 | dev_err(dev, "Could not probe GPIOs\n"); |
diff --git a/drivers/hsi/controllers/omap_ssi_core.c b/drivers/hsi/controllers/omap_ssi_core.c index 9a29b34ed2c8..88e48b346916 100644 --- a/drivers/hsi/controllers/omap_ssi_core.c +++ b/drivers/hsi/controllers/omap_ssi_core.c | |||
@@ -384,10 +384,8 @@ static int ssi_add_controller(struct hsi_controller *ssi, | |||
384 | int err; | 384 | int err; |
385 | 385 | ||
386 | omap_ssi = devm_kzalloc(&ssi->device, sizeof(*omap_ssi), GFP_KERNEL); | 386 | omap_ssi = devm_kzalloc(&ssi->device, sizeof(*omap_ssi), GFP_KERNEL); |
387 | if (!omap_ssi) { | 387 | if (!omap_ssi) |
388 | dev_err(&pd->dev, "not enough memory for omap ssi\n"); | ||
389 | return -ENOMEM; | 388 | return -ENOMEM; |
390 | } | ||
391 | 389 | ||
392 | err = ida_simple_get(&platform_omap_ssi_ida, 0, 0, GFP_KERNEL); | 390 | err = ida_simple_get(&platform_omap_ssi_ida, 0, 0, GFP_KERNEL); |
393 | if (err < 0) | 391 | if (err < 0) |
@@ -421,8 +419,8 @@ static int ssi_add_controller(struct hsi_controller *ssi, | |||
421 | goto out_err; | 419 | goto out_err; |
422 | } | 420 | } |
423 | 421 | ||
424 | omap_ssi->port = devm_kzalloc(&ssi->device, | 422 | omap_ssi->port = devm_kcalloc(&ssi->device, ssi->num_ports, |
425 | sizeof(struct omap_ssi_port *) * ssi->num_ports, GFP_KERNEL); | 423 | sizeof(*omap_ssi->port), GFP_KERNEL); |
426 | if (!omap_ssi->port) { | 424 | if (!omap_ssi->port) { |
427 | err = -ENOMEM; | 425 | err = -ENOMEM; |
428 | goto out_err; | 426 | goto out_err; |
@@ -467,7 +465,7 @@ static int ssi_hw_init(struct hsi_controller *ssi) | |||
467 | dev_err(&ssi->device, "runtime PM failed %d\n", err); | 465 | dev_err(&ssi->device, "runtime PM failed %d\n", err); |
468 | return err; | 466 | return err; |
469 | } | 467 | } |
470 | /* Reseting GDD */ | 468 | /* Resetting GDD */ |
471 | writel_relaxed(SSI_SWRESET, omap_ssi->gdd + SSI_GDD_GRST_REG); | 469 | writel_relaxed(SSI_SWRESET, omap_ssi->gdd + SSI_GDD_GRST_REG); |
472 | /* Get FCK rate in KHz */ | 470 | /* Get FCK rate in KHz */ |
473 | omap_ssi->fck_rate = DIV_ROUND_CLOSEST(ssi_get_clk_rate(ssi), 1000); | 471 | omap_ssi->fck_rate = DIV_ROUND_CLOSEST(ssi_get_clk_rate(ssi), 1000); |
diff --git a/drivers/hsi/hsi_boardinfo.c b/drivers/hsi/hsi_boardinfo.c index e56bc6da5f98..e381cb4c962e 100644 --- a/drivers/hsi/hsi_boardinfo.c +++ b/drivers/hsi/hsi_boardinfo.c | |||
@@ -49,7 +49,7 @@ int __init hsi_register_board_info(struct hsi_board_info const *info, | |||
49 | { | 49 | { |
50 | struct hsi_cl_info *cl_info; | 50 | struct hsi_cl_info *cl_info; |
51 | 51 | ||
52 | cl_info = kzalloc(sizeof(*cl_info) * len, GFP_KERNEL); | 52 | cl_info = kcalloc(len, sizeof(*cl_info), GFP_KERNEL); |
53 | if (!cl_info) | 53 | if (!cl_info) |
54 | return -ENOMEM; | 54 | return -ENOMEM; |
55 | 55 | ||
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, | |||
267 | 267 | ||
268 | cl->rx_cfg.num_channels = cells; | 268 | cl->rx_cfg.num_channels = cells; |
269 | cl->tx_cfg.num_channels = cells; | 269 | cl->tx_cfg.num_channels = cells; |
270 | 270 | cl->rx_cfg.channels = kcalloc(cells, sizeof(channel), GFP_KERNEL); | |
271 | cl->rx_cfg.channels = kzalloc(cells * sizeof(channel), GFP_KERNEL); | ||
272 | if (!cl->rx_cfg.channels) { | 271 | if (!cl->rx_cfg.channels) { |
273 | err = -ENOMEM; | 272 | err = -ENOMEM; |
274 | goto err; | 273 | goto err; |
275 | } | 274 | } |
276 | 275 | ||
277 | cl->tx_cfg.channels = kzalloc(cells * sizeof(channel), GFP_KERNEL); | 276 | cl->tx_cfg.channels = kcalloc(cells, sizeof(channel), GFP_KERNEL); |
278 | if (!cl->tx_cfg.channels) { | 277 | if (!cl->tx_cfg.channels) { |
279 | err = -ENOMEM; | 278 | err = -ENOMEM; |
280 | goto err2; | 279 | goto err2; |
@@ -485,7 +484,7 @@ struct hsi_controller *hsi_alloc_controller(unsigned int n_ports, gfp_t flags) | |||
485 | hsi = kzalloc(sizeof(*hsi), flags); | 484 | hsi = kzalloc(sizeof(*hsi), flags); |
486 | if (!hsi) | 485 | if (!hsi) |
487 | return NULL; | 486 | return NULL; |
488 | port = kzalloc(sizeof(*port)*n_ports, flags); | 487 | port = kcalloc(n_ports, sizeof(*port), flags); |
489 | if (!port) { | 488 | if (!port) { |
490 | kfree(hsi); | 489 | kfree(hsi); |
491 | return NULL; | 490 | return NULL; |