Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

treewide: devm_kzalloc() -> devm_kcalloc()

The devm_kzalloc() function has a 2-factor argument form, devm_kcalloc().
This patch replaces cases of:

devm_kzalloc(handle, a * b, gfp)

with:
devm_kcalloc(handle, a * b, gfp)

as well as handling cases of:

devm_kzalloc(handle, a * b * c, gfp)

with:

devm_kzalloc(handle, array3_size(a, b, c), gfp)

as it's slightly less ugly than:

devm_kcalloc(handle, array_size(a, b), c, gfp)

This does, however, attempt to ignore constant size factors like:

devm_kzalloc(handle, 4 * 1024, gfp)

though any constants defined via macros get caught up in the conversion.

Any factors with a sizeof() of "unsigned char", "char", and "u8" were
dropped, since they're redundant.

Some manual whitespace fixes were needed in this patch, as Coccinelle
really liked to write "=devm_kcalloc..." instead of "= devm_kcalloc...".

The Coccinelle script used for this was:

// Fix redundant parens around sizeof().
@@
expression HANDLE;
type TYPE;
expression THING, E;
@@

(
devm_kzalloc(HANDLE,
- (sizeof(TYPE)) * E
+ sizeof(TYPE) * E
, ...)
|
devm_kzalloc(HANDLE,
- (sizeof(THING)) * E
+ sizeof(THING) * E
, ...)
)

// Drop single-byte sizes and redundant parens.
@@
expression HANDLE;
expression COUNT;
typedef u8;
typedef __u8;
@@

(
devm_kzalloc(HANDLE,
- sizeof(u8) * (COUNT)
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(__u8) * (COUNT)
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(char) * (COUNT)
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(unsigned char) * (COUNT)
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(u8) * COUNT
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(__u8) * COUNT
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(char) * COUNT
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(unsigned char) * COUNT
+ COUNT
, ...)
)

// 2-factor product with sizeof(type/expression) and identifier or constant.
@@
expression HANDLE;
type TYPE;
expression THING;
identifier COUNT_ID;
constant COUNT_CONST;
@@

(
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * (COUNT_ID)
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * COUNT_ID
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * (COUNT_CONST)
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * COUNT_CONST
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * (COUNT_ID)
+ COUNT_ID, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * COUNT_ID
+ COUNT_ID, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * (COUNT_CONST)
+ COUNT_CONST, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * COUNT_CONST
+ COUNT_CONST, sizeof(THING)
, ...)
)

// 2-factor product, only identifiers.
@@
expression HANDLE;
identifier SIZE, COUNT;
@@

- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- SIZE * COUNT
+ COUNT, SIZE
, ...)

// 3-factor product with 1 sizeof(type) or sizeof(expression), with
// redundant parens removed.
@@
expression HANDLE;
expression THING;
identifier STRIDE, COUNT;
type TYPE;
@@

(
devm_kzalloc(HANDLE,
- sizeof(TYPE) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
)

// 3-factor product with 2 sizeof(variable), with redundant parens removed.
@@
expression HANDLE;
expression THING1, THING2;
identifier COUNT;
type TYPE1, TYPE2;
@@

(
devm_kzalloc(HANDLE,
- sizeof(TYPE1) * sizeof(TYPE2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
)

// 3-factor product, only identifiers, with redundant parens removed.
@@
expression HANDLE;
identifier STRIDE, SIZE, COUNT;
@@

(
devm_kzalloc(HANDLE,
- (COUNT) * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- COUNT * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- COUNT * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- (COUNT) * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- COUNT * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- (COUNT) * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- (COUNT) * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- COUNT * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
)

// Any remaining multi-factor products, first at least 3-factor products,
// when they're not all constants...
@@
expression HANDLE;
expression E1, E2, E3;
constant C1, C2, C3;
@@

(
devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
|
devm_kzalloc(HANDLE,
- (E1) * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
|
devm_kzalloc(HANDLE,
- (E1) * (E2) * E3
+ array3_size(E1, E2, E3)
, ...)
|
devm_kzalloc(HANDLE,
- (E1) * (E2) * (E3)
+ array3_size(E1, E2, E3)
, ...)
|
devm_kzalloc(HANDLE,
- E1 * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
)

// And then all remaining 2 factors products when they're not all constants,
// keeping sizeof() as the second factor argument.
@@
expression HANDLE;
expression THING, E1, E2;
type TYPE;
constant C1, C2, C3;
@@

(
devm_kzalloc(HANDLE, sizeof(THING) * C2, ...)
|
devm_kzalloc(HANDLE, sizeof(TYPE) * C2, ...)
|
devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
|
devm_kzalloc(HANDLE, C1 * C2, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * (E2)
+ E2, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * E2
+ E2, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * (E2)
+ E2, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * E2
+ E2, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- (E1) * E2
+ E1, E2
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- (E1) * (E2)
+ E1, E2
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- E1 * E2
+ E1, E2
, ...)
)

Signed-off-by: Kees Cook <keescook@chromium.org>

+847 -664
+2 -2
drivers/acpi/fan.c
··· 298 298 } 299 299 300 300 fan->fps_count = obj->package.count - 1; /* minus revision field */ 301 - fan->fps = devm_kzalloc(&device->dev, 302 - fan->fps_count * sizeof(struct acpi_fan_fps), 301 + fan->fps = devm_kcalloc(&device->dev, 302 + fan->fps_count, sizeof(struct acpi_fan_fps), 303 303 GFP_KERNEL); 304 304 if (!fan->fps) { 305 305 dev_err(&device->dev, "Not enough memory\n");
+4 -3
drivers/acpi/nfit/core.c
··· 1082 1082 continue; 1083 1083 nfit_mem->nfit_flush = nfit_flush; 1084 1084 flush = nfit_flush->flush; 1085 - nfit_mem->flush_wpq = devm_kzalloc(acpi_desc->dev, 1086 - flush->hint_count 1087 - * sizeof(struct resource), GFP_KERNEL); 1085 + nfit_mem->flush_wpq = devm_kcalloc(acpi_desc->dev, 1086 + flush->hint_count, 1087 + sizeof(struct resource), 1088 + GFP_KERNEL); 1088 1089 if (!nfit_mem->flush_wpq) 1089 1090 return -ENOMEM; 1090 1091 for (i = 0; i < flush->hint_count; i++) {
+4 -4
drivers/ata/sata_mv.c
··· 4114 4114 4115 4115 if (!host || !hpriv) 4116 4116 return -ENOMEM; 4117 - hpriv->port_clks = devm_kzalloc(&pdev->dev, 4118 - sizeof(struct clk *) * n_ports, 4117 + hpriv->port_clks = devm_kcalloc(&pdev->dev, 4118 + n_ports, sizeof(struct clk *), 4119 4119 GFP_KERNEL); 4120 4120 if (!hpriv->port_clks) 4121 4121 return -ENOMEM; 4122 - hpriv->port_phys = devm_kzalloc(&pdev->dev, 4123 - sizeof(struct phy *) * n_ports, 4122 + hpriv->port_phys = devm_kcalloc(&pdev->dev, 4123 + n_ports, sizeof(struct phy *), 4124 4124 GFP_KERNEL); 4125 4125 if (!hpriv->port_phys) 4126 4126 return -ENOMEM;
+3 -3
drivers/bus/fsl-mc/fsl-mc-allocator.c
··· 354 354 if (error < 0) 355 355 return error; 356 356 357 - irq_resources = devm_kzalloc(&mc_bus_dev->dev, 358 - sizeof(*irq_resources) * irq_count, 357 + irq_resources = devm_kcalloc(&mc_bus_dev->dev, 358 + irq_count, sizeof(*irq_resources), 359 359 GFP_KERNEL); 360 360 if (!irq_resources) { 361 361 error = -ENOMEM; ··· 455 455 return -ENOSPC; 456 456 } 457 457 458 - irqs = devm_kzalloc(&mc_dev->dev, irq_count * sizeof(irqs[0]), 458 + irqs = devm_kcalloc(&mc_dev->dev, irq_count, sizeof(irqs[0]), 459 459 GFP_KERNEL); 460 460 if (!irqs) 461 461 return -ENOMEM;
+1 -1
drivers/char/tpm/tpm2-cmd.c
··· 980 980 goto out; 981 981 } 982 982 983 - chip->cc_attrs_tbl = devm_kzalloc(&chip->dev, 4 * nr_commands, 983 + chip->cc_attrs_tbl = devm_kcalloc(&chip->dev, 4, nr_commands, 984 984 GFP_KERNEL); 985 985 986 986 rc = tpm_buf_init(&buf, TPM2_ST_NO_SESSIONS, TPM2_CC_GET_CAPABILITY);
+2 -2
drivers/clk/bcm/clk-bcm2835.c
··· 734 734 const struct bcm2835_pll_data *data = pll->data; 735 735 struct debugfs_reg32 *regs; 736 736 737 - regs = devm_kzalloc(cprman->dev, 7 * sizeof(*regs), GFP_KERNEL); 737 + regs = devm_kcalloc(cprman->dev, 7, sizeof(*regs), GFP_KERNEL); 738 738 if (!regs) 739 739 return; 740 740 ··· 865 865 const struct bcm2835_pll_divider_data *data = divider->data; 866 866 struct debugfs_reg32 *regs; 867 867 868 - regs = devm_kzalloc(cprman->dev, 7 * sizeof(*regs), GFP_KERNEL); 868 + regs = devm_kcalloc(cprman->dev, 7, sizeof(*regs), GFP_KERNEL); 869 869 if (!regs) 870 870 return; 871 871
+4 -2
drivers/clk/ti/adpll.c
··· 501 501 const char *postfix; 502 502 int width, err; 503 503 504 - d->outputs.clks = devm_kzalloc(d->dev, sizeof(struct clk *) * 504 + d->outputs.clks = devm_kcalloc(d->dev, 505 505 MAX_ADPLL_OUTPUTS, 506 + sizeof(struct clk *), 506 507 GFP_KERNEL); 507 508 if (!d->outputs.clks) 508 509 return -ENOMEM; ··· 916 915 if (err) 917 916 return err; 918 917 919 - d->clocks = devm_kzalloc(d->dev, sizeof(struct ti_adpll_clock) * 918 + d->clocks = devm_kcalloc(d->dev, 920 919 TI_ADPLL_NR_CLOCKS, 920 + sizeof(struct ti_adpll_clock), 921 921 GFP_KERNEL); 922 922 if (!d->clocks) 923 923 return -ENOMEM;
+1 -1
drivers/cpufreq/brcmstb-avs-cpufreq.c
··· 410 410 if (ret) 411 411 return ERR_PTR(ret); 412 412 413 - table = devm_kzalloc(dev, (AVS_PSTATE_MAX + 1) * sizeof(*table), 413 + table = devm_kcalloc(dev, AVS_PSTATE_MAX + 1, sizeof(*table), 414 414 GFP_KERNEL); 415 415 if (!table) 416 416 return ERR_PTR(-ENOMEM);
+2 -1
drivers/cpufreq/imx6q-cpufreq.c
··· 377 377 } 378 378 379 379 /* Make imx6_soc_volt array's size same as arm opp number */ 380 - imx6_soc_volt = devm_kzalloc(cpu_dev, sizeof(*imx6_soc_volt) * num, GFP_KERNEL); 380 + imx6_soc_volt = devm_kcalloc(cpu_dev, num, sizeof(*imx6_soc_volt), 381 + GFP_KERNEL); 381 382 if (imx6_soc_volt == NULL) { 382 383 ret = -ENOMEM; 383 384 goto free_freq_table;
+1 -1
drivers/crypto/marvell/cesa.c
··· 471 471 sram_size = CESA_SA_MIN_SRAM_SIZE; 472 472 473 473 cesa->sram_size = sram_size; 474 - cesa->engines = devm_kzalloc(dev, caps->nengines * sizeof(*engines), 474 + cesa->engines = devm_kcalloc(dev, caps->nengines, sizeof(*engines), 475 475 GFP_KERNEL); 476 476 if (!cesa->engines) 477 477 return -ENOMEM;
+8 -5
drivers/crypto/talitos.c
··· 3393 3393 } 3394 3394 } 3395 3395 3396 - priv->chan = devm_kzalloc(dev, sizeof(struct talitos_channel) * 3397 - priv->num_channels, GFP_KERNEL); 3396 + priv->chan = devm_kcalloc(dev, 3397 + priv->num_channels, 3398 + sizeof(struct talitos_channel), 3399 + GFP_KERNEL); 3398 3400 if (!priv->chan) { 3399 3401 dev_err(dev, "failed to allocate channel management space\n"); 3400 3402 err = -ENOMEM; ··· 3413 3411 spin_lock_init(&priv->chan[i].head_lock); 3414 3412 spin_lock_init(&priv->chan[i].tail_lock); 3415 3413 3416 - priv->chan[i].fifo = devm_kzalloc(dev, 3417 - sizeof(struct talitos_request) * 3418 - priv->fifo_len, GFP_KERNEL); 3414 + priv->chan[i].fifo = devm_kcalloc(dev, 3415 + priv->fifo_len, 3416 + sizeof(struct talitos_request), 3417 + GFP_KERNEL); 3419 3418 if (!priv->chan[i].fifo) { 3420 3419 dev_err(dev, "failed to allocate request fifo %d\n", i); 3421 3420 err = -ENOMEM;
+8 -7
drivers/devfreq/devfreq.c
··· 628 628 goto err_dev; 629 629 } 630 630 631 - devfreq->trans_table = devm_kzalloc(&devfreq->dev, 632 - sizeof(unsigned int) * 633 - devfreq->profile->max_state * 631 + devfreq->trans_table = 632 + devm_kzalloc(&devfreq->dev, 633 + array3_size(sizeof(unsigned int), 634 + devfreq->profile->max_state, 635 + devfreq->profile->max_state), 636 + GFP_KERNEL); 637 + devfreq->time_in_state = devm_kcalloc(&devfreq->dev, 634 638 devfreq->profile->max_state, 635 - GFP_KERNEL); 636 - devfreq->time_in_state = devm_kzalloc(&devfreq->dev, 637 - sizeof(unsigned long) * 638 - devfreq->profile->max_state, 639 + sizeof(unsigned long), 639 640 GFP_KERNEL); 640 641 devfreq->last_stat_updated = jiffies; 641 642
+1 -1
drivers/devfreq/event/exynos-ppmu.c
··· 518 518 event_ops = exynos_bus_get_ops(np); 519 519 520 520 count = of_get_child_count(events_np); 521 - desc = devm_kzalloc(dev, sizeof(*desc) * count, GFP_KERNEL); 521 + desc = devm_kcalloc(dev, count, sizeof(*desc), GFP_KERNEL); 522 522 if (!desc) 523 523 return -ENOMEM; 524 524 info->num_events = count;
+4 -4
drivers/dma/k3dma.c
··· 848 848 return -ENOMEM; 849 849 850 850 /* init phy channel */ 851 - d->phy = devm_kzalloc(&op->dev, 852 - d->dma_channels * sizeof(struct k3_dma_phy), GFP_KERNEL); 851 + d->phy = devm_kcalloc(&op->dev, 852 + d->dma_channels, sizeof(struct k3_dma_phy), GFP_KERNEL); 853 853 if (d->phy == NULL) 854 854 return -ENOMEM; 855 855 ··· 879 879 d->slave.copy_align = DMAENGINE_ALIGN_8_BYTES; 880 880 881 881 /* init virtual channel */ 882 - d->chans = devm_kzalloc(&op->dev, 883 - d->dma_requests * sizeof(struct k3_dma_chan), GFP_KERNEL); 882 + d->chans = devm_kcalloc(&op->dev, 883 + d->dma_requests, sizeof(struct k3_dma_chan), GFP_KERNEL); 884 884 if (d->chans == NULL) 885 885 return -ENOMEM; 886 886
+3 -2
drivers/dma/mv_xor_v2.c
··· 809 809 } 810 810 811 811 /* alloc memory for the SW descriptors */ 812 - xor_dev->sw_desq = devm_kzalloc(&pdev->dev, sizeof(*sw_desc) * 813 - MV_XOR_V2_DESC_NUM, GFP_KERNEL); 812 + xor_dev->sw_desq = devm_kcalloc(&pdev->dev, 813 + MV_XOR_V2_DESC_NUM, sizeof(*sw_desc), 814 + GFP_KERNEL); 814 815 if (!xor_dev->sw_desq) { 815 816 ret = -ENOMEM; 816 817 goto free_hw_desq;
+3 -3
drivers/dma/s3c24xx-dma.c
··· 1223 1223 if (IS_ERR(s3cdma->base)) 1224 1224 return PTR_ERR(s3cdma->base); 1225 1225 1226 - s3cdma->phy_chans = devm_kzalloc(&pdev->dev, 1227 - sizeof(struct s3c24xx_dma_phy) * 1228 - pdata->num_phy_channels, 1226 + s3cdma->phy_chans = devm_kcalloc(&pdev->dev, 1227 + pdata->num_phy_channels, 1228 + sizeof(struct s3c24xx_dma_phy), 1229 1229 GFP_KERNEL); 1230 1230 if (!s3cdma->phy_chans) 1231 1231 return -ENOMEM;
+4 -4
drivers/dma/zx_dma.c
··· 798 798 return -ENOMEM; 799 799 800 800 /* init phy channel */ 801 - d->phy = devm_kzalloc(&op->dev, 802 - d->dma_channels * sizeof(struct zx_dma_phy), GFP_KERNEL); 801 + d->phy = devm_kcalloc(&op->dev, 802 + d->dma_channels, sizeof(struct zx_dma_phy), GFP_KERNEL); 803 803 if (!d->phy) 804 804 return -ENOMEM; 805 805 ··· 834 834 d->slave.residue_granularity = DMA_RESIDUE_GRANULARITY_SEGMENT; 835 835 836 836 /* init virtual channel */ 837 - d->chans = devm_kzalloc(&op->dev, 838 - d->dma_requests * sizeof(struct zx_dma_chan), GFP_KERNEL); 837 + d->chans = devm_kcalloc(&op->dev, 838 + d->dma_requests, sizeof(struct zx_dma_chan), GFP_KERNEL); 839 839 if (!d->chans) 840 840 return -ENOMEM; 841 841
+1 -1
drivers/firmware/arm_scpi.c
··· 890 890 int i; 891 891 struct scpi_xfer *xfers; 892 892 893 - xfers = devm_kzalloc(dev, MAX_SCPI_XFERS * sizeof(*xfers), GFP_KERNEL); 893 + xfers = devm_kcalloc(dev, MAX_SCPI_XFERS, sizeof(*xfers), GFP_KERNEL); 894 894 if (!xfers) 895 895 return -ENOMEM; 896 896
+3 -3
drivers/firmware/ti_sci.c
··· 1862 1862 if (!minfo->xfer_block) 1863 1863 return -ENOMEM; 1864 1864 1865 - minfo->xfer_alloc_table = devm_kzalloc(dev, 1866 - BITS_TO_LONGS(desc->max_msgs) 1867 - * sizeof(unsigned long), 1865 + minfo->xfer_alloc_table = devm_kcalloc(dev, 1866 + BITS_TO_LONGS(desc->max_msgs), 1867 + sizeof(unsigned long), 1868 1868 GFP_KERNEL); 1869 1869 if (!minfo->xfer_alloc_table) 1870 1870 return -ENOMEM;
+1 -1
drivers/gpio/gpio-adnp.c
··· 427 427 * is chosen to match the register layout of the hardware in that 428 428 * each segment contains the corresponding bits for all interrupts. 429 429 */ 430 - adnp->irq_enable = devm_kzalloc(chip->parent, num_regs * 6, 430 + adnp->irq_enable = devm_kcalloc(chip->parent, num_regs, 6, 431 431 GFP_KERNEL); 432 432 if (!adnp->irq_enable) 433 433 return -ENOMEM;
+2 -2
drivers/gpio/gpio-aspeed.c
··· 897 897 898 898 /* Allocate a cache of the output registers */ 899 899 banks = gpio->config->nr_gpios >> 5; 900 - gpio->dcache = devm_kzalloc(&pdev->dev, 901 - sizeof(u32) * banks, GFP_KERNEL); 900 + gpio->dcache = devm_kcalloc(&pdev->dev, 901 + banks, sizeof(u32), GFP_KERNEL); 902 902 if (!gpio->dcache) 903 903 return -ENOMEM; 904 904
+4 -3
drivers/gpio/gpio-bcm-kona.c
··· 601 601 GPIO_MAX_BANK_NUM); 602 602 return -ENXIO; 603 603 } 604 - kona_gpio->banks = devm_kzalloc(dev, 605 - kona_gpio->num_bank * 606 - sizeof(*kona_gpio->banks), GFP_KERNEL); 604 + kona_gpio->banks = devm_kcalloc(dev, 605 + kona_gpio->num_bank, 606 + sizeof(*kona_gpio->banks), 607 + GFP_KERNEL); 607 608 if (!kona_gpio->banks) 608 609 return -ENOMEM; 609 610
+2 -2
drivers/gpio/gpio-davinci.c
··· 198 198 ngpio = ARCH_NR_GPIOS; 199 199 200 200 nbank = DIV_ROUND_UP(ngpio, 32); 201 - chips = devm_kzalloc(dev, 202 - nbank * sizeof(struct davinci_gpio_controller), 201 + chips = devm_kcalloc(dev, 202 + nbank, sizeof(struct davinci_gpio_controller), 203 203 GFP_KERNEL); 204 204 if (!chips) 205 205 return -ENOMEM;
+2 -2
drivers/gpio/gpio-htc-egpio.c
··· 321 321 platform_set_drvdata(pdev, ei); 322 322 323 323 ei->nchips = pdata->num_chips; 324 - ei->chip = devm_kzalloc(&pdev->dev, 325 - sizeof(struct egpio_chip) * ei->nchips, 324 + ei->chip = devm_kcalloc(&pdev->dev, 325 + ei->nchips, sizeof(struct egpio_chip), 326 326 GFP_KERNEL); 327 327 if (!ei->chip) { 328 328 ret = -ENOMEM;
+5 -4
drivers/gpio/gpio-thunderx.c
··· 504 504 txgpio->base_msi = (c >> 8) & 0xff; 505 505 } 506 506 507 - txgpio->msix_entries = devm_kzalloc(dev, 508 - sizeof(struct msix_entry) * ngpio, 507 + txgpio->msix_entries = devm_kcalloc(dev, 508 + ngpio, sizeof(struct msix_entry), 509 509 GFP_KERNEL); 510 510 if (!txgpio->msix_entries) { 511 511 err = -ENOMEM; 512 512 goto out; 513 513 } 514 514 515 - txgpio->line_entries = devm_kzalloc(dev, 516 - sizeof(struct thunderx_line) * ngpio, 515 + txgpio->line_entries = devm_kcalloc(dev, 516 + ngpio, 517 + sizeof(struct thunderx_line), 517 518 GFP_KERNEL); 518 519 if (!txgpio->line_entries) { 519 520 err = -ENOMEM;
+2 -2
drivers/gpu/drm/exynos/exynos_drm_dsi.c
··· 1723 1723 return -EPROBE_DEFER; 1724 1724 } 1725 1725 1726 - dsi->clks = devm_kzalloc(dev, 1727 - sizeof(*dsi->clks) * dsi->driver_data->num_clks, 1726 + dsi->clks = devm_kcalloc(dev, 1727 + dsi->driver_data->num_clks, sizeof(*dsi->clks), 1728 1728 GFP_KERNEL); 1729 1729 if (!dsi->clks) 1730 1730 return -ENOMEM;
+2 -1
drivers/gpu/drm/exynos/exynos_drm_fimc.c
··· 1271 1271 1272 1272 /* construct formats/limits array */ 1273 1273 num_formats = ARRAY_SIZE(fimc_formats) + ARRAY_SIZE(fimc_tiled_formats); 1274 - formats = devm_kzalloc(dev, sizeof(*formats) * num_formats, GFP_KERNEL); 1274 + formats = devm_kcalloc(dev, num_formats, sizeof(*formats), 1275 + GFP_KERNEL); 1275 1276 if (!formats) 1276 1277 return -ENOMEM; 1277 1278
+3 -2
drivers/gpu/drm/exynos/exynos_drm_gsc.c
··· 1202 1202 if (!ctx) 1203 1203 return -ENOMEM; 1204 1204 1205 - formats = devm_kzalloc(dev, sizeof(*formats) * 1206 - (ARRAY_SIZE(gsc_formats)), GFP_KERNEL); 1205 + formats = devm_kcalloc(dev, 1206 + ARRAY_SIZE(gsc_formats), sizeof(*formats), 1207 + GFP_KERNEL); 1207 1208 if (!formats) 1208 1209 return -ENOMEM; 1209 1210
+1 -1
drivers/gpu/drm/exynos/exynos_hdmi.c
··· 1692 1692 if (!count) 1693 1693 return 0; 1694 1694 1695 - clks = devm_kzalloc(dev, sizeof(*clks) * count, GFP_KERNEL); 1695 + clks = devm_kcalloc(dev, count, sizeof(*clks), GFP_KERNEL); 1696 1696 if (!clks) 1697 1697 return -ENOMEM; 1698 1698
+16 -8
drivers/gpu/drm/msm/hdmi/hdmi.c
··· 157 157 hdmi->qfprom_mmio = NULL; 158 158 } 159 159 160 - hdmi->hpd_regs = devm_kzalloc(&pdev->dev, sizeof(hdmi->hpd_regs[0]) * 161 - config->hpd_reg_cnt, GFP_KERNEL); 160 + hdmi->hpd_regs = devm_kcalloc(&pdev->dev, 161 + config->hpd_reg_cnt, 162 + sizeof(hdmi->hpd_regs[0]), 163 + GFP_KERNEL); 162 164 if (!hdmi->hpd_regs) { 163 165 ret = -ENOMEM; 164 166 goto fail; ··· 180 178 hdmi->hpd_regs[i] = reg; 181 179 } 182 180 183 - hdmi->pwr_regs = devm_kzalloc(&pdev->dev, sizeof(hdmi->pwr_regs[0]) * 184 - config->pwr_reg_cnt, GFP_KERNEL); 181 + hdmi->pwr_regs = devm_kcalloc(&pdev->dev, 182 + config->pwr_reg_cnt, 183 + sizeof(hdmi->pwr_regs[0]), 184 + GFP_KERNEL); 185 185 if (!hdmi->pwr_regs) { 186 186 ret = -ENOMEM; 187 187 goto fail; ··· 203 199 hdmi->pwr_regs[i] = reg; 204 200 } 205 201 206 - hdmi->hpd_clks = devm_kzalloc(&pdev->dev, sizeof(hdmi->hpd_clks[0]) * 207 - config->hpd_clk_cnt, GFP_KERNEL); 202 + hdmi->hpd_clks = devm_kcalloc(&pdev->dev, 203 + config->hpd_clk_cnt, 204 + sizeof(hdmi->hpd_clks[0]), 205 + GFP_KERNEL); 208 206 if (!hdmi->hpd_clks) { 209 207 ret = -ENOMEM; 210 208 goto fail; ··· 225 219 hdmi->hpd_clks[i] = clk; 226 220 } 227 221 228 - hdmi->pwr_clks = devm_kzalloc(&pdev->dev, sizeof(hdmi->pwr_clks[0]) * 229 - config->pwr_clk_cnt, GFP_KERNEL); 222 + hdmi->pwr_clks = devm_kcalloc(&pdev->dev, 223 + config->pwr_clk_cnt, 224 + sizeof(hdmi->pwr_clks[0]), 225 + GFP_KERNEL); 230 226 if (!hdmi->pwr_clks) { 231 227 ret = -ENOMEM; 232 228 goto fail;
+2 -2
drivers/gpu/drm/msm/hdmi/hdmi_phy.c
··· 21 21 struct device *dev = &phy->pdev->dev; 22 22 int i, ret; 23 23 24 - phy->regs = devm_kzalloc(dev, sizeof(phy->regs[0]) * cfg->num_regs, 24 + phy->regs = devm_kcalloc(dev, cfg->num_regs, sizeof(phy->regs[0]), 25 25 GFP_KERNEL); 26 26 if (!phy->regs) 27 27 return -ENOMEM; 28 28 29 - phy->clks = devm_kzalloc(dev, sizeof(phy->clks[0]) * cfg->num_clks, 29 + phy->clks = devm_kcalloc(dev, cfg->num_clks, sizeof(phy->clks[0]), 30 30 GFP_KERNEL); 31 31 if (!phy->clks) 32 32 return -ENOMEM;
+2 -1
drivers/hid/hid-sensor-hub.c
··· 624 624 ret = -EINVAL; 625 625 goto err_stop_hw; 626 626 } 627 - sd->hid_sensor_hub_client_devs = devm_kzalloc(&hdev->dev, dev_cnt * 627 + sd->hid_sensor_hub_client_devs = devm_kcalloc(&hdev->dev, 628 + dev_cnt, 628 629 sizeof(struct mfd_cell), 629 630 GFP_KERNEL); 630 631 if (sd->hid_sensor_hub_client_devs == NULL) {
+2 -2
drivers/hid/intel-ish-hid/ishtp-hid-client.c
··· 121 121 } 122 122 client_data->hid_dev_count = (unsigned int)*payload; 123 123 if (!client_data->hid_devices) 124 - client_data->hid_devices = devm_kzalloc( 124 + client_data->hid_devices = devm_kcalloc( 125 125 &client_data->cl_device->dev, 126 - client_data->hid_dev_count * 126 + client_data->hid_dev_count, 127 127 sizeof(struct device_info), 128 128 GFP_KERNEL); 129 129 if (!client_data->hid_devices) {
+2 -2
drivers/hid/wacom_sys.c
··· 1363 1363 if (!devres_open_group(dev, &wacom->led.groups[group_id], GFP_KERNEL)) 1364 1364 return -ENOMEM; 1365 1365 1366 - leds = devm_kzalloc(dev, sizeof(struct wacom_led) * count, GFP_KERNEL); 1366 + leds = devm_kcalloc(dev, count, sizeof(struct wacom_led), GFP_KERNEL); 1367 1367 if (!leds) { 1368 1368 error = -ENOMEM; 1369 1369 goto err; ··· 1463 1463 struct wacom_group_leds *groups; 1464 1464 int error; 1465 1465 1466 - groups = devm_kzalloc(dev, sizeof(struct wacom_group_leds) * count, 1466 + groups = devm_kcalloc(dev, count, sizeof(struct wacom_group_leds), 1467 1467 GFP_KERNEL); 1468 1468 if (!groups) 1469 1469 return -ENOMEM;
+1 -1
drivers/hwmon/aspeed-pwm-tacho.c
··· 894 894 count = of_property_count_u8_elems(child, "aspeed,fan-tach-ch"); 895 895 if (count < 1) 896 896 return -EINVAL; 897 - fan_tach_ch = devm_kzalloc(dev, sizeof(*fan_tach_ch) * count, 897 + fan_tach_ch = devm_kcalloc(dev, count, sizeof(*fan_tach_ch), 898 898 GFP_KERNEL); 899 899 if (!fan_tach_ch) 900 900 return -ENOMEM;
+4 -4
drivers/hwmon/gpio-fan.c
··· 441 441 dev_err(dev, "DT properties empty / missing"); 442 442 return -ENODEV; 443 443 } 444 - gpios = devm_kzalloc(dev, 445 - fan_data->num_gpios * sizeof(struct gpio_desc *), 444 + gpios = devm_kcalloc(dev, 445 + fan_data->num_gpios, sizeof(struct gpio_desc *), 446 446 GFP_KERNEL); 447 447 if (!gpios) 448 448 return -ENOMEM; ··· 471 471 * Speed map is in the form <RPM ctrl_val RPM ctrl_val ...> 472 472 * this needs splitting into pairs to create gpio_fan_speed structs 473 473 */ 474 - speed = devm_kzalloc(dev, 475 - fan_data->num_speed * sizeof(struct gpio_fan_speed), 474 + speed = devm_kcalloc(dev, 475 + fan_data->num_speed, sizeof(struct gpio_fan_speed), 476 476 GFP_KERNEL); 477 477 if (!speed) 478 478 return -ENOMEM;
+5 -4
drivers/hwmon/ibmpowernv.c
··· 326 326 of_node_put(opal); 327 327 328 328 for (type = 0; type < MAX_SENSOR_TYPE; type++) { 329 - sensor_groups[type].group.attrs = devm_kzalloc(&pdev->dev, 330 - sizeof(struct attribute *) * 331 - (sensor_groups[type].attr_count + 1), 329 + sensor_groups[type].group.attrs = devm_kcalloc(&pdev->dev, 330 + sensor_groups[type].attr_count + 1, 331 + sizeof(struct attribute *), 332 332 GFP_KERNEL); 333 333 if (!sensor_groups[type].group.attrs) 334 334 return -ENOMEM; ··· 409 409 int err = 0; 410 410 411 411 opal = of_find_node_by_path("/ibm,opal/sensors"); 412 - sdata = devm_kzalloc(&pdev->dev, pdata->sensors_count * sizeof(*sdata), 412 + sdata = devm_kcalloc(&pdev->dev, 413 + pdata->sensors_count, sizeof(*sdata), 413 414 GFP_KERNEL); 414 415 if (!sdata) { 415 416 err = -ENOMEM;
+2 -2
drivers/hwmon/iio_hwmon.c
··· 92 92 while (st->channels[st->num_channels].indio_dev) 93 93 st->num_channels++; 94 94 95 - st->attrs = devm_kzalloc(dev, 96 - sizeof(*st->attrs) * (st->num_channels + 1), 95 + st->attrs = devm_kcalloc(dev, 96 + st->num_channels + 1, sizeof(*st->attrs), 97 97 GFP_KERNEL); 98 98 if (st->attrs == NULL) { 99 99 ret = -ENOMEM;
+2 -2
drivers/hwmon/nct6683.c
··· 426 426 if (group == NULL) 427 427 return ERR_PTR(-ENOMEM); 428 428 429 - attrs = devm_kzalloc(dev, sizeof(*attrs) * (repeat * count + 1), 429 + attrs = devm_kcalloc(dev, repeat * count + 1, sizeof(*attrs), 430 430 GFP_KERNEL); 431 431 if (attrs == NULL) 432 432 return ERR_PTR(-ENOMEM); 433 433 434 - su = devm_kzalloc(dev, sizeof(*su) * repeat * count, 434 + su = devm_kzalloc(dev, array3_size(repeat, count, sizeof(*su)), 435 435 GFP_KERNEL); 436 436 if (su == NULL) 437 437 return ERR_PTR(-ENOMEM);
+2 -2
drivers/hwmon/nct6775.c
··· 1190 1190 if (group == NULL) 1191 1191 return ERR_PTR(-ENOMEM); 1192 1192 1193 - attrs = devm_kzalloc(dev, sizeof(*attrs) * (repeat * count + 1), 1193 + attrs = devm_kcalloc(dev, repeat * count + 1, sizeof(*attrs), 1194 1194 GFP_KERNEL); 1195 1195 if (attrs == NULL) 1196 1196 return ERR_PTR(-ENOMEM); 1197 1197 1198 - su = devm_kzalloc(dev, sizeof(*su) * repeat * count, 1198 + su = devm_kzalloc(dev, array3_size(repeat, count, sizeof(*su)), 1199 1199 GFP_KERNEL); 1200 1200 if (su == NULL) 1201 1201 return ERR_PTR(-ENOMEM);
+2 -2
drivers/hwmon/pmbus/pmbus_core.c
··· 2176 2176 } 2177 2177 2178 2178 /* Allocate the max possible entries we need. */ 2179 - entries = devm_kzalloc(data->dev, 2180 - sizeof(*entries) * (data->info->pages * 10), 2179 + entries = devm_kcalloc(data->dev, 2180 + data->info->pages * 10, sizeof(*entries), 2181 2181 GFP_KERNEL); 2182 2182 if (!entries) 2183 2183 return -ENOMEM;
+2 -2
drivers/hwmon/pmbus/ucd9000.c
··· 454 454 */ 455 455 if (mid->driver_data == ucd9090 || mid->driver_data == ucd90160 || 456 456 mid->driver_data == ucd90910) { 457 - entries = devm_kzalloc(&client->dev, 458 - sizeof(*entries) * UCD9000_GPI_COUNT, 457 + entries = devm_kcalloc(&client->dev, 458 + UCD9000_GPI_COUNT, sizeof(*entries), 459 459 GFP_KERNEL); 460 460 if (!entries) 461 461 return -ENOMEM;
+1 -1
drivers/hwmon/pwm-fan.c
··· 180 180 } 181 181 182 182 num = ret; 183 - ctx->pwm_fan_cooling_levels = devm_kzalloc(dev, num * sizeof(u32), 183 + ctx->pwm_fan_cooling_levels = devm_kcalloc(dev, num, sizeof(u32), 184 184 GFP_KERNEL); 185 185 if (!ctx->pwm_fan_cooling_levels) 186 186 return -ENOMEM;
+2 -2
drivers/hwtracing/coresight/coresight-etb10.c
··· 683 683 if (drvdata->buffer_depth & 0x80000000) 684 684 return -EINVAL; 685 685 686 - drvdata->buf = devm_kzalloc(dev, 687 - drvdata->buffer_depth * 4, GFP_KERNEL); 686 + drvdata->buf = devm_kcalloc(dev, 687 + drvdata->buffer_depth, 4, GFP_KERNEL); 688 688 if (!drvdata->buf) 689 689 return -ENOMEM; 690 690
+6 -3
drivers/hwtracing/coresight/of_coresight.c
··· 71 71 struct coresight_platform_data *pdata) 72 72 { 73 73 /* List of output port on this component */ 74 - pdata->outports = devm_kzalloc(dev, pdata->nr_outport * 74 + pdata->outports = devm_kcalloc(dev, 75 + pdata->nr_outport, 75 76 sizeof(*pdata->outports), 76 77 GFP_KERNEL); 77 78 if (!pdata->outports) 78 79 return -ENOMEM; 79 80 80 81 /* Children connected to this component via @outports */ 81 - pdata->child_names = devm_kzalloc(dev, pdata->nr_outport * 82 + pdata->child_names = devm_kcalloc(dev, 83 + pdata->nr_outport, 82 84 sizeof(*pdata->child_names), 83 85 GFP_KERNEL); 84 86 if (!pdata->child_names) 85 87 return -ENOMEM; 86 88 87 89 /* Port number on the child this component is connected to */ 88 - pdata->child_ports = devm_kzalloc(dev, pdata->nr_outport * 90 + pdata->child_ports = devm_kcalloc(dev, 91 + pdata->nr_outport, 89 92 sizeof(*pdata->child_ports), 90 93 GFP_KERNEL); 91 94 if (!pdata->child_ports)
+4 -4
drivers/i2c/busses/i2c-qup.c
··· 1691 1691 1692 1692 qup->max_xfer_sg_len = (MX_BLOCKS << 1); 1693 1693 blocks = (MX_DMA_BLOCKS << 1) + 1; 1694 - qup->btx.sg = devm_kzalloc(&pdev->dev, 1695 - sizeof(*qup->btx.sg) * blocks, 1694 + qup->btx.sg = devm_kcalloc(&pdev->dev, 1695 + blocks, sizeof(*qup->btx.sg), 1696 1696 GFP_KERNEL); 1697 1697 if (!qup->btx.sg) { 1698 1698 ret = -ENOMEM; ··· 1700 1700 } 1701 1701 sg_init_table(qup->btx.sg, blocks); 1702 1702 1703 - qup->brx.sg = devm_kzalloc(&pdev->dev, 1704 - sizeof(*qup->brx.sg) * blocks, 1703 + qup->brx.sg = devm_kcalloc(&pdev->dev, 1704 + blocks, sizeof(*qup->brx.sg), 1705 1705 GFP_KERNEL); 1706 1706 if (!qup->brx.sg) { 1707 1707 ret = -ENOMEM;
+5 -4
drivers/i2c/muxes/i2c-mux-gpio.c
··· 88 88 89 89 mux->data.n_values = of_get_child_count(np); 90 90 91 - values = devm_kzalloc(&pdev->dev, 92 - sizeof(*mux->data.values) * mux->data.n_values, 91 + values = devm_kcalloc(&pdev->dev, 92 + mux->data.n_values, sizeof(*mux->data.values), 93 93 GFP_KERNEL); 94 94 if (!values) { 95 95 dev_err(&pdev->dev, "Cannot allocate values array"); ··· 111 111 return -EINVAL; 112 112 } 113 113 114 - gpios = devm_kzalloc(&pdev->dev, 115 - sizeof(*mux->data.gpios) * mux->data.n_gpios, GFP_KERNEL); 114 + gpios = devm_kcalloc(&pdev->dev, 115 + mux->data.n_gpios, sizeof(*mux->data.gpios), 116 + GFP_KERNEL); 116 117 if (!gpios) { 117 118 dev_err(&pdev->dev, "Cannot allocate gpios array"); 118 119 return -ENOMEM;
+2 -2
drivers/i2c/muxes/i2c-mux-reg.c
··· 124 124 } 125 125 mux->data.write_only = of_property_read_bool(np, "write-only"); 126 126 127 - values = devm_kzalloc(&pdev->dev, 128 - sizeof(*mux->data.values) * mux->data.n_values, 127 + values = devm_kcalloc(&pdev->dev, 128 + mux->data.n_values, sizeof(*mux->data.values), 129 129 GFP_KERNEL); 130 130 if (!values) { 131 131 dev_err(&pdev->dev, "Cannot allocate values array");
+4 -3
drivers/iio/adc/at91_adc.c
··· 624 624 struct at91_adc_state *st = iio_priv(idev); 625 625 int i, ret; 626 626 627 - st->trig = devm_kzalloc(&idev->dev, 628 - st->trigger_number * sizeof(*st->trig), 627 + st->trig = devm_kcalloc(&idev->dev, 628 + st->trigger_number, sizeof(*st->trig), 629 629 GFP_KERNEL); 630 630 631 631 if (st->trig == NULL) { ··· 908 908 st->registers = &st->caps->registers; 909 909 st->num_channels = st->caps->num_channels; 910 910 st->trigger_number = of_get_child_count(node); 911 - st->trigger_list = devm_kzalloc(&idev->dev, st->trigger_number * 911 + st->trigger_list = devm_kcalloc(&idev->dev, 912 + st->trigger_number, 912 913 sizeof(struct at91_adc_trigger), 913 914 GFP_KERNEL); 914 915 if (!st->trigger_list) {
+4 -2
drivers/iio/adc/max1363.c
··· 1453 1453 int i; 1454 1454 1455 1455 masks = devm_kzalloc(&indio_dev->dev, 1456 - BITS_TO_LONGS(MAX1363_MAX_CHANNELS) * sizeof(long) * 1457 - (st->chip_info->num_modes + 1), GFP_KERNEL); 1456 + array3_size(BITS_TO_LONGS(MAX1363_MAX_CHANNELS), 1457 + sizeof(long), 1458 + st->chip_info->num_modes + 1), 1459 + GFP_KERNEL); 1458 1460 if (!masks) 1459 1461 return -ENOMEM; 1460 1462
+4 -3
drivers/iio/adc/twl6030-gpadc.c
··· 898 898 899 899 gpadc = iio_priv(indio_dev); 900 900 901 - gpadc->twl6030_cal_tbl = devm_kzalloc(dev, 902 - sizeof(*gpadc->twl6030_cal_tbl) * 903 - pdata->nchannels, GFP_KERNEL); 901 + gpadc->twl6030_cal_tbl = devm_kcalloc(dev, 902 + pdata->nchannels, 903 + sizeof(*gpadc->twl6030_cal_tbl), 904 + GFP_KERNEL); 904 905 if (!gpadc->twl6030_cal_tbl) 905 906 return -ENOMEM; 906 907
+3 -2
drivers/iio/dac/ad5592r-base.c
··· 536 536 st->channel_offstate[reg] = tmp; 537 537 } 538 538 539 - channels = devm_kzalloc(st->dev, 540 - (1 + 2 * num_channels) * sizeof(*channels), GFP_KERNEL); 539 + channels = devm_kcalloc(st->dev, 540 + 1 + 2 * num_channels, sizeof(*channels), 541 + GFP_KERNEL); 541 542 if (!channels) 542 543 return -ENOMEM; 543 544
+4 -3
drivers/iio/multiplexer/iio-mux.c
··· 281 281 if (!page) 282 282 return -ENOMEM; 283 283 } 284 - child->ext_info_cache = devm_kzalloc(dev, 285 - sizeof(*child->ext_info_cache) * 286 - num_ext_info, GFP_KERNEL); 284 + child->ext_info_cache = devm_kcalloc(dev, 285 + num_ext_info, 286 + sizeof(*child->ext_info_cache), 287 + GFP_KERNEL); 287 288 if (!child->ext_info_cache) 288 289 return -ENOMEM; 289 290
+2 -2
drivers/input/keyboard/clps711x-keypad.c
··· 109 109 if (priv->row_count < 1) 110 110 return -EINVAL; 111 111 112 - priv->gpio_data = devm_kzalloc(dev, 113 - sizeof(*priv->gpio_data) * priv->row_count, 112 + priv->gpio_data = devm_kcalloc(dev, 113 + priv->row_count, sizeof(*priv->gpio_data), 114 114 GFP_KERNEL); 115 115 if (!priv->gpio_data) 116 116 return -ENOMEM;
+3 -3
drivers/input/keyboard/matrix_keypad.c
··· 443 443 of_property_read_u32(np, "col-scan-delay-us", 444 444 &pdata->col_scan_delay_us); 445 445 446 - gpios = devm_kzalloc(dev, 447 - sizeof(unsigned int) * 448 - (pdata->num_row_gpios + pdata->num_col_gpios), 446 + gpios = devm_kcalloc(dev, 447 + pdata->num_row_gpios + pdata->num_col_gpios, 448 + sizeof(unsigned int), 449 449 GFP_KERNEL); 450 450 if (!gpios) { 451 451 dev_err(dev, "could not allocate memory for gpios\n");
+1 -1
drivers/input/keyboard/samsung-keypad.c
··· 281 281 282 282 key_count = of_get_child_count(np); 283 283 keymap_data->keymap_size = key_count; 284 - keymap = devm_kzalloc(dev, sizeof(uint32_t) * key_count, GFP_KERNEL); 284 + keymap = devm_kcalloc(dev, key_count, sizeof(uint32_t), GFP_KERNEL); 285 285 if (!keymap) { 286 286 dev_err(dev, "could not allocate memory for keymap\n"); 287 287 return ERR_PTR(-ENOMEM);
+2 -2
drivers/input/matrix-keymap.c
··· 170 170 return -EINVAL; 171 171 172 172 if (!keymap) { 173 - keymap = devm_kzalloc(input_dev->dev.parent, 174 - max_keys * sizeof(*keymap), 173 + keymap = devm_kcalloc(input_dev->dev.parent, 174 + max_keys, sizeof(*keymap), 175 175 GFP_KERNEL); 176 176 if (!keymap) { 177 177 dev_err(input_dev->dev.parent,
+2 -2
drivers/input/misc/rotary_encoder.c
··· 283 283 } 284 284 285 285 encoder->irq = 286 - devm_kzalloc(dev, 287 - sizeof(*encoder->irq) * encoder->gpios->ndescs, 286 + devm_kcalloc(dev, 287 + encoder->gpios->ndescs, sizeof(*encoder->irq), 288 288 GFP_KERNEL); 289 289 if (!encoder->irq) 290 290 return -ENOMEM;
+5 -4
drivers/input/rmi4/rmi_driver.c
··· 636 636 rdesc->num_registers = bitmap_weight(rdesc->presense_map, 637 637 RMI_REG_DESC_PRESENSE_BITS); 638 638 639 - rdesc->registers = devm_kzalloc(&d->dev, rdesc->num_registers * 640 - sizeof(struct rmi_register_desc_item), 641 - GFP_KERNEL); 639 + rdesc->registers = devm_kcalloc(&d->dev, 640 + rdesc->num_registers, 641 + sizeof(struct rmi_register_desc_item), 642 + GFP_KERNEL); 642 643 if (!rdesc->registers) 643 644 return -ENOMEM; 644 645 ··· 1062 1061 data->num_of_irq_regs = (data->irq_count + 7) / 8; 1063 1062 1064 1063 size = BITS_TO_LONGS(data->irq_count) * sizeof(unsigned long); 1065 - data->irq_memory = devm_kzalloc(dev, size * 4, GFP_KERNEL); 1064 + data->irq_memory = devm_kcalloc(dev, size, 4, GFP_KERNEL); 1066 1065 if (!data->irq_memory) { 1067 1066 dev_err(dev, "Failed to allocate memory for irq masks.\n"); 1068 1067 return -ENOMEM;
+8 -7
drivers/input/rmi4/rmi_f11.c
··· 1190 1190 f11->sensor.attn_size += f11->sensor.nbr_fingers * 2; 1191 1191 1192 1192 /* allocate the in-kernel tracking buffers */ 1193 - sensor->tracking_pos = devm_kzalloc(&fn->dev, 1194 - sizeof(struct input_mt_pos) * sensor->nbr_fingers, 1193 + sensor->tracking_pos = devm_kcalloc(&fn->dev, 1194 + sensor->nbr_fingers, sizeof(struct input_mt_pos), 1195 1195 GFP_KERNEL); 1196 - sensor->tracking_slots = devm_kzalloc(&fn->dev, 1197 - sizeof(int) * sensor->nbr_fingers, GFP_KERNEL); 1198 - sensor->objs = devm_kzalloc(&fn->dev, 1199 - sizeof(struct rmi_2d_sensor_abs_object) 1200 - * sensor->nbr_fingers, GFP_KERNEL); 1196 + sensor->tracking_slots = devm_kcalloc(&fn->dev, 1197 + sensor->nbr_fingers, sizeof(int), GFP_KERNEL); 1198 + sensor->objs = devm_kcalloc(&fn->dev, 1199 + sensor->nbr_fingers, 1200 + sizeof(struct rmi_2d_sensor_abs_object), 1201 + GFP_KERNEL); 1201 1202 if (!sensor->tracking_pos || !sensor->tracking_slots || !sensor->objs) 1202 1203 return -ENOMEM; 1203 1204
+8 -7
drivers/input/rmi4/rmi_f12.c
··· 502 502 } 503 503 504 504 /* allocate the in-kernel tracking buffers */ 505 - sensor->tracking_pos = devm_kzalloc(&fn->dev, 506 - sizeof(struct input_mt_pos) * sensor->nbr_fingers, 505 + sensor->tracking_pos = devm_kcalloc(&fn->dev, 506 + sensor->nbr_fingers, sizeof(struct input_mt_pos), 507 507 GFP_KERNEL); 508 - sensor->tracking_slots = devm_kzalloc(&fn->dev, 509 - sizeof(int) * sensor->nbr_fingers, GFP_KERNEL); 510 - sensor->objs = devm_kzalloc(&fn->dev, 511 - sizeof(struct rmi_2d_sensor_abs_object) 512 - * sensor->nbr_fingers, GFP_KERNEL); 508 + sensor->tracking_slots = devm_kcalloc(&fn->dev, 509 + sensor->nbr_fingers, sizeof(int), GFP_KERNEL); 510 + sensor->objs = devm_kcalloc(&fn->dev, 511 + sensor->nbr_fingers, 512 + sizeof(struct rmi_2d_sensor_abs_object), 513 + GFP_KERNEL); 513 514 if (!sensor->tracking_pos || !sensor->tracking_slots || !sensor->objs) 514 515 return -ENOMEM; 515 516
+1 -1
drivers/input/rmi4/rmi_f54.c
··· 685 685 rx = f54->num_rx_electrodes; 686 686 tx = f54->num_tx_electrodes; 687 687 f54->report_data = devm_kzalloc(&fn->dev, 688 - sizeof(u16) * tx * rx, 688 + array3_size(tx, rx, sizeof(u16)), 689 689 GFP_KERNEL); 690 690 if (f54->report_data == NULL) 691 691 return -ENOMEM;
+5 -4
drivers/input/rmi4/rmi_spi.c
··· 69 69 buf_size = RMI_SPI_XFER_SIZE_LIMIT; 70 70 71 71 tmp = rmi_spi->rx_buf; 72 - buf = devm_kzalloc(&spi->dev, buf_size * 2, 72 + buf = devm_kcalloc(&spi->dev, buf_size, 2, 73 73 GFP_KERNEL | GFP_DMA); 74 74 if (!buf) 75 75 return -ENOMEM; ··· 96 96 * per byte delays. 97 97 */ 98 98 tmp = rmi_spi->rx_xfers; 99 - xfer_buf = devm_kzalloc(&spi->dev, 100 - (rmi_spi->rx_xfer_count + rmi_spi->tx_xfer_count) 101 - * sizeof(struct spi_transfer), GFP_KERNEL); 99 + xfer_buf = devm_kcalloc(&spi->dev, 100 + rmi_spi->rx_xfer_count + rmi_spi->tx_xfer_count, 101 + sizeof(struct spi_transfer), 102 + GFP_KERNEL); 102 103 if (!xfer_buf) 103 104 return -ENOMEM; 104 105
+1 -1
drivers/iommu/arm-smmu.c
··· 2082 2082 return -ENODEV; 2083 2083 } 2084 2084 2085 - smmu->irqs = devm_kzalloc(dev, sizeof(*smmu->irqs) * num_irqs, 2085 + smmu->irqs = devm_kcalloc(dev, num_irqs, sizeof(*smmu->irqs), 2086 2086 GFP_KERNEL); 2087 2087 if (!smmu->irqs) { 2088 2088 dev_err(dev, "failed to allocate %d irqs\n", num_irqs);
+1 -1
drivers/iommu/rockchip-iommu.c
··· 1135 1135 iommu->dev = dev; 1136 1136 iommu->num_mmu = 0; 1137 1137 1138 - iommu->bases = devm_kzalloc(dev, sizeof(*iommu->bases) * num_res, 1138 + iommu->bases = devm_kcalloc(dev, num_res, sizeof(*iommu->bases), 1139 1139 GFP_KERNEL); 1140 1140 if (!iommu->bases) 1141 1141 return -ENOMEM;
+1 -1
drivers/irqchip/irq-imgpdc.c
··· 354 354 priv->nr_syswakes = val; 355 355 356 356 /* Get peripheral IRQ numbers */ 357 - priv->perip_irqs = devm_kzalloc(&pdev->dev, 4 * priv->nr_perips, 357 + priv->perip_irqs = devm_kcalloc(&pdev->dev, 4, priv->nr_perips, 358 358 GFP_KERNEL); 359 359 if (!priv->perip_irqs) { 360 360 dev_err(&pdev->dev, "cannot allocate perip IRQ list\n");
+4 -4
drivers/irqchip/irq-mvebu-gicp.c
··· 191 191 gicp->spi_ranges_cnt = ret / 2; 192 192 193 193 gicp->spi_ranges = 194 - devm_kzalloc(&pdev->dev, 195 - gicp->spi_ranges_cnt * 194 + devm_kcalloc(&pdev->dev, 195 + gicp->spi_ranges_cnt, 196 196 sizeof(struct mvebu_gicp_spi_range), 197 197 GFP_KERNEL); 198 198 if (!gicp->spi_ranges) ··· 210 210 gicp->spi_cnt += gicp->spi_ranges[i].count; 211 211 } 212 212 213 - gicp->spi_bitmap = devm_kzalloc(&pdev->dev, 214 - BITS_TO_LONGS(gicp->spi_cnt) * sizeof(long), 213 + gicp->spi_bitmap = devm_kcalloc(&pdev->dev, 214 + BITS_TO_LONGS(gicp->spi_cnt), sizeof(long), 215 215 GFP_KERNEL); 216 216 if (!gicp->spi_bitmap) 217 217 return -ENOMEM;
+1 -1
drivers/leds/leds-adp5520.c
··· 108 108 return -EFAULT; 109 109 } 110 110 111 - led = devm_kzalloc(&pdev->dev, sizeof(*led) * pdata->num_leds, 111 + led = devm_kcalloc(&pdev->dev, pdata->num_leds, sizeof(*led), 112 112 GFP_KERNEL); 113 113 if (!led) 114 114 return -ENOMEM;
+2 -2
drivers/leds/leds-apu.c
··· 171 171 int i; 172 172 int err; 173 173 174 - apu_led->pled = devm_kzalloc(dev, 175 - sizeof(struct apu_led_priv) * apu_led->num_led_instances, 174 + apu_led->pled = devm_kcalloc(dev, 175 + apu_led->num_led_instances, sizeof(struct apu_led_priv), 176 176 GFP_KERNEL); 177 177 178 178 if (!apu_led->pled)
+2 -2
drivers/leds/leds-da9052.c
··· 113 113 goto err; 114 114 } 115 115 116 - led = devm_kzalloc(&pdev->dev, 117 - sizeof(struct da9052_led) * pled->num_leds, 116 + led = devm_kcalloc(&pdev->dev, 117 + pled->num_leds, sizeof(struct da9052_led), 118 118 GFP_KERNEL); 119 119 if (!led) { 120 120 error = -ENOMEM;
+2 -2
drivers/leds/leds-lp5521.c
··· 533 533 if (!chip) 534 534 return -ENOMEM; 535 535 536 - led = devm_kzalloc(&client->dev, 537 - sizeof(*led) * pdata->num_channels, GFP_KERNEL); 536 + led = devm_kcalloc(&client->dev, 537 + pdata->num_channels, sizeof(*led), GFP_KERNEL); 538 538 if (!led) 539 539 return -ENOMEM; 540 540
+2 -2
drivers/leds/leds-lp5523.c
··· 898 898 if (!chip) 899 899 return -ENOMEM; 900 900 901 - led = devm_kzalloc(&client->dev, 902 - sizeof(*led) * pdata->num_channels, GFP_KERNEL); 901 + led = devm_kcalloc(&client->dev, 902 + pdata->num_channels, sizeof(*led), GFP_KERNEL); 903 903 if (!led) 904 904 return -ENOMEM; 905 905
+2 -2
drivers/leds/leds-lp5562.c
··· 534 534 if (!chip) 535 535 return -ENOMEM; 536 536 537 - led = devm_kzalloc(&client->dev, 538 - sizeof(*led) * pdata->num_channels, GFP_KERNEL); 537 + led = devm_kcalloc(&client->dev, 538 + pdata->num_channels, sizeof(*led), GFP_KERNEL); 539 539 if (!led) 540 540 return -ENOMEM; 541 541
+1 -1
drivers/leds/leds-lp55xx-common.c
··· 560 560 return ERR_PTR(-EINVAL); 561 561 } 562 562 563 - cfg = devm_kzalloc(dev, sizeof(*cfg) * num_channels, GFP_KERNEL); 563 + cfg = devm_kcalloc(dev, num_channels, sizeof(*cfg), GFP_KERNEL); 564 564 if (!cfg) 565 565 return ERR_PTR(-ENOMEM); 566 566
+2 -2
drivers/leds/leds-lp8501.c
··· 327 327 if (!chip) 328 328 return -ENOMEM; 329 329 330 - led = devm_kzalloc(&client->dev, 331 - sizeof(*led) * pdata->num_channels, GFP_KERNEL); 330 + led = devm_kcalloc(&client->dev, 331 + pdata->num_channels, sizeof(*led), GFP_KERNEL); 332 332 if (!led) 333 333 return -ENOMEM; 334 334
+2 -2
drivers/leds/leds-lt3593.c
··· 128 128 if (!pdata) 129 129 return -EBUSY; 130 130 131 - leds_data = devm_kzalloc(&pdev->dev, 132 - sizeof(struct lt3593_led_data) * pdata->num_leds, 131 + leds_data = devm_kcalloc(&pdev->dev, 132 + pdata->num_leds, sizeof(struct lt3593_led_data), 133 133 GFP_KERNEL); 134 134 if (!leds_data) 135 135 return -ENOMEM;
+2 -2
drivers/leds/leds-mc13783.c
··· 136 136 137 137 pdata->num_leds = of_get_child_count(parent); 138 138 139 - pdata->led = devm_kzalloc(dev, pdata->num_leds * sizeof(*pdata->led), 139 + pdata->led = devm_kcalloc(dev, pdata->num_leds, sizeof(*pdata->led), 140 140 GFP_KERNEL); 141 141 if (!pdata->led) { 142 142 ret = -ENOMEM; ··· 210 210 return -EINVAL; 211 211 } 212 212 213 - leds->led = devm_kzalloc(dev, leds->num_leds * sizeof(*leds->led), 213 + leds->led = devm_kcalloc(dev, leds->num_leds, sizeof(*leds->led), 214 214 GFP_KERNEL); 215 215 if (!leds->led) 216 216 return -ENOMEM;
+4 -2
drivers/leds/leds-mlxcpld.c
··· 329 329 int i; 330 330 int err; 331 331 332 - cpld->pled = devm_kzalloc(dev, sizeof(struct mlxcpld_led_priv) * 333 - cpld->num_led_instances, GFP_KERNEL); 332 + cpld->pled = devm_kcalloc(dev, 333 + cpld->num_led_instances, 334 + sizeof(struct mlxcpld_led_priv), 335 + GFP_KERNEL); 334 336 if (!cpld->pled) 335 337 return -ENOMEM; 336 338
+8 -8
drivers/leds/leds-netxbig.c
··· 335 335 return ret; 336 336 } 337 337 num_addr = ret; 338 - addr = devm_kzalloc(dev, num_addr * sizeof(*addr), GFP_KERNEL); 338 + addr = devm_kcalloc(dev, num_addr, sizeof(*addr), GFP_KERNEL); 339 339 if (!addr) 340 340 return -ENOMEM; 341 341 ··· 355 355 return ret; 356 356 } 357 357 num_data = ret; 358 - data = devm_kzalloc(dev, num_data * sizeof(*data), GFP_KERNEL); 358 + data = devm_kcalloc(dev, num_data, sizeof(*data), GFP_KERNEL); 359 359 if (!data) 360 360 return -ENOMEM; 361 361 ··· 415 415 if (ret % 3) 416 416 return -EINVAL; 417 417 num_timers = ret / 3; 418 - timers = devm_kzalloc(dev, num_timers * sizeof(*timers), 418 + timers = devm_kcalloc(dev, num_timers, sizeof(*timers), 419 419 GFP_KERNEL); 420 420 if (!timers) 421 421 return -ENOMEM; ··· 444 444 return -ENODEV; 445 445 } 446 446 447 - leds = devm_kzalloc(dev, num_leds * sizeof(*leds), GFP_KERNEL); 447 + leds = devm_kcalloc(dev, num_leds, sizeof(*leds), GFP_KERNEL); 448 448 if (!leds) 449 449 return -ENOMEM; 450 450 ··· 470 470 goto err_node_put; 471 471 472 472 mode_val = 473 - devm_kzalloc(dev, 474 - NETXBIG_LED_MODE_NUM * sizeof(*mode_val), 473 + devm_kcalloc(dev, 474 + NETXBIG_LED_MODE_NUM, sizeof(*mode_val), 475 475 GFP_KERNEL); 476 476 if (!mode_val) { 477 477 ret = -ENOMEM; ··· 560 560 return ret; 561 561 } 562 562 563 - leds_data = devm_kzalloc(&pdev->dev, 564 - pdata->num_leds * sizeof(*leds_data), 563 + leds_data = devm_kcalloc(&pdev->dev, 564 + pdata->num_leds, sizeof(*leds_data), 565 565 GFP_KERNEL); 566 566 if (!leds_data) 567 567 return -ENOMEM;
+4 -3
drivers/leds/leds-ns2.c
··· 264 264 if (!num_leds) 265 265 return -ENODEV; 266 266 267 - leds = devm_kzalloc(dev, num_leds * sizeof(struct ns2_led), 267 + leds = devm_kcalloc(dev, num_leds, sizeof(struct ns2_led), 268 268 GFP_KERNEL); 269 269 if (!leds) 270 270 return -ENOMEM; ··· 298 298 } 299 299 300 300 num_modes = ret / 3; 301 - modval = devm_kzalloc(dev, 302 - num_modes * sizeof(struct ns2_led_modval), 301 + modval = devm_kcalloc(dev, 302 + num_modes, 303 + sizeof(struct ns2_led_modval), 303 304 GFP_KERNEL); 304 305 if (!modval) 305 306 return -ENOMEM;
+4 -4
drivers/leds/leds-pca955x.c
··· 390 390 if (!pdata) 391 391 return ERR_PTR(-ENOMEM); 392 392 393 - pdata->leds = devm_kzalloc(&client->dev, 394 - sizeof(struct pca955x_led) * chip->bits, 393 + pdata->leds = devm_kcalloc(&client->dev, 394 + chip->bits, sizeof(struct pca955x_led), 395 395 GFP_KERNEL); 396 396 if (!pdata->leds) 397 397 return ERR_PTR(-ENOMEM); ··· 494 494 if (!pca955x) 495 495 return -ENOMEM; 496 496 497 - pca955x->leds = devm_kzalloc(&client->dev, 498 - sizeof(*pca955x_led) * chip->bits, GFP_KERNEL); 497 + pca955x->leds = devm_kcalloc(&client->dev, 498 + chip->bits, sizeof(*pca955x_led), GFP_KERNEL); 499 499 if (!pca955x->leds) 500 500 return -ENOMEM; 501 501
+3 -3
drivers/leds/leds-pca963x.c
··· 300 300 if (!count || count > chip->n_leds) 301 301 return ERR_PTR(-ENODEV); 302 302 303 - pca963x_leds = devm_kzalloc(&client->dev, 304 - sizeof(struct led_info) * chip->n_leds, GFP_KERNEL); 303 + pca963x_leds = devm_kcalloc(&client->dev, 304 + chip->n_leds, sizeof(struct led_info), GFP_KERNEL); 305 305 if (!pca963x_leds) 306 306 return ERR_PTR(-ENOMEM); 307 307 ··· 407 407 GFP_KERNEL); 408 408 if (!pca963x_chip) 409 409 return -ENOMEM; 410 - pca963x = devm_kzalloc(&client->dev, chip->n_leds * sizeof(*pca963x), 410 + pca963x = devm_kcalloc(&client->dev, chip->n_leds, sizeof(*pca963x), 411 411 GFP_KERNEL); 412 412 if (!pca963x) 413 413 return -ENOMEM;
+2 -2
drivers/leds/leds-tca6507.c
··· 697 697 if (!count || count > NUM_LEDS) 698 698 return ERR_PTR(-ENODEV); 699 699 700 - tca_leds = devm_kzalloc(&client->dev, 701 - sizeof(struct led_info) * NUM_LEDS, GFP_KERNEL); 700 + tca_leds = devm_kcalloc(&client->dev, 701 + NUM_LEDS, sizeof(struct led_info), GFP_KERNEL); 702 702 if (!tca_leds) 703 703 return ERR_PTR(-ENOMEM); 704 704
+4 -4
drivers/mailbox/hi6220-mailbox.c
··· 282 282 283 283 mbox->dev = dev; 284 284 mbox->chan_num = MBOX_CHAN_MAX; 285 - mbox->mchan = devm_kzalloc(dev, 286 - mbox->chan_num * sizeof(*mbox->mchan), GFP_KERNEL); 285 + mbox->mchan = devm_kcalloc(dev, 286 + mbox->chan_num, sizeof(*mbox->mchan), GFP_KERNEL); 287 287 if (!mbox->mchan) 288 288 return -ENOMEM; 289 289 290 - mbox->chan = devm_kzalloc(dev, 291 - mbox->chan_num * sizeof(*mbox->chan), GFP_KERNEL); 290 + mbox->chan = devm_kcalloc(dev, 291 + mbox->chan_num, sizeof(*mbox->chan), GFP_KERNEL); 292 292 if (!mbox->chan) 293 293 return -ENOMEM; 294 294
+2 -2
drivers/mailbox/mailbox-sti.c
··· 442 442 if (!mbox) 443 443 return -ENOMEM; 444 444 445 - chans = devm_kzalloc(&pdev->dev, 446 - sizeof(*chans) * STI_MBOX_CHAN_MAX, GFP_KERNEL); 445 + chans = devm_kcalloc(&pdev->dev, 446 + STI_MBOX_CHAN_MAX, sizeof(*chans), GFP_KERNEL); 447 447 if (!chans) 448 448 return -ENOMEM; 449 449
+5 -5
drivers/mailbox/omap-mailbox.c
··· 729 729 return -ENODEV; 730 730 } 731 731 732 - finfoblk = devm_kzalloc(&pdev->dev, info_count * sizeof(*finfoblk), 732 + finfoblk = devm_kcalloc(&pdev->dev, info_count, sizeof(*finfoblk), 733 733 GFP_KERNEL); 734 734 if (!finfoblk) 735 735 return -ENOMEM; ··· 773 773 if (IS_ERR(mdev->mbox_base)) 774 774 return PTR_ERR(mdev->mbox_base); 775 775 776 - mdev->irq_ctx = devm_kzalloc(&pdev->dev, num_users * sizeof(u32), 776 + mdev->irq_ctx = devm_kcalloc(&pdev->dev, num_users, sizeof(u32), 777 777 GFP_KERNEL); 778 778 if (!mdev->irq_ctx) 779 779 return -ENOMEM; 780 780 781 781 /* allocate one extra for marking end of list */ 782 - list = devm_kzalloc(&pdev->dev, (info_count + 1) * sizeof(*list), 782 + list = devm_kcalloc(&pdev->dev, info_count + 1, sizeof(*list), 783 783 GFP_KERNEL); 784 784 if (!list) 785 785 return -ENOMEM; 786 786 787 - chnls = devm_kzalloc(&pdev->dev, (info_count + 1) * sizeof(*chnls), 787 + chnls = devm_kcalloc(&pdev->dev, info_count + 1, sizeof(*chnls), 788 788 GFP_KERNEL); 789 789 if (!chnls) 790 790 return -ENOMEM; 791 791 792 - mboxblk = devm_kzalloc(&pdev->dev, info_count * sizeof(*mbox), 792 + mboxblk = devm_kcalloc(&pdev->dev, info_count, sizeof(*mbox), 793 793 GFP_KERNEL); 794 794 if (!mboxblk) 795 795 return -ENOMEM;
+2 -2
drivers/mailbox/ti-msgmgr.c
··· 568 568 } 569 569 inst->num_valid_queues = queue_count; 570 570 571 - qinst = devm_kzalloc(dev, sizeof(*qinst) * queue_count, GFP_KERNEL); 571 + qinst = devm_kcalloc(dev, queue_count, sizeof(*qinst), GFP_KERNEL); 572 572 if (!qinst) 573 573 return -ENOMEM; 574 574 inst->qinsts = qinst; 575 575 576 - chans = devm_kzalloc(dev, sizeof(*chans) * queue_count, GFP_KERNEL); 576 + chans = devm_kcalloc(dev, queue_count, sizeof(*chans), GFP_KERNEL); 577 577 if (!chans) 578 578 return -ENOMEM; 579 579 inst->chans = chans;
+1 -1
drivers/media/i2c/s5k5baf.c
··· 373 373 data += S5K5BAG_FW_TAG_LEN; 374 374 count -= S5K5BAG_FW_TAG_LEN; 375 375 376 - d = devm_kzalloc(dev, count * sizeof(u16), GFP_KERNEL); 376 + d = devm_kcalloc(dev, count, sizeof(u16), GFP_KERNEL); 377 377 if (!d) 378 378 return -ENOMEM; 379 379
+4 -2
drivers/media/platform/am437x/am437x-vpfe.c
··· 2586 2586 2587 2587 pm_runtime_put_sync(&pdev->dev); 2588 2588 2589 - vpfe->sd = devm_kzalloc(&pdev->dev, sizeof(struct v4l2_subdev *) * 2590 - ARRAY_SIZE(vpfe->cfg->asd), GFP_KERNEL); 2589 + vpfe->sd = devm_kcalloc(&pdev->dev, 2590 + ARRAY_SIZE(vpfe->cfg->asd), 2591 + sizeof(struct v4l2_subdev *), 2592 + GFP_KERNEL); 2591 2593 if (!vpfe->sd) { 2592 2594 ret = -ENOMEM; 2593 2595 goto probe_out_v4l2_unregister;
+6 -4
drivers/media/platform/davinci/vpif_capture.c
··· 1528 1528 if (!pdata) 1529 1529 return NULL; 1530 1530 pdata->subdev_info = 1531 - devm_kzalloc(&pdev->dev, sizeof(*pdata->subdev_info) * 1532 - VPIF_CAPTURE_NUM_CHANNELS, GFP_KERNEL); 1531 + devm_kcalloc(&pdev->dev, 1532 + VPIF_CAPTURE_NUM_CHANNELS, 1533 + sizeof(*pdata->subdev_info), 1534 + GFP_KERNEL); 1533 1535 1534 1536 if (!pdata->subdev_info) 1535 1537 return NULL; ··· 1548 1546 1549 1547 sdinfo = &pdata->subdev_info[i]; 1550 1548 chan = &pdata->chan_config[i]; 1551 - chan->inputs = devm_kzalloc(&pdev->dev, 1552 - sizeof(*chan->inputs) * 1549 + chan->inputs = devm_kcalloc(&pdev->dev, 1553 1550 VPIF_CAPTURE_NUM_CHANNELS, 1551 + sizeof(*chan->inputs), 1554 1552 GFP_KERNEL); 1555 1553 if (!chan->inputs) 1556 1554 return NULL;
+5 -3
drivers/media/platform/qcom/camss-8x16/camss-csid.c
··· 845 845 while (res->clock[csid->nclocks]) 846 846 csid->nclocks++; 847 847 848 - csid->clock = devm_kzalloc(dev, csid->nclocks * sizeof(*csid->clock), 848 + csid->clock = devm_kcalloc(dev, csid->nclocks, sizeof(*csid->clock), 849 849 GFP_KERNEL); 850 850 if (!csid->clock) 851 851 return -ENOMEM; ··· 868 868 continue; 869 869 } 870 870 871 - clock->freq = devm_kzalloc(dev, clock->nfreqs * 872 - sizeof(*clock->freq), GFP_KERNEL); 871 + clock->freq = devm_kcalloc(dev, 872 + clock->nfreqs, 873 + sizeof(*clock->freq), 874 + GFP_KERNEL); 873 875 if (!clock->freq) 874 876 return -ENOMEM; 875 877
+7 -4
drivers/media/platform/qcom/camss-8x16/camss-csiphy.c
··· 732 732 while (res->clock[csiphy->nclocks]) 733 733 csiphy->nclocks++; 734 734 735 - csiphy->clock = devm_kzalloc(dev, csiphy->nclocks * 736 - sizeof(*csiphy->clock), GFP_KERNEL); 735 + csiphy->clock = devm_kcalloc(dev, 736 + csiphy->nclocks, sizeof(*csiphy->clock), 737 + GFP_KERNEL); 737 738 if (!csiphy->clock) 738 739 return -ENOMEM; 739 740 ··· 756 755 continue; 757 756 } 758 757 759 - clock->freq = devm_kzalloc(dev, clock->nfreqs * 760 - sizeof(*clock->freq), GFP_KERNEL); 758 + clock->freq = devm_kcalloc(dev, 759 + clock->nfreqs, 760 + sizeof(*clock->freq), 761 + GFP_KERNEL); 761 762 if (!clock->freq) 762 763 return -ENOMEM; 763 764
+6 -3
drivers/media/platform/qcom/camss-8x16/camss-ispif.c
··· 948 948 while (res->clock[ispif->nclocks]) 949 949 ispif->nclocks++; 950 950 951 - ispif->clock = devm_kzalloc(dev, ispif->nclocks * sizeof(*ispif->clock), 951 + ispif->clock = devm_kcalloc(dev, 952 + ispif->nclocks, sizeof(*ispif->clock), 952 953 GFP_KERNEL); 953 954 if (!ispif->clock) 954 955 return -ENOMEM; ··· 969 968 while (res->clock_for_reset[ispif->nclocks_for_reset]) 970 969 ispif->nclocks_for_reset++; 971 970 972 - ispif->clock_for_reset = devm_kzalloc(dev, ispif->nclocks_for_reset * 973 - sizeof(*ispif->clock_for_reset), GFP_KERNEL); 971 + ispif->clock_for_reset = devm_kcalloc(dev, 972 + ispif->nclocks_for_reset, 973 + sizeof(*ispif->clock_for_reset), 974 + GFP_KERNEL); 974 975 if (!ispif->clock_for_reset) 975 976 return -ENOMEM; 976 977
+5 -3
drivers/media/platform/qcom/camss-8x16/camss-vfe.c
··· 2794 2794 while (res->clock[vfe->nclocks]) 2795 2795 vfe->nclocks++; 2796 2796 2797 - vfe->clock = devm_kzalloc(dev, vfe->nclocks * sizeof(*vfe->clock), 2797 + vfe->clock = devm_kcalloc(dev, vfe->nclocks, sizeof(*vfe->clock), 2798 2798 GFP_KERNEL); 2799 2799 if (!vfe->clock) 2800 2800 return -ENOMEM; ··· 2817 2817 continue; 2818 2818 } 2819 2819 2820 - clock->freq = devm_kzalloc(dev, clock->nfreqs * 2821 - sizeof(*clock->freq), GFP_KERNEL); 2820 + clock->freq = devm_kcalloc(dev, 2821 + clock->nfreqs, 2822 + sizeof(*clock->freq), 2823 + GFP_KERNEL); 2822 2824 if (!clock->freq) 2823 2825 return -ENOMEM; 2824 2826
+2 -1
drivers/media/platform/qcom/camss-8x16/camss.c
··· 271 271 lncfg->clk.pol = mipi_csi2->lane_polarities[0]; 272 272 lncfg->num_data = mipi_csi2->num_data_lanes; 273 273 274 - lncfg->data = devm_kzalloc(dev, lncfg->num_data * sizeof(*lncfg->data), 274 + lncfg->data = devm_kcalloc(dev, 275 + lncfg->num_data, sizeof(*lncfg->data), 275 276 GFP_KERNEL); 276 277 if (!lncfg->data) 277 278 return -ENOMEM;
+2 -1
drivers/media/platform/vsp1/vsp1_entity.c
··· 630 630 entity->source_pad = num_pads - 1; 631 631 632 632 /* Allocate and initialize pads. */ 633 - entity->pads = devm_kzalloc(vsp1->dev, num_pads * sizeof(*entity->pads), 633 + entity->pads = devm_kcalloc(vsp1->dev, 634 + num_pads, sizeof(*entity->pads), 634 635 GFP_KERNEL); 635 636 if (entity->pads == NULL) 636 637 return -ENOMEM;
+1 -1
drivers/media/platform/xilinx/xilinx-vipp.c
··· 532 532 533 533 /* Register the subdevices notifier. */ 534 534 num_subdevs = xdev->num_subdevs; 535 - subdevs = devm_kzalloc(xdev->dev, sizeof(*subdevs) * num_subdevs, 535 + subdevs = devm_kcalloc(xdev->dev, num_subdevs, sizeof(*subdevs), 536 536 GFP_KERNEL); 537 537 if (subdevs == NULL) { 538 538 ret = -ENOMEM;
+4 -3
drivers/media/v4l2-core/v4l2-flash-led-class.c
··· 412 412 struct v4l2_ctrl_config *ctrl_cfg; 413 413 int i, ret, num_ctrls = 0; 414 414 415 - v4l2_flash->ctrls = devm_kzalloc(v4l2_flash->sd.dev, 416 - sizeof(*v4l2_flash->ctrls) * 417 - (STROBE_SOURCE + 1), GFP_KERNEL); 415 + v4l2_flash->ctrls = devm_kcalloc(v4l2_flash->sd.dev, 416 + STROBE_SOURCE + 1, 417 + sizeof(*v4l2_flash->ctrls), 418 + GFP_KERNEL); 418 419 if (!v4l2_flash->ctrls) 419 420 return -ENOMEM; 420 421
+2 -2
drivers/memory/of_memory.c
··· 126 126 arr_sz++; 127 127 128 128 if (arr_sz) 129 - timings = devm_kzalloc(dev, sizeof(*timings) * arr_sz, 130 - GFP_KERNEL); 129 + timings = devm_kcalloc(dev, arr_sz, sizeof(*timings), 130 + GFP_KERNEL); 131 131 132 132 if (!timings) 133 133 goto default_timings;
+6 -6
drivers/mfd/ab8500-debugfs.c
··· 2659 2659 ab8500 = dev_get_drvdata(plf->dev.parent); 2660 2660 num_irqs = ab8500->mask_size; 2661 2661 2662 - irq_count = devm_kzalloc(&plf->dev, 2663 - sizeof(*irq_count)*num_irqs, GFP_KERNEL); 2662 + irq_count = devm_kcalloc(&plf->dev, 2663 + num_irqs, sizeof(*irq_count), GFP_KERNEL); 2664 2664 if (!irq_count) 2665 2665 return -ENOMEM; 2666 2666 2667 - dev_attr = devm_kzalloc(&plf->dev, 2668 - sizeof(*dev_attr)*num_irqs, GFP_KERNEL); 2667 + dev_attr = devm_kcalloc(&plf->dev, 2668 + num_irqs, sizeof(*dev_attr), GFP_KERNEL); 2669 2669 if (!dev_attr) 2670 2670 return -ENOMEM; 2671 2671 2672 - event_name = devm_kzalloc(&plf->dev, 2673 - sizeof(*event_name)*num_irqs, GFP_KERNEL); 2672 + event_name = devm_kcalloc(&plf->dev, 2673 + num_irqs, sizeof(*event_name), GFP_KERNEL); 2674 2674 if (!event_name) 2675 2675 return -ENOMEM; 2676 2676
+3 -1
drivers/mfd/htc-i2cpld.c
··· 477 477 478 478 /* Setup each chip's output GPIOs */ 479 479 htcpld->nchips = pdata->num_chip; 480 - htcpld->chip = devm_kzalloc(dev, sizeof(struct htcpld_chip) * htcpld->nchips, 480 + htcpld->chip = devm_kcalloc(dev, 481 + htcpld->nchips, 482 + sizeof(struct htcpld_chip), 481 483 GFP_KERNEL); 482 484 if (!htcpld->chip) 483 485 return -ENOMEM;
+3 -3
drivers/mfd/motorola-cpcap.c
··· 173 173 int ret; 174 174 175 175 cpcap->irqs = devm_kzalloc(&cpcap->spi->dev, 176 - sizeof(*cpcap->irqs) * 177 - CPCAP_NR_IRQ_REG_BANKS * 178 - cpcap->regmap_conf->val_bits, 176 + array3_size(sizeof(*cpcap->irqs), 177 + CPCAP_NR_IRQ_REG_BANKS, 178 + cpcap->regmap_conf->val_bits), 179 179 GFP_KERNEL); 180 180 if (!cpcap->irqs) 181 181 return -ENOMEM;
+3 -2
drivers/mfd/sprd-sc27xx-spi.c
··· 199 199 ddata->irq_chip.num_irqs = pdata->num_irqs; 200 200 ddata->irq_chip.mask_invert = true; 201 201 202 - ddata->irqs = devm_kzalloc(&spi->dev, sizeof(struct regmap_irq) * 203 - pdata->num_irqs, GFP_KERNEL); 202 + ddata->irqs = devm_kcalloc(&spi->dev, 203 + pdata->num_irqs, sizeof(struct regmap_irq), 204 + GFP_KERNEL); 204 205 if (!ddata->irqs) 205 206 return -ENOMEM; 206 207
+3 -2
drivers/mfd/twl-core.c
··· 1139 1139 } 1140 1140 1141 1141 num_slaves = twl_get_num_slaves(); 1142 - twl_priv->twl_modules = devm_kzalloc(&client->dev, 1143 - sizeof(struct twl_client) * num_slaves, 1142 + twl_priv->twl_modules = devm_kcalloc(&client->dev, 1143 + num_slaves, 1144 + sizeof(struct twl_client), 1144 1145 GFP_KERNEL); 1145 1146 if (!twl_priv->twl_modules) { 1146 1147 status = -ENOMEM;
+4 -3
drivers/mfd/wm8994-core.c
··· 368 368 goto err; 369 369 } 370 370 371 - wm8994->supplies = devm_kzalloc(wm8994->dev, 372 - sizeof(struct regulator_bulk_data) * 373 - wm8994->num_supplies, GFP_KERNEL); 371 + wm8994->supplies = devm_kcalloc(wm8994->dev, 372 + wm8994->num_supplies, 373 + sizeof(struct regulator_bulk_data), 374 + GFP_KERNEL); 374 375 if (!wm8994->supplies) { 375 376 ret = -ENOMEM; 376 377 goto err;
+2 -2
drivers/misc/sram.c
··· 264 264 list_sort(NULL, &reserve_list, sram_reserve_cmp); 265 265 266 266 if (exports) { 267 - sram->partition = devm_kzalloc(sram->dev, 268 - exports * sizeof(*sram->partition), 267 + sram->partition = devm_kcalloc(sram->dev, 268 + exports, sizeof(*sram->partition), 269 269 GFP_KERNEL); 270 270 if (!sram->partition) { 271 271 ret = -ENOMEM;
+4 -2
drivers/mmc/host/sdhci-omap.c
··· 797 797 if (!(omap_host->flags & SDHCI_OMAP_REQUIRE_IODELAY)) 798 798 return 0; 799 799 800 - pinctrl_state = devm_kzalloc(dev, sizeof(*pinctrl_state) * 801 - (MMC_TIMING_MMC_HS200 + 1), GFP_KERNEL); 800 + pinctrl_state = devm_kcalloc(dev, 801 + MMC_TIMING_MMC_HS200 + 1, 802 + sizeof(*pinctrl_state), 803 + GFP_KERNEL); 802 804 if (!pinctrl_state) 803 805 return -ENOMEM; 804 806
+1 -1
drivers/mtd/devices/docg3.c
··· 1993 1993 base = devm_ioremap(dev, ress->start, DOC_IOSPACE_SIZE); 1994 1994 1995 1995 ret = -ENOMEM; 1996 - cascade = devm_kzalloc(dev, sizeof(*cascade) * DOC_MAX_NBFLOORS, 1996 + cascade = devm_kcalloc(dev, DOC_MAX_NBFLOORS, sizeof(*cascade), 1997 1997 GFP_KERNEL); 1998 1998 if (!cascade) 1999 1999 return ret;
+2 -2
drivers/mtd/nand/raw/qcom_nandc.c
··· 2510 2510 if (!nandc->regs) 2511 2511 return -ENOMEM; 2512 2512 2513 - nandc->reg_read_buf = devm_kzalloc(nandc->dev, 2514 - MAX_REG_RD * sizeof(*nandc->reg_read_buf), 2513 + nandc->reg_read_buf = devm_kcalloc(nandc->dev, 2514 + MAX_REG_RD, sizeof(*nandc->reg_read_buf), 2515 2515 GFP_KERNEL); 2516 2516 if (!nandc->reg_read_buf) 2517 2517 return -ENOMEM;
+1 -1
drivers/mtd/nand/raw/s3c2410.c
··· 1038 1038 if (!pdata->nr_sets) 1039 1039 return 0; 1040 1040 1041 - sets = devm_kzalloc(&pdev->dev, sizeof(*sets) * pdata->nr_sets, 1041 + sets = devm_kcalloc(&pdev->dev, pdata->nr_sets, sizeof(*sets), 1042 1042 GFP_KERNEL); 1043 1043 if (!sets) 1044 1044 return -ENOMEM;
+4 -4
drivers/net/dsa/b53/b53_common.c
··· 2044 2044 } 2045 2045 } 2046 2046 2047 - dev->ports = devm_kzalloc(dev->dev, 2048 - sizeof(struct b53_port) * dev->num_ports, 2047 + dev->ports = devm_kcalloc(dev->dev, 2048 + dev->num_ports, sizeof(struct b53_port), 2049 2049 GFP_KERNEL); 2050 2050 if (!dev->ports) 2051 2051 return -ENOMEM; 2052 2052 2053 - dev->vlans = devm_kzalloc(dev->dev, 2054 - sizeof(struct b53_vlan) * dev->num_vlans, 2053 + dev->vlans = devm_kcalloc(dev->dev, 2054 + dev->num_vlans, sizeof(struct b53_vlan), 2055 2055 GFP_KERNEL); 2056 2056 if (!dev->vlans) 2057 2057 return -ENOMEM;
+4 -4
drivers/net/ethernet/amazon/ena/ena_ethtool.c
··· 838 838 return; 839 839 } 840 840 841 - strings_buf = devm_kzalloc(&adapter->pdev->dev, 842 - strings_num * ETH_GSTRING_LEN, 841 + strings_buf = devm_kcalloc(&adapter->pdev->dev, 842 + ETH_GSTRING_LEN, strings_num, 843 843 GFP_ATOMIC); 844 844 if (!strings_buf) { 845 845 netif_err(adapter, drv, netdev, ··· 847 847 return; 848 848 } 849 849 850 - data_buf = devm_kzalloc(&adapter->pdev->dev, 851 - strings_num * sizeof(u64), 850 + data_buf = devm_kcalloc(&adapter->pdev->dev, 851 + strings_num, sizeof(u64), 852 852 GFP_ATOMIC); 853 853 if (!data_buf) { 854 854 netif_err(adapter, drv, netdev,
+2 -1
drivers/net/ethernet/ethoc.c
··· 1141 1141 dev_dbg(&pdev->dev, "ethoc: num_tx: %d num_rx: %d\n", 1142 1142 priv->num_tx, priv->num_rx); 1143 1143 1144 - priv->vma = devm_kzalloc(&pdev->dev, num_bd*sizeof(void *), GFP_KERNEL); 1144 + priv->vma = devm_kcalloc(&pdev->dev, num_bd, sizeof(void *), 1145 + GFP_KERNEL); 1145 1146 if (!priv->vma) { 1146 1147 ret = -ENOMEM; 1147 1148 goto free;
+1 -1
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
··· 664 664 struct dpaa_fq *dpaa_fq; 665 665 int i; 666 666 667 - dpaa_fq = devm_kzalloc(dev, sizeof(*dpaa_fq) * count, 667 + dpaa_fq = devm_kcalloc(dev, count, sizeof(*dpaa_fq), 668 668 GFP_KERNEL); 669 669 if (!dpaa_fq) 670 670 return NULL;
+4 -2
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
··· 2846 2846 struct pci_dev *pdev = h->pdev; 2847 2847 int i, ret; 2848 2848 2849 - priv->ring_data = devm_kzalloc(&pdev->dev, h->kinfo.num_tqps * 2850 - sizeof(*priv->ring_data) * 2, 2849 + priv->ring_data = devm_kzalloc(&pdev->dev, 2850 + array3_size(h->kinfo.num_tqps, 2851 + sizeof(*priv->ring_data), 2852 + 2), 2851 2853 GFP_KERNEL); 2852 2854 if (!priv->ring_data) 2853 2855 return -ENOMEM;
+2 -3
drivers/net/ethernet/ni/nixge.c
··· 247 247 if (!priv->tx_bd_v) 248 248 goto out; 249 249 250 - priv->tx_skb = devm_kzalloc(ndev->dev.parent, 251 - sizeof(*priv->tx_skb) * 252 - TX_BD_NUM, 250 + priv->tx_skb = devm_kcalloc(ndev->dev.parent, 251 + TX_BD_NUM, sizeof(*priv->tx_skb), 253 252 GFP_KERNEL); 254 253 if (!priv->tx_skb) 255 254 goto out;
+2 -2
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
··· 277 277 278 278 /* Reserve one last filter which lets all pass */ 279 279 priv->tc_entries_max = count; 280 - priv->tc_entries = devm_kzalloc(priv->device, 281 - sizeof(*priv->tc_entries) * count, GFP_KERNEL); 280 + priv->tc_entries = devm_kcalloc(priv->device, 281 + count, sizeof(*priv->tc_entries), GFP_KERNEL); 282 282 if (!priv->tc_entries) 283 283 return -ENOMEM; 284 284
+5 -4
drivers/net/ethernet/ti/cpsw.c
··· 2740 2740 } 2741 2741 data->active_slave = prop; 2742 2742 2743 - data->slave_data = devm_kzalloc(&pdev->dev, data->slaves 2744 - * sizeof(struct cpsw_slave_data), 2743 + data->slave_data = devm_kcalloc(&pdev->dev, 2744 + data->slaves, 2745 + sizeof(struct cpsw_slave_data), 2745 2746 GFP_KERNEL); 2746 2747 if (!data->slave_data) 2747 2748 return -ENOMEM; ··· 3046 3045 3047 3046 memcpy(ndev->dev_addr, priv->mac_addr, ETH_ALEN); 3048 3047 3049 - cpsw->slaves = devm_kzalloc(&pdev->dev, 3050 - sizeof(struct cpsw_slave) * data->slaves, 3048 + cpsw->slaves = devm_kcalloc(&pdev->dev, 3049 + data->slaves, sizeof(struct cpsw_slave), 3051 3050 GFP_KERNEL); 3052 3051 if (!cpsw->slaves) { 3053 3052 ret = -ENOMEM;
+12 -12
drivers/net/ethernet/ti/netcp_ethss.c
··· 3285 3285 gbe_dev->et_stats = xgbe10_et_stats; 3286 3286 gbe_dev->num_et_stats = ARRAY_SIZE(xgbe10_et_stats); 3287 3287 3288 - gbe_dev->hw_stats = devm_kzalloc(gbe_dev->dev, 3289 - gbe_dev->num_et_stats * sizeof(u64), 3288 + gbe_dev->hw_stats = devm_kcalloc(gbe_dev->dev, 3289 + gbe_dev->num_et_stats, sizeof(u64), 3290 3290 GFP_KERNEL); 3291 3291 if (!gbe_dev->hw_stats) { 3292 3292 dev_err(gbe_dev->dev, "hw_stats memory allocation failed\n"); ··· 3294 3294 } 3295 3295 3296 3296 gbe_dev->hw_stats_prev = 3297 - devm_kzalloc(gbe_dev->dev, 3298 - gbe_dev->num_et_stats * sizeof(u32), 3297 + devm_kcalloc(gbe_dev->dev, 3298 + gbe_dev->num_et_stats, sizeof(u32), 3299 3299 GFP_KERNEL); 3300 3300 if (!gbe_dev->hw_stats_prev) { 3301 3301 dev_err(gbe_dev->dev, ··· 3405 3405 gbe_dev->et_stats = gbe13_et_stats; 3406 3406 gbe_dev->num_et_stats = ARRAY_SIZE(gbe13_et_stats); 3407 3407 3408 - gbe_dev->hw_stats = devm_kzalloc(gbe_dev->dev, 3409 - gbe_dev->num_et_stats * sizeof(u64), 3408 + gbe_dev->hw_stats = devm_kcalloc(gbe_dev->dev, 3409 + gbe_dev->num_et_stats, sizeof(u64), 3410 3410 GFP_KERNEL); 3411 3411 if (!gbe_dev->hw_stats) { 3412 3412 dev_err(gbe_dev->dev, "hw_stats memory allocation failed\n"); ··· 3414 3414 } 3415 3415 3416 3416 gbe_dev->hw_stats_prev = 3417 - devm_kzalloc(gbe_dev->dev, 3418 - gbe_dev->num_et_stats * sizeof(u32), 3417 + devm_kcalloc(gbe_dev->dev, 3418 + gbe_dev->num_et_stats, sizeof(u32), 3419 3419 GFP_KERNEL); 3420 3420 if (!gbe_dev->hw_stats_prev) { 3421 3421 dev_err(gbe_dev->dev, ··· 3477 3477 gbe_dev->num_et_stats = GBENU_ET_STATS_HOST_SIZE + 3478 3478 GBENU_ET_STATS_PORT_SIZE; 3479 3479 3480 - gbe_dev->hw_stats = devm_kzalloc(gbe_dev->dev, 3481 - gbe_dev->num_et_stats * sizeof(u64), 3480 + gbe_dev->hw_stats = devm_kcalloc(gbe_dev->dev, 3481 + gbe_dev->num_et_stats, sizeof(u64), 3482 3482 GFP_KERNEL); 3483 3483 if (!gbe_dev->hw_stats) { 3484 3484 dev_err(gbe_dev->dev, "hw_stats memory allocation failed\n"); ··· 3486 3486 } 3487 3487 3488 3488 gbe_dev->hw_stats_prev = 3489 - devm_kzalloc(gbe_dev->dev, 3490 - gbe_dev->num_et_stats * sizeof(u32), 3489 + devm_kcalloc(gbe_dev->dev, 3490 + gbe_dev->num_et_stats, sizeof(u32), 3491 3491 GFP_KERNEL); 3492 3492 if (!gbe_dev->hw_stats_prev) { 3493 3493 dev_err(gbe_dev->dev,
+3 -3
drivers/net/phy/phy_led_triggers.c
··· 128 128 if (err) 129 129 goto out_free_link; 130 130 131 - phy->phy_led_triggers = devm_kzalloc(&phy->mdio.dev, 132 - sizeof(struct phy_led_trigger) * 133 - phy->phy_num_led_triggers, 131 + phy->phy_led_triggers = devm_kcalloc(&phy->mdio.dev, 132 + phy->phy_num_led_triggers, 133 + sizeof(struct phy_led_trigger), 134 134 GFP_KERNEL); 135 135 if (!phy->phy_led_triggers) { 136 136 err = -ENOMEM;
+1 -1
drivers/net/wireless/mediatek/mt76/mac80211.c
··· 181 181 if (!chanlist) 182 182 return -ENOMEM; 183 183 184 - msband->chan = devm_kzalloc(dev->dev, n_chan * sizeof(*msband->chan), 184 + msband->chan = devm_kcalloc(dev->dev, n_chan, sizeof(*msband->chan), 185 185 GFP_KERNEL); 186 186 if (!msband->chan) 187 187 return -ENOMEM;
+2 -1
drivers/pci/cadence/pcie-cadence-ep.c
··· 467 467 dev_err(dev, "missing \"cdns,max-outbound-regions\"\n"); 468 468 return ret; 469 469 } 470 - ep->ob_addr = devm_kzalloc(dev, ep->max_regions * sizeof(*ep->ob_addr), 470 + ep->ob_addr = devm_kcalloc(dev, 471 + ep->max_regions, sizeof(*ep->ob_addr), 471 472 GFP_KERNEL); 472 473 if (!ep->ob_addr) 473 474 return -ENOMEM;
+2 -2
drivers/pci/dwc/pci-dra7xx.c
··· 639 639 return phy_count; 640 640 } 641 641 642 - phy = devm_kzalloc(dev, sizeof(*phy) * phy_count, GFP_KERNEL); 642 + phy = devm_kcalloc(dev, phy_count, sizeof(*phy), GFP_KERNEL); 643 643 if (!phy) 644 644 return -ENOMEM; 645 645 646 - link = devm_kzalloc(dev, sizeof(*link) * phy_count, GFP_KERNEL); 646 + link = devm_kcalloc(dev, phy_count, sizeof(*link), GFP_KERNEL); 647 647 if (!link) 648 648 return -ENOMEM; 649 649
+5 -3
drivers/pci/dwc/pcie-designware-ep.c
··· 366 366 return -EINVAL; 367 367 } 368 368 369 - ep->ib_window_map = devm_kzalloc(dev, sizeof(long) * 369 + ep->ib_window_map = devm_kcalloc(dev, 370 370 BITS_TO_LONGS(ep->num_ib_windows), 371 + sizeof(long), 371 372 GFP_KERNEL); 372 373 if (!ep->ib_window_map) 373 374 return -ENOMEM; 374 375 375 - ep->ob_window_map = devm_kzalloc(dev, sizeof(long) * 376 + ep->ob_window_map = devm_kcalloc(dev, 376 377 BITS_TO_LONGS(ep->num_ob_windows), 378 + sizeof(long), 377 379 GFP_KERNEL); 378 380 if (!ep->ob_window_map) 379 381 return -ENOMEM; 380 382 381 - addr = devm_kzalloc(dev, sizeof(phys_addr_t) * ep->num_ob_windows, 383 + addr = devm_kcalloc(dev, ep->num_ob_windows, sizeof(phys_addr_t), 382 384 GFP_KERNEL); 383 385 if (!addr) 384 386 return -ENOMEM;
+1 -1
drivers/pci/host/pcie-rockchip-ep.c
··· 593 593 PCIE_CLIENT_CONFIG); 594 594 595 595 max_regions = ep->max_regions; 596 - ep->ob_addr = devm_kzalloc(dev, max_regions * sizeof(*ep->ob_addr), 596 + ep->ob_addr = devm_kcalloc(dev, max_regions, sizeof(*ep->ob_addr), 597 597 GFP_KERNEL); 598 598 599 599 if (!ep->ob_addr) {
+6 -4
drivers/pinctrl/berlin/berlin.c
··· 216 216 } 217 217 218 218 /* we will reallocate later */ 219 - pctrl->functions = devm_kzalloc(&pdev->dev, 220 - max_functions * sizeof(*pctrl->functions), 219 + pctrl->functions = devm_kcalloc(&pdev->dev, 220 + max_functions, 221 + sizeof(*pctrl->functions), 221 222 GFP_KERNEL); 222 223 if (!pctrl->functions) 223 224 return -ENOMEM; ··· 262 261 263 262 if (!function->groups) { 264 263 function->groups = 265 - devm_kzalloc(&pdev->dev, 266 - function->ngroups * sizeof(char *), 264 + devm_kcalloc(&pdev->dev, 265 + function->ngroups, 266 + sizeof(char *), 267 267 GFP_KERNEL); 268 268 269 269 if (!function->groups)
+6 -4
drivers/pinctrl/freescale/pinctrl-imx.c
··· 477 477 config = imx_pinconf_parse_generic_config(np, ipctl); 478 478 479 479 grp->num_pins = size / pin_size; 480 - grp->data = devm_kzalloc(ipctl->dev, grp->num_pins * 481 - sizeof(struct imx_pin), GFP_KERNEL); 482 - grp->pins = devm_kzalloc(ipctl->dev, grp->num_pins * 483 - sizeof(unsigned int), GFP_KERNEL); 480 + grp->data = devm_kcalloc(ipctl->dev, 481 + grp->num_pins, sizeof(struct imx_pin), 482 + GFP_KERNEL); 483 + grp->pins = devm_kcalloc(ipctl->dev, 484 + grp->num_pins, sizeof(unsigned int), 485 + GFP_KERNEL); 484 486 if (!grp->pins || !grp->data) 485 487 return -ENOMEM; 486 488
+10 -10
drivers/pinctrl/freescale/pinctrl-imx1-core.c
··· 483 483 } 484 484 485 485 grp->npins = size / 12; 486 - grp->pins = devm_kzalloc(info->dev, 487 - grp->npins * sizeof(struct imx1_pin), GFP_KERNEL); 488 - grp->pin_ids = devm_kzalloc(info->dev, 489 - grp->npins * sizeof(unsigned int), GFP_KERNEL); 486 + grp->pins = devm_kcalloc(info->dev, 487 + grp->npins, sizeof(struct imx1_pin), GFP_KERNEL); 488 + grp->pin_ids = devm_kcalloc(info->dev, 489 + grp->npins, sizeof(unsigned int), GFP_KERNEL); 490 490 491 491 if (!grp->pins || !grp->pin_ids) 492 492 return -ENOMEM; ··· 523 523 if (func->num_groups == 0) 524 524 return -EINVAL; 525 525 526 - func->groups = devm_kzalloc(info->dev, 527 - func->num_groups * sizeof(char *), GFP_KERNEL); 526 + func->groups = devm_kcalloc(info->dev, 527 + func->num_groups, sizeof(char *), GFP_KERNEL); 528 528 529 529 if (!func->groups) 530 530 return -ENOMEM; ··· 566 566 } 567 567 568 568 info->nfunctions = nfuncs; 569 - info->functions = devm_kzalloc(&pdev->dev, 570 - nfuncs * sizeof(struct imx1_pmx_func), GFP_KERNEL); 569 + info->functions = devm_kcalloc(&pdev->dev, 570 + nfuncs, sizeof(struct imx1_pmx_func), GFP_KERNEL); 571 571 572 572 info->ngroups = ngroups; 573 - info->groups = devm_kzalloc(&pdev->dev, 574 - ngroups * sizeof(struct imx1_pin_group), GFP_KERNEL); 573 + info->groups = devm_kcalloc(&pdev->dev, 574 + ngroups, sizeof(struct imx1_pin_group), GFP_KERNEL); 575 575 576 576 577 577 if (!info->functions || !info->groups)
+11 -7
drivers/pinctrl/freescale/pinctrl-mxs.c
··· 370 370 return -EINVAL; 371 371 g->npins = length / sizeof(u32); 372 372 373 - g->pins = devm_kzalloc(&pdev->dev, g->npins * sizeof(*g->pins), 373 + g->pins = devm_kcalloc(&pdev->dev, g->npins, sizeof(*g->pins), 374 374 GFP_KERNEL); 375 375 if (!g->pins) 376 376 return -ENOMEM; 377 377 378 - g->muxsel = devm_kzalloc(&pdev->dev, g->npins * sizeof(*g->muxsel), 378 + g->muxsel = devm_kcalloc(&pdev->dev, g->npins, sizeof(*g->muxsel), 379 379 GFP_KERNEL); 380 380 if (!g->muxsel) 381 381 return -ENOMEM; ··· 426 426 } 427 427 } 428 428 429 - soc->functions = devm_kzalloc(&pdev->dev, soc->nfunctions * 430 - sizeof(*soc->functions), GFP_KERNEL); 429 + soc->functions = devm_kcalloc(&pdev->dev, 430 + soc->nfunctions, 431 + sizeof(*soc->functions), 432 + GFP_KERNEL); 431 433 if (!soc->functions) 432 434 return -ENOMEM; 433 435 434 - soc->groups = devm_kzalloc(&pdev->dev, soc->ngroups * 435 - sizeof(*soc->groups), GFP_KERNEL); 436 + soc->groups = devm_kcalloc(&pdev->dev, 437 + soc->ngroups, sizeof(*soc->groups), 438 + GFP_KERNEL); 436 439 if (!soc->groups) 437 440 return -ENOMEM; 438 441 ··· 495 492 496 493 if (strcmp(fn, child->name)) { 497 494 f = &soc->functions[idxf++]; 498 - f->groups = devm_kzalloc(&pdev->dev, f->ngroups * 495 + f->groups = devm_kcalloc(&pdev->dev, 496 + f->ngroups, 499 497 sizeof(*f->groups), 500 498 GFP_KERNEL); 501 499 if (!f->groups)
+13 -8
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
··· 856 856 struct armada_37xx_pin_group *grp = &info->groups[n]; 857 857 int i, j, f; 858 858 859 - grp->pins = devm_kzalloc(info->dev, 860 - (grp->npins + grp->extra_npins) * 861 - sizeof(*grp->pins), GFP_KERNEL); 859 + grp->pins = devm_kcalloc(info->dev, 860 + grp->npins + grp->extra_npins, 861 + sizeof(*grp->pins), 862 + GFP_KERNEL); 862 863 if (!grp->pins) 863 864 return -ENOMEM; 864 865 ··· 909 908 const char **groups; 910 909 int g; 911 910 912 - funcs[n].groups = devm_kzalloc(info->dev, funcs[n].ngroups * 911 + funcs[n].groups = devm_kcalloc(info->dev, 912 + funcs[n].ngroups, 913 913 sizeof(*(funcs[n].groups)), 914 914 GFP_KERNEL); 915 915 if (!funcs[n].groups) ··· 950 948 ctrldesc->pmxops = &armada_37xx_pmx_ops; 951 949 ctrldesc->confops = &armada_37xx_pinconf_ops; 952 950 953 - pindesc = devm_kzalloc(&pdev->dev, sizeof(*pindesc) * 954 - pin_data->nr_pins, GFP_KERNEL); 951 + pindesc = devm_kcalloc(&pdev->dev, 952 + pin_data->nr_pins, sizeof(*pindesc), 953 + GFP_KERNEL); 955 954 if (!pindesc) 956 955 return -ENOMEM; 957 956 ··· 971 968 * we allocate functions for number of pins and hope there are 972 969 * fewer unique functions than pins available 973 970 */ 974 - info->funcs = devm_kzalloc(&pdev->dev, pin_data->nr_pins * 975 - sizeof(struct armada_37xx_pmx_func), GFP_KERNEL); 971 + info->funcs = devm_kcalloc(&pdev->dev, 972 + pin_data->nr_pins, 973 + sizeof(struct armada_37xx_pmx_func), 974 + GFP_KERNEL); 976 975 if (!info->funcs) 977 976 return -ENOMEM; 978 977
+10 -6
drivers/pinctrl/mvebu/pinctrl-mvebu.c
··· 501 501 502 502 /* we allocate functions for number of pins and hope 503 503 * there are fewer unique functions than pins available */ 504 - funcs = devm_kzalloc(&pdev->dev, funcsize * 505 - sizeof(struct mvebu_pinctrl_function), GFP_KERNEL); 504 + funcs = devm_kcalloc(&pdev->dev, 505 + funcsize, sizeof(struct mvebu_pinctrl_function), 506 + GFP_KERNEL); 506 507 if (!funcs) 507 508 return -ENOMEM; 508 509 ··· 550 549 551 550 /* allocate group name array if not done already */ 552 551 if (!f->groups) { 553 - f->groups = devm_kzalloc(&pdev->dev, 554 - f->num_groups * sizeof(char *), 552 + f->groups = devm_kcalloc(&pdev->dev, 553 + f->num_groups, 554 + sizeof(char *), 555 555 GFP_KERNEL); 556 556 if (!f->groups) 557 557 return -ENOMEM; ··· 624 622 } 625 623 } 626 624 627 - pdesc = devm_kzalloc(&pdev->dev, pctl->desc.npins * 628 - sizeof(struct pinctrl_pin_desc), GFP_KERNEL); 625 + pdesc = devm_kcalloc(&pdev->dev, 626 + pctl->desc.npins, 627 + sizeof(struct pinctrl_pin_desc), 628 + GFP_KERNEL); 629 629 if (!pdesc) 630 630 return -ENOMEM; 631 631
+23 -16
drivers/pinctrl/pinctrl-at91-pio4.c
··· 945 945 return PTR_ERR(atmel_pioctrl->clk); 946 946 } 947 947 948 - atmel_pioctrl->pins = devm_kzalloc(dev, sizeof(*atmel_pioctrl->pins) 949 - * atmel_pioctrl->npins, GFP_KERNEL); 948 + atmel_pioctrl->pins = devm_kcalloc(dev, 949 + atmel_pioctrl->npins, 950 + sizeof(*atmel_pioctrl->pins), 951 + GFP_KERNEL); 950 952 if (!atmel_pioctrl->pins) 951 953 return -ENOMEM; 952 954 953 - pin_desc = devm_kzalloc(dev, sizeof(*pin_desc) 954 - * atmel_pioctrl->npins, GFP_KERNEL); 955 + pin_desc = devm_kcalloc(dev, atmel_pioctrl->npins, sizeof(*pin_desc), 956 + GFP_KERNEL); 955 957 if (!pin_desc) 956 958 return -ENOMEM; 957 959 atmel_pinctrl_desc.pins = pin_desc; 958 960 atmel_pinctrl_desc.npins = atmel_pioctrl->npins; 959 961 960 962 /* One pin is one group since a pin can achieve all functions. */ 961 - group_names = devm_kzalloc(dev, sizeof(*group_names) 962 - * atmel_pioctrl->npins, GFP_KERNEL); 963 + group_names = devm_kcalloc(dev, 964 + atmel_pioctrl->npins, sizeof(*group_names), 965 + GFP_KERNEL); 963 966 if (!group_names) 964 967 return -ENOMEM; 965 968 atmel_pioctrl->group_names = group_names; 966 969 967 - atmel_pioctrl->groups = devm_kzalloc(&pdev->dev, 968 - sizeof(*atmel_pioctrl->groups) * atmel_pioctrl->npins, 970 + atmel_pioctrl->groups = devm_kcalloc(&pdev->dev, 971 + atmel_pioctrl->npins, sizeof(*atmel_pioctrl->groups), 969 972 GFP_KERNEL); 970 973 if (!atmel_pioctrl->groups) 971 974 return -ENOMEM; ··· 1004 1001 atmel_pioctrl->gpio_chip->parent = dev; 1005 1002 atmel_pioctrl->gpio_chip->names = atmel_pioctrl->group_names; 1006 1003 1007 - atmel_pioctrl->pm_wakeup_sources = devm_kzalloc(dev, 1008 - sizeof(*atmel_pioctrl->pm_wakeup_sources) 1009 - * atmel_pioctrl->nbanks, GFP_KERNEL); 1004 + atmel_pioctrl->pm_wakeup_sources = devm_kcalloc(dev, 1005 + atmel_pioctrl->nbanks, 1006 + sizeof(*atmel_pioctrl->pm_wakeup_sources), 1007 + GFP_KERNEL); 1010 1008 if (!atmel_pioctrl->pm_wakeup_sources) 1011 1009 return -ENOMEM; 1012 1010 1013 - atmel_pioctrl->pm_suspend_backup = devm_kzalloc(dev, 1014 - sizeof(*atmel_pioctrl->pm_suspend_backup) 1015 - * atmel_pioctrl->nbanks, GFP_KERNEL); 1011 + atmel_pioctrl->pm_suspend_backup = devm_kcalloc(dev, 1012 + atmel_pioctrl->nbanks, 1013 + sizeof(*atmel_pioctrl->pm_suspend_backup), 1014 + GFP_KERNEL); 1016 1015 if (!atmel_pioctrl->pm_suspend_backup) 1017 1016 return -ENOMEM; 1018 1017 1019 - atmel_pioctrl->irqs = devm_kzalloc(dev, sizeof(*atmel_pioctrl->irqs) 1020 - * atmel_pioctrl->nbanks, GFP_KERNEL); 1018 + atmel_pioctrl->irqs = devm_kcalloc(dev, 1019 + atmel_pioctrl->nbanks, 1020 + sizeof(*atmel_pioctrl->irqs), 1021 + GFP_KERNEL); 1021 1022 if (!atmel_pioctrl->irqs) 1022 1023 return -ENOMEM; 1023 1024
+22 -12
drivers/pinctrl/pinctrl-at91.c
··· 269 269 } 270 270 271 271 map_num += grp->npins; 272 - new_map = devm_kzalloc(pctldev->dev, sizeof(*new_map) * map_num, GFP_KERNEL); 272 + new_map = devm_kcalloc(pctldev->dev, map_num, sizeof(*new_map), 273 + GFP_KERNEL); 273 274 if (!new_map) 274 275 return -ENOMEM; 275 276 ··· 1050 1049 } 1051 1050 info->nmux = size / gpio_banks; 1052 1051 1053 - info->mux_mask = devm_kzalloc(info->dev, sizeof(u32) * size, GFP_KERNEL); 1052 + info->mux_mask = devm_kcalloc(info->dev, size, sizeof(u32), 1053 + GFP_KERNEL); 1054 1054 if (!info->mux_mask) 1055 1055 return -ENOMEM; 1056 1056 ··· 1089 1087 } 1090 1088 1091 1089 grp->npins = size / 4; 1092 - pin = grp->pins_conf = devm_kzalloc(info->dev, grp->npins * sizeof(struct at91_pmx_pin), 1093 - GFP_KERNEL); 1094 - grp->pins = devm_kzalloc(info->dev, grp->npins * sizeof(unsigned int), 1095 - GFP_KERNEL); 1090 + pin = grp->pins_conf = devm_kcalloc(info->dev, 1091 + grp->npins, 1092 + sizeof(struct at91_pmx_pin), 1093 + GFP_KERNEL); 1094 + grp->pins = devm_kcalloc(info->dev, grp->npins, sizeof(unsigned int), 1095 + GFP_KERNEL); 1096 1096 if (!grp->pins_conf || !grp->pins) 1097 1097 return -ENOMEM; 1098 1098 ··· 1133 1129 dev_err(info->dev, "no groups defined\n"); 1134 1130 return -EINVAL; 1135 1131 } 1136 - func->groups = devm_kzalloc(info->dev, 1137 - func->ngroups * sizeof(char *), GFP_KERNEL); 1132 + func->groups = devm_kcalloc(info->dev, 1133 + func->ngroups, sizeof(char *), GFP_KERNEL); 1138 1134 if (!func->groups) 1139 1135 return -ENOMEM; 1140 1136 ··· 1196 1192 1197 1193 dev_dbg(&pdev->dev, "nfunctions = %d\n", info->nfunctions); 1198 1194 dev_dbg(&pdev->dev, "ngroups = %d\n", info->ngroups); 1199 - info->functions = devm_kzalloc(&pdev->dev, info->nfunctions * sizeof(struct at91_pmx_func), 1195 + info->functions = devm_kcalloc(&pdev->dev, 1196 + info->nfunctions, 1197 + sizeof(struct at91_pmx_func), 1200 1198 GFP_KERNEL); 1201 1199 if (!info->functions) 1202 1200 return -ENOMEM; 1203 1201 1204 - info->groups = devm_kzalloc(&pdev->dev, info->ngroups * sizeof(struct at91_pin_group), 1202 + info->groups = devm_kcalloc(&pdev->dev, 1203 + info->ngroups, 1204 + sizeof(struct at91_pin_group), 1205 1205 GFP_KERNEL); 1206 1206 if (!info->groups) 1207 1207 return -ENOMEM; ··· 1264 1256 at91_pinctrl_desc.name = dev_name(&pdev->dev); 1265 1257 at91_pinctrl_desc.npins = gpio_banks * MAX_NB_GPIO_PER_BANK; 1266 1258 at91_pinctrl_desc.pins = pdesc = 1267 - devm_kzalloc(&pdev->dev, sizeof(*pdesc) * at91_pinctrl_desc.npins, GFP_KERNEL); 1259 + devm_kcalloc(&pdev->dev, 1260 + at91_pinctrl_desc.npins, sizeof(*pdesc), 1261 + GFP_KERNEL); 1268 1262 1269 1263 if (!at91_pinctrl_desc.pins) 1270 1264 return -ENOMEM; ··· 1773 1763 chip->ngpio = ngpio; 1774 1764 } 1775 1765 1776 - names = devm_kzalloc(&pdev->dev, sizeof(char *) * chip->ngpio, 1766 + names = devm_kcalloc(&pdev->dev, chip->ngpio, sizeof(char *), 1777 1767 GFP_KERNEL); 1778 1768 1779 1769 if (!names) {
+4 -3
drivers/pinctrl/pinctrl-axp209.c
··· 328 328 329 329 func->ngroups = ngroups; 330 330 if (func->ngroups > 0) { 331 - func->groups = devm_kzalloc(dev, ngroups * sizeof(const char *), 331 + func->groups = devm_kcalloc(dev, 332 + ngroups, sizeof(const char *), 332 333 GFP_KERNEL); 333 334 group = func->groups; 334 335 for_each_set_bit(bit, &mask_cpy, mask_len) { ··· 359 358 /* Every pin supports GPIO_OUT and GPIO_IN functions */ 360 359 for (i = 0; i <= AXP20X_FUNC_GPIO_IN; i++) { 361 360 pctl->funcs[i].ngroups = npins; 362 - pctl->funcs[i].groups = devm_kzalloc(&pdev->dev, 363 - npins * sizeof(char *), 361 + pctl->funcs[i].groups = devm_kcalloc(&pdev->dev, 362 + npins, sizeof(char *), 364 363 GFP_KERNEL); 365 364 for (pin = 0; pin < npins; pin++) 366 365 pctl->funcs[i].groups[pin] = pctl->desc->pins[pin].name;
+3 -2
drivers/pinctrl/pinctrl-digicolor.c
··· 291 291 if (IS_ERR(pmap->regs)) 292 292 return PTR_ERR(pmap->regs); 293 293 294 - pins = devm_kzalloc(&pdev->dev, sizeof(*pins)*PINS_COUNT, GFP_KERNEL); 294 + pins = devm_kcalloc(&pdev->dev, PINS_COUNT, sizeof(*pins), 295 + GFP_KERNEL); 295 296 if (!pins) 296 297 return -ENOMEM; 297 - pin_names = devm_kzalloc(&pdev->dev, name_len * PINS_COUNT, 298 + pin_names = devm_kcalloc(&pdev->dev, PINS_COUNT, name_len, 298 299 GFP_KERNEL); 299 300 if (!pin_names) 300 301 return -ENOMEM;
+2 -2
drivers/pinctrl/pinctrl-ingenic.c
··· 770 770 pctl_desc->pmxops = &ingenic_pmxops; 771 771 pctl_desc->confops = &ingenic_confops; 772 772 pctl_desc->npins = chip_info->num_chips * PINS_PER_GPIO_CHIP; 773 - pctl_desc->pins = jzpc->pdesc = devm_kzalloc(&pdev->dev, 774 - sizeof(*jzpc->pdesc) * pctl_desc->npins, GFP_KERNEL); 773 + pctl_desc->pins = jzpc->pdesc = devm_kcalloc(&pdev->dev, 774 + pctl_desc->npins, sizeof(*jzpc->pdesc), GFP_KERNEL); 775 775 if (!jzpc->pdesc) 776 776 return -ENOMEM; 777 777
+3 -2
drivers/pinctrl/pinctrl-lpc18xx.c
··· 1308 1308 } 1309 1309 1310 1310 scu->func[func].ngroups = ngroups; 1311 - scu->func[func].groups = devm_kzalloc(dev, ngroups * 1312 - sizeof(char *), GFP_KERNEL); 1311 + scu->func[func].groups = devm_kcalloc(dev, 1312 + ngroups, sizeof(char *), 1313 + GFP_KERNEL); 1313 1314 if (!scu->func[func].groups) 1314 1315 return -ENOMEM; 1315 1316
+2 -1
drivers/pinctrl/pinctrl-ocelot.c
··· 330 330 } 331 331 332 332 info->func[f].ngroups = npins; 333 - info->func[f].groups = devm_kzalloc(dev, npins * 333 + info->func[f].groups = devm_kcalloc(dev, 334 + npins, 334 335 sizeof(char *), 335 336 GFP_KERNEL); 336 337 if (!info->func[f].groups)
+14 -10
drivers/pinctrl/pinctrl-rockchip.c
··· 507 507 } 508 508 509 509 map_num += grp->npins; 510 - new_map = devm_kzalloc(pctldev->dev, sizeof(*new_map) * map_num, 510 + new_map = devm_kcalloc(pctldev->dev, map_num, sizeof(*new_map), 511 511 GFP_KERNEL); 512 512 if (!new_map) 513 513 return -ENOMEM; ··· 2473 2473 2474 2474 grp->npins = size / 4; 2475 2475 2476 - grp->pins = devm_kzalloc(info->dev, grp->npins * sizeof(unsigned int), 2476 + grp->pins = devm_kcalloc(info->dev, grp->npins, sizeof(unsigned int), 2477 2477 GFP_KERNEL); 2478 - grp->data = devm_kzalloc(info->dev, grp->npins * 2479 - sizeof(struct rockchip_pin_config), 2478 + grp->data = devm_kcalloc(info->dev, 2479 + grp->npins, 2480 + sizeof(struct rockchip_pin_config), 2480 2481 GFP_KERNEL); 2481 2482 if (!grp->pins || !grp->data) 2482 2483 return -ENOMEM; ··· 2529 2528 if (func->ngroups <= 0) 2530 2529 return 0; 2531 2530 2532 - func->groups = devm_kzalloc(info->dev, 2533 - func->ngroups * sizeof(char *), GFP_KERNEL); 2531 + func->groups = devm_kcalloc(info->dev, 2532 + func->ngroups, sizeof(char *), GFP_KERNEL); 2534 2533 if (!func->groups) 2535 2534 return -ENOMEM; 2536 2535 ··· 2561 2560 dev_dbg(&pdev->dev, "nfunctions = %d\n", info->nfunctions); 2562 2561 dev_dbg(&pdev->dev, "ngroups = %d\n", info->ngroups); 2563 2562 2564 - info->functions = devm_kzalloc(dev, info->nfunctions * 2563 + info->functions = devm_kcalloc(dev, 2564 + info->nfunctions, 2565 2565 sizeof(struct rockchip_pmx_func), 2566 2566 GFP_KERNEL); 2567 2567 if (!info->functions) 2568 2568 return -EINVAL; 2569 2569 2570 - info->groups = devm_kzalloc(dev, info->ngroups * 2570 + info->groups = devm_kcalloc(dev, 2571 + info->ngroups, 2571 2572 sizeof(struct rockchip_pin_group), 2572 2573 GFP_KERNEL); 2573 2574 if (!info->groups) ··· 2607 2604 ctrldesc->pmxops = &rockchip_pmx_ops; 2608 2605 ctrldesc->confops = &rockchip_pinconf_ops; 2609 2606 2610 - pindesc = devm_kzalloc(&pdev->dev, sizeof(*pindesc) * 2611 - info->ctrl->nr_pins, GFP_KERNEL); 2607 + pindesc = devm_kcalloc(&pdev->dev, 2608 + info->ctrl->nr_pins, sizeof(*pindesc), 2609 + GFP_KERNEL); 2612 2610 if (!pindesc) 2613 2611 return -ENOMEM; 2614 2612
+14 -12
drivers/pinctrl/pinctrl-single.c
··· 712 712 } 713 713 714 714 dev_dbg(pcs->dev, "allocating %i pins\n", nr_pins); 715 - pcs->pins.pa = devm_kzalloc(pcs->dev, 716 - sizeof(*pcs->pins.pa) * nr_pins, 715 + pcs->pins.pa = devm_kcalloc(pcs->dev, 716 + nr_pins, sizeof(*pcs->pins.pa), 717 717 GFP_KERNEL); 718 718 if (!pcs->pins.pa) 719 719 return -ENOMEM; ··· 924 924 if (!nconfs) 925 925 return 0; 926 926 927 - func->conf = devm_kzalloc(pcs->dev, 928 - sizeof(struct pcs_conf_vals) * nconfs, 927 + func->conf = devm_kcalloc(pcs->dev, 928 + nconfs, sizeof(struct pcs_conf_vals), 929 929 GFP_KERNEL); 930 930 if (!func->conf) 931 931 return -ENOMEM; 932 932 func->nconfs = nconfs; 933 933 conf = &(func->conf[0]); 934 934 m++; 935 - settings = devm_kzalloc(pcs->dev, sizeof(unsigned long) * nconfs, 935 + settings = devm_kcalloc(pcs->dev, nconfs, sizeof(unsigned long), 936 936 GFP_KERNEL); 937 937 if (!settings) 938 938 return -ENOMEM; ··· 988 988 return -EINVAL; 989 989 } 990 990 991 - vals = devm_kzalloc(pcs->dev, sizeof(*vals) * rows, GFP_KERNEL); 991 + vals = devm_kcalloc(pcs->dev, rows, sizeof(*vals), GFP_KERNEL); 992 992 if (!vals) 993 993 return -ENOMEM; 994 994 995 - pins = devm_kzalloc(pcs->dev, sizeof(*pins) * rows, GFP_KERNEL); 995 + pins = devm_kcalloc(pcs->dev, rows, sizeof(*pins), GFP_KERNEL); 996 996 if (!pins) 997 997 goto free_vals; 998 998 ··· 1089 1089 1090 1090 npins_in_row = pcs->width / pcs->bits_per_pin; 1091 1091 1092 - vals = devm_kzalloc(pcs->dev, sizeof(*vals) * rows * npins_in_row, 1093 - GFP_KERNEL); 1092 + vals = devm_kzalloc(pcs->dev, 1093 + array3_size(rows, npins_in_row, sizeof(*vals)), 1094 + GFP_KERNEL); 1094 1095 if (!vals) 1095 1096 return -ENOMEM; 1096 1097 1097 - pins = devm_kzalloc(pcs->dev, sizeof(*pins) * rows * npins_in_row, 1098 - GFP_KERNEL); 1098 + pins = devm_kzalloc(pcs->dev, 1099 + array3_size(rows, npins_in_row, sizeof(*pins)), 1100 + GFP_KERNEL); 1099 1101 if (!pins) 1100 1102 goto free_vals; 1101 1103 ··· 1219 1217 pcs = pinctrl_dev_get_drvdata(pctldev); 1220 1218 1221 1219 /* create 2 maps. One is for pinmux, and the other is for pinconf. */ 1222 - *map = devm_kzalloc(pcs->dev, sizeof(**map) * 2, GFP_KERNEL); 1220 + *map = devm_kcalloc(pcs->dev, 2, sizeof(**map), GFP_KERNEL); 1223 1221 if (!*map) 1224 1222 return -ENOMEM; 1225 1223
+16 -15
drivers/pinctrl/pinctrl-st.c
··· 823 823 } 824 824 825 825 map_num = grp->npins + 1; 826 - new_map = devm_kzalloc(pctldev->dev, 827 - sizeof(*new_map) * map_num, GFP_KERNEL); 826 + new_map = devm_kcalloc(pctldev->dev, 827 + map_num, sizeof(*new_map), GFP_KERNEL); 828 828 if (!new_map) 829 829 return -ENOMEM; 830 830 ··· 1191 1191 1192 1192 grp->npins = npins; 1193 1193 grp->name = np->name; 1194 - grp->pins = devm_kzalloc(info->dev, npins * sizeof(u32), GFP_KERNEL); 1195 - grp->pin_conf = devm_kzalloc(info->dev, 1196 - npins * sizeof(*conf), GFP_KERNEL); 1194 + grp->pins = devm_kcalloc(info->dev, npins, sizeof(u32), GFP_KERNEL); 1195 + grp->pin_conf = devm_kcalloc(info->dev, 1196 + npins, sizeof(*conf), GFP_KERNEL); 1197 1197 1198 1198 if (!grp->pins || !grp->pin_conf) 1199 1199 return -ENOMEM; ··· 1249 1249 dev_err(info->dev, "No groups defined\n"); 1250 1250 return -EINVAL; 1251 1251 } 1252 - func->groups = devm_kzalloc(info->dev, 1253 - func->ngroups * sizeof(char *), GFP_KERNEL); 1252 + func->groups = devm_kcalloc(info->dev, 1253 + func->ngroups, sizeof(char *), GFP_KERNEL); 1254 1254 if (!func->groups) 1255 1255 return -ENOMEM; 1256 1256 ··· 1573 1573 dev_info(&pdev->dev, "nfunctions = %d\n", info->nfunctions); 1574 1574 dev_info(&pdev->dev, "ngroups = %d\n", info->ngroups); 1575 1575 1576 - info->functions = devm_kzalloc(&pdev->dev, 1577 - info->nfunctions * sizeof(*info->functions), GFP_KERNEL); 1576 + info->functions = devm_kcalloc(&pdev->dev, 1577 + info->nfunctions, sizeof(*info->functions), GFP_KERNEL); 1578 1578 1579 - info->groups = devm_kzalloc(&pdev->dev, 1580 - info->ngroups * sizeof(*info->groups) , GFP_KERNEL); 1579 + info->groups = devm_kcalloc(&pdev->dev, 1580 + info->ngroups, sizeof(*info->groups), 1581 + GFP_KERNEL); 1581 1582 1582 - info->banks = devm_kzalloc(&pdev->dev, 1583 - info->nbanks * sizeof(*info->banks), GFP_KERNEL); 1583 + info->banks = devm_kcalloc(&pdev->dev, 1584 + info->nbanks, sizeof(*info->banks), GFP_KERNEL); 1584 1585 1585 1586 if (!info->functions || !info->groups || !info->banks) 1586 1587 return -ENOMEM; ··· 1609 1608 } 1610 1609 1611 1610 pctl_desc->npins = info->nbanks * ST_GPIO_PINS_PER_BANK; 1612 - pdesc = devm_kzalloc(&pdev->dev, 1613 - sizeof(*pdesc) * pctl_desc->npins, GFP_KERNEL); 1611 + pdesc = devm_kcalloc(&pdev->dev, 1612 + pctl_desc->npins, sizeof(*pdesc), GFP_KERNEL); 1614 1613 if (!pdesc) 1615 1614 return -ENOMEM; 1616 1615
+2 -2
drivers/pinctrl/pinctrl-xway.c
··· 1727 1727 xway_chip.ngpio = xway_soc->pin_count; 1728 1728 1729 1729 /* load our pad descriptors */ 1730 - xway_info.pads = devm_kzalloc(&pdev->dev, 1731 - sizeof(struct pinctrl_pin_desc) * xway_chip.ngpio, 1730 + xway_info.pads = devm_kcalloc(&pdev->dev, 1731 + xway_chip.ngpio, sizeof(struct pinctrl_pin_desc), 1732 1732 GFP_KERNEL); 1733 1733 if (!xway_info.pads) 1734 1734 return -ENOMEM;
+3 -2
drivers/pinctrl/samsung/pinctrl-exynos.c
··· 491 491 continue; 492 492 } 493 493 494 - weint_data = devm_kzalloc(dev, bank->nr_pins 495 - * sizeof(*weint_data), GFP_KERNEL); 494 + weint_data = devm_kcalloc(dev, 495 + bank->nr_pins, sizeof(*weint_data), 496 + GFP_KERNEL); 496 497 if (!weint_data) 497 498 return -ENOMEM; 498 499
+10 -7
drivers/pinctrl/samsung/pinctrl-samsung.c
··· 674 674 const struct pinctrl_pin_desc *pdesc; 675 675 int i; 676 676 677 - groups = devm_kzalloc(dev, ctrldesc->npins * sizeof(*groups), 677 + groups = devm_kcalloc(dev, ctrldesc->npins, sizeof(*groups), 678 678 GFP_KERNEL); 679 679 if (!groups) 680 680 return ERR_PTR(-EINVAL); ··· 711 711 712 712 func->name = func_np->full_name; 713 713 714 - func->groups = devm_kzalloc(dev, npins * sizeof(char *), GFP_KERNEL); 714 + func->groups = devm_kcalloc(dev, npins, sizeof(char *), GFP_KERNEL); 715 715 if (!func->groups) 716 716 return -ENOMEM; 717 717 ··· 768 768 } 769 769 } 770 770 771 - functions = devm_kzalloc(dev, func_cnt * sizeof(*functions), 771 + functions = devm_kcalloc(dev, func_cnt, sizeof(*functions), 772 772 GFP_KERNEL); 773 773 if (!functions) 774 774 return ERR_PTR(-ENOMEM); ··· 860 860 ctrldesc->pmxops = &samsung_pinmux_ops; 861 861 ctrldesc->confops = &samsung_pinconf_ops; 862 862 863 - pindesc = devm_kzalloc(&pdev->dev, sizeof(*pindesc) * 864 - drvdata->nr_pins, GFP_KERNEL); 863 + pindesc = devm_kcalloc(&pdev->dev, 864 + drvdata->nr_pins, sizeof(*pindesc), 865 + GFP_KERNEL); 865 866 if (!pindesc) 866 867 return -ENOMEM; 867 868 ctrldesc->pins = pindesc; ··· 876 875 * allocate space for storing the dynamically generated names for all 877 876 * the pins which belong to this pin-controller. 878 877 */ 879 - pin_names = devm_kzalloc(&pdev->dev, sizeof(char) * PIN_NAME_LENGTH * 880 - drvdata->nr_pins, GFP_KERNEL); 878 + pin_names = devm_kzalloc(&pdev->dev, 879 + array3_size(sizeof(char), PIN_NAME_LENGTH, 880 + drvdata->nr_pins), 881 + GFP_KERNEL); 881 882 if (!pin_names) 882 883 return -ENOMEM; 883 884
+3 -3
drivers/pinctrl/sh-pfc/core.c
··· 57 57 return -EINVAL; 58 58 59 59 /* Allocate memory windows and IRQs arrays. */ 60 - windows = devm_kzalloc(pfc->dev, num_windows * sizeof(*windows), 60 + windows = devm_kcalloc(pfc->dev, num_windows, sizeof(*windows), 61 61 GFP_KERNEL); 62 62 if (windows == NULL) 63 63 return -ENOMEM; ··· 66 66 pfc->windows = windows; 67 67 68 68 if (num_irqs) { 69 - irqs = devm_kzalloc(pfc->dev, num_irqs * sizeof(*irqs), 69 + irqs = devm_kcalloc(pfc->dev, num_irqs, sizeof(*irqs), 70 70 GFP_KERNEL); 71 71 if (irqs == NULL) 72 72 return -ENOMEM; ··· 444 444 } 445 445 446 446 pfc->nr_ranges = nr_ranges; 447 - pfc->ranges = devm_kzalloc(pfc->dev, sizeof(*pfc->ranges) * nr_ranges, 447 + pfc->ranges = devm_kcalloc(pfc->dev, nr_ranges, sizeof(*pfc->ranges), 448 448 GFP_KERNEL); 449 449 if (pfc->ranges == NULL) 450 450 return -ENOMEM;
+4 -3
drivers/pinctrl/sh-pfc/gpio.c
··· 107 107 for (i = 0; pfc->info->data_regs[i].reg_width; ++i) 108 108 ; 109 109 110 - chip->regs = devm_kzalloc(pfc->dev, i * sizeof(*chip->regs), 110 + chip->regs = devm_kcalloc(pfc->dev, i, sizeof(*chip->regs), 111 111 GFP_KERNEL); 112 112 if (chip->regs == NULL) 113 113 return -ENOMEM; ··· 224 224 struct gpio_chip *gc = &chip->gpio_chip; 225 225 int ret; 226 226 227 - chip->pins = devm_kzalloc(pfc->dev, pfc->info->nr_pins * 228 - sizeof(*chip->pins), GFP_KERNEL); 227 + chip->pins = devm_kcalloc(pfc->dev, 228 + pfc->info->nr_pins, sizeof(*chip->pins), 229 + GFP_KERNEL); 229 230 if (chip->pins == NULL) 230 231 return -ENOMEM; 231 232
+4 -4
drivers/pinctrl/sh-pfc/pinctrl.c
··· 770 770 unsigned int i; 771 771 772 772 /* Allocate and initialize the pins and configs arrays. */ 773 - pmx->pins = devm_kzalloc(pfc->dev, 774 - sizeof(*pmx->pins) * pfc->info->nr_pins, 773 + pmx->pins = devm_kcalloc(pfc->dev, 774 + pfc->info->nr_pins, sizeof(*pmx->pins), 775 775 GFP_KERNEL); 776 776 if (unlikely(!pmx->pins)) 777 777 return -ENOMEM; 778 778 779 - pmx->configs = devm_kzalloc(pfc->dev, 780 - sizeof(*pmx->configs) * pfc->info->nr_pins, 779 + pmx->configs = devm_kcalloc(pfc->dev, 780 + pfc->info->nr_pins, sizeof(*pmx->configs), 781 781 GFP_KERNEL); 782 782 if (unlikely(!pmx->configs)) 783 783 return -ENOMEM;
+2 -2
drivers/pinctrl/spear/pinctrl-plgpio.c
··· 538 538 dev_warn(&pdev->dev, "clk_get() failed, work without it\n"); 539 539 540 540 #ifdef CONFIG_PM_SLEEP 541 - plgpio->csave_regs = devm_kzalloc(&pdev->dev, 542 - sizeof(*plgpio->csave_regs) * 541 + plgpio->csave_regs = devm_kcalloc(&pdev->dev, 543 542 DIV_ROUND_UP(plgpio->chip.ngpio, MAX_GPIO_PER_REG), 543 + sizeof(*plgpio->csave_regs), 544 544 GFP_KERNEL); 545 545 if (!plgpio->csave_regs) 546 546 return -ENOMEM;
+11 -8
drivers/pinctrl/sprd/pinctrl-sprd.c
··· 879 879 880 880 grp->name = np->name; 881 881 grp->npins = ret; 882 - grp->pins = devm_kzalloc(sprd_pctl->dev, grp->npins * 883 - sizeof(unsigned int), GFP_KERNEL); 882 + grp->pins = devm_kcalloc(sprd_pctl->dev, 883 + grp->npins, sizeof(unsigned int), 884 + GFP_KERNEL); 884 885 if (!grp->pins) 885 886 return -ENOMEM; 886 887 ··· 932 931 if (!info->ngroups) 933 932 return 0; 934 933 935 - info->groups = devm_kzalloc(sprd_pctl->dev, info->ngroups * 934 + info->groups = devm_kcalloc(sprd_pctl->dev, 935 + info->ngroups, 936 936 sizeof(struct sprd_pin_group), 937 937 GFP_KERNEL); 938 938 if (!info->groups) 939 939 return -ENOMEM; 940 940 941 - info->grp_names = devm_kzalloc(sprd_pctl->dev, 942 - info->ngroups * sizeof(char *), 941 + info->grp_names = devm_kcalloc(sprd_pctl->dev, 942 + info->ngroups, sizeof(char *), 943 943 GFP_KERNEL); 944 944 if (!info->grp_names) 945 945 return -ENOMEM; ··· 982 980 int i; 983 981 984 982 info->npins = pins_cnt; 985 - info->pins = devm_kzalloc(sprd_pctl->dev, 986 - info->npins * sizeof(struct sprd_pin), 983 + info->pins = devm_kcalloc(sprd_pctl->dev, 984 + info->npins, sizeof(struct sprd_pin), 987 985 GFP_KERNEL); 988 986 if (!info->pins) 989 987 return -ENOMEM; ··· 1059 1057 return ret; 1060 1058 } 1061 1059 1062 - pin_desc = devm_kzalloc(&pdev->dev, pinctrl_info->npins * 1060 + pin_desc = devm_kcalloc(&pdev->dev, 1061 + pinctrl_info->npins, 1063 1062 sizeof(struct pinctrl_pin_desc), 1064 1063 GFP_KERNEL); 1065 1064 if (!pin_desc)
+10 -8
drivers/pinctrl/sunxi/pinctrl-sunxi.c
··· 1055 1055 * this means that the number of pins is the maximum group 1056 1056 * number we will ever see. 1057 1057 */ 1058 - pctl->groups = devm_kzalloc(&pdev->dev, 1059 - pctl->desc->npins * sizeof(*pctl->groups), 1058 + pctl->groups = devm_kcalloc(&pdev->dev, 1059 + pctl->desc->npins, sizeof(*pctl->groups), 1060 1060 GFP_KERNEL); 1061 1061 if (!pctl->groups) 1062 1062 return -ENOMEM; ··· 1079 1079 * We suppose that we won't have any more functions than pins, 1080 1080 * we'll reallocate that later anyway 1081 1081 */ 1082 - pctl->functions = devm_kzalloc(&pdev->dev, 1083 - pctl->ngroups * sizeof(*pctl->functions), 1082 + pctl->functions = devm_kcalloc(&pdev->dev, 1083 + pctl->ngroups, 1084 + sizeof(*pctl->functions), 1084 1085 GFP_KERNEL); 1085 1086 if (!pctl->functions) 1086 1087 return -ENOMEM; ··· 1138 1137 1139 1138 if (!func_item->groups) { 1140 1139 func_item->groups = 1141 - devm_kzalloc(&pdev->dev, 1142 - func_item->ngroups * sizeof(*func_item->groups), 1140 + devm_kcalloc(&pdev->dev, 1141 + func_item->ngroups, 1142 + sizeof(*func_item->groups), 1143 1143 GFP_KERNEL); 1144 1144 if (!func_item->groups) 1145 1145 return -ENOMEM; ··· 1283 1281 return ret; 1284 1282 } 1285 1283 1286 - pins = devm_kzalloc(&pdev->dev, 1287 - pctl->desc->npins * sizeof(*pins), 1284 + pins = devm_kcalloc(&pdev->dev, 1285 + pctl->desc->npins, sizeof(*pins), 1288 1286 GFP_KERNEL); 1289 1287 if (!pins) 1290 1288 return -ENOMEM;
+3 -3
drivers/pinctrl/tegra/pinctrl-tegra.c
··· 665 665 * Each mux group will appear in 4 functions' list of groups. 666 666 * This over-allocates slightly, since not all groups are mux groups. 667 667 */ 668 - pmx->group_pins = devm_kzalloc(&pdev->dev, 669 - soc_data->ngroups * 4 * sizeof(*pmx->group_pins), 668 + pmx->group_pins = devm_kcalloc(&pdev->dev, 669 + soc_data->ngroups * 4, sizeof(*pmx->group_pins), 670 670 GFP_KERNEL); 671 671 if (!pmx->group_pins) 672 672 return -ENOMEM; ··· 708 708 } 709 709 pmx->nbanks = i; 710 710 711 - pmx->regs = devm_kzalloc(&pdev->dev, pmx->nbanks * sizeof(*pmx->regs), 711 + pmx->regs = devm_kcalloc(&pdev->dev, pmx->nbanks, sizeof(*pmx->regs), 712 712 GFP_KERNEL); 713 713 if (!pmx->regs) 714 714 return -ENOMEM;
+3 -3
drivers/pinctrl/ti/pinctrl-ti-iodelay.c
··· 510 510 goto free_map; 511 511 } 512 512 513 - pins = devm_kzalloc(iod->dev, sizeof(*pins) * rows, GFP_KERNEL); 513 + pins = devm_kcalloc(iod->dev, rows, sizeof(*pins), GFP_KERNEL); 514 514 if (!pins) 515 515 goto free_group; 516 516 517 - cfg = devm_kzalloc(iod->dev, sizeof(*cfg) * rows, GFP_KERNEL); 517 + cfg = devm_kcalloc(iod->dev, rows, sizeof(*cfg), GFP_KERNEL); 518 518 if (!cfg) { 519 519 error = -ENOMEM; 520 520 goto free_pins; ··· 749 749 nr_pins = ti_iodelay_offset_to_pin(iod, r->regmap_config->max_register); 750 750 dev_dbg(dev, "Allocating %i pins\n", nr_pins); 751 751 752 - iod->pa = devm_kzalloc(dev, sizeof(*iod->pa) * nr_pins, GFP_KERNEL); 752 + iod->pa = devm_kcalloc(dev, nr_pins, sizeof(*iod->pa), GFP_KERNEL); 753 753 if (!iod->pa) 754 754 return -ENOMEM; 755 755
+3 -3
drivers/pinctrl/zte/pinctrl-zx.c
··· 277 277 278 278 /* Every single pin composes a group */ 279 279 ngroups = info->npins; 280 - groups = devm_kzalloc(&pdev->dev, ngroups * sizeof(*groups), 280 + groups = devm_kcalloc(&pdev->dev, ngroups, sizeof(*groups), 281 281 GFP_KERNEL); 282 282 if (!groups) 283 283 return -ENOMEM; ··· 362 362 363 363 func = functions + j; 364 364 if (!func->group_names) { 365 - func->group_names = devm_kzalloc(&pdev->dev, 366 - func->num_group_names * 365 + func->group_names = devm_kcalloc(&pdev->dev, 366 + func->num_group_names, 367 367 sizeof(*func->group_names), 368 368 GFP_KERNEL); 369 369 if (!func->group_names) {
+2 -1
drivers/platform/mellanox/mlxreg-hotplug.c
··· 217 217 } 218 218 } 219 219 220 - priv->group.attrs = devm_kzalloc(&priv->pdev->dev, num_attrs * 220 + priv->group.attrs = devm_kcalloc(&priv->pdev->dev, 221 + num_attrs, 221 222 sizeof(struct attribute *), 222 223 GFP_KERNEL); 223 224 if (!priv->group.attrs)
+17 -12
drivers/power/supply/charger-manager.c
··· 1380 1380 1381 1381 snprintf(buf, 10, "charger.%d", i); 1382 1382 str = devm_kzalloc(cm->dev, 1383 - sizeof(char) * (strlen(buf) + 1), GFP_KERNEL); 1383 + strlen(buf) + 1, GFP_KERNEL); 1384 1384 if (!str) 1385 1385 return -ENOMEM; 1386 1386 ··· 1522 1522 of_property_read_u32(np, "cm-num-chargers", &num_chgs); 1523 1523 if (num_chgs) { 1524 1524 /* Allocate empty bin at the tail of array */ 1525 - desc->psy_charger_stat = devm_kzalloc(dev, sizeof(char *) 1526 - * (num_chgs + 1), GFP_KERNEL); 1525 + desc->psy_charger_stat = devm_kcalloc(dev, 1526 + num_chgs + 1, 1527 + sizeof(char *), 1528 + GFP_KERNEL); 1527 1529 if (desc->psy_charger_stat) { 1528 1530 int i; 1529 1531 for (i = 0; i < num_chgs; i++) ··· 1557 1555 struct charger_regulator *chg_regs; 1558 1556 struct device_node *child; 1559 1557 1560 - chg_regs = devm_kzalloc(dev, sizeof(*chg_regs) 1561 - * desc->num_charger_regulators, 1558 + chg_regs = devm_kcalloc(dev, 1559 + desc->num_charger_regulators, 1560 + sizeof(*chg_regs), 1562 1561 GFP_KERNEL); 1563 1562 if (!chg_regs) 1564 1563 return ERR_PTR(-ENOMEM); ··· 1576 1573 /* charger cables */ 1577 1574 chg_regs->num_cables = of_get_child_count(child); 1578 1575 if (chg_regs->num_cables) { 1579 - cables = devm_kzalloc(dev, sizeof(*cables) 1580 - * chg_regs->num_cables, 1581 - GFP_KERNEL); 1576 + cables = devm_kcalloc(dev, 1577 + chg_regs->num_cables, 1578 + sizeof(*cables), 1579 + GFP_KERNEL); 1582 1580 if (!cables) { 1583 1581 of_node_put(child); 1584 1582 return ERR_PTR(-ENOMEM); ··· 1729 1725 cm->charger_psy_desc.name = cm->psy_name_buf; 1730 1726 1731 1727 /* Allocate for psy properties because they may vary */ 1732 - cm->charger_psy_desc.properties = devm_kzalloc(&pdev->dev, 1733 - sizeof(enum power_supply_property) 1734 - * (ARRAY_SIZE(default_charger_props) + 1735 - NUM_CHARGER_PSY_OPTIONAL), GFP_KERNEL); 1728 + cm->charger_psy_desc.properties = 1729 + devm_kcalloc(&pdev->dev, 1730 + ARRAY_SIZE(default_charger_props) + 1731 + NUM_CHARGER_PSY_OPTIONAL, 1732 + sizeof(enum power_supply_property), GFP_KERNEL); 1736 1733 if (!cm->charger_psy_desc.properties) 1737 1734 return -ENOMEM; 1738 1735
+2 -2
drivers/power/supply/power_supply_core.c
··· 263 263 if (!psy->supplied_from) 264 264 return -ENOMEM; 265 265 266 - *psy->supplied_from = devm_kzalloc(&psy->dev, 267 - sizeof(char *) * (cnt - 1), 266 + *psy->supplied_from = devm_kcalloc(&psy->dev, 267 + cnt - 1, sizeof(char *), 268 268 GFP_KERNEL); 269 269 if (!*psy->supplied_from) 270 270 return -ENOMEM;
+1 -1
drivers/pwm/pwm-lp3943.c
··· 225 225 if (num_outputs == 0) 226 226 continue; 227 227 228 - output = devm_kzalloc(dev, sizeof(*output) * num_outputs, 228 + output = devm_kcalloc(dev, num_outputs, sizeof(*output), 229 229 GFP_KERNEL); 230 230 if (!output) 231 231 return -ENOMEM;
+4 -3
drivers/regulator/act8865-regulator.c
··· 424 424 if (matched <= 0) 425 425 return matched; 426 426 427 - pdata->regulators = devm_kzalloc(dev, 428 - sizeof(struct act8865_regulator_data) * 429 - num_matches, GFP_KERNEL); 427 + pdata->regulators = devm_kcalloc(dev, 428 + num_matches, 429 + sizeof(struct act8865_regulator_data), 430 + GFP_KERNEL); 430 431 if (!pdata->regulators) 431 432 return -ENOMEM; 432 433
+4 -2
drivers/regulator/as3711-regulator.c
··· 239 239 } 240 240 } 241 241 242 - regs = devm_kzalloc(&pdev->dev, AS3711_REGULATOR_NUM * 243 - sizeof(struct as3711_regulator), GFP_KERNEL); 242 + regs = devm_kcalloc(&pdev->dev, 243 + AS3711_REGULATOR_NUM, 244 + sizeof(struct as3711_regulator), 245 + GFP_KERNEL); 244 246 if (!regs) 245 247 return -ENOMEM; 246 248
+4 -2
drivers/regulator/bcm590xx-regulator.c
··· 383 383 384 384 platform_set_drvdata(pdev, pmu); 385 385 386 - pmu->desc = devm_kzalloc(&pdev->dev, BCM590XX_NUM_REGS * 387 - sizeof(struct regulator_desc), GFP_KERNEL); 386 + pmu->desc = devm_kcalloc(&pdev->dev, 387 + BCM590XX_NUM_REGS, 388 + sizeof(struct regulator_desc), 389 + GFP_KERNEL); 388 390 if (!pmu->desc) 389 391 return -ENOMEM; 390 392
+2 -2
drivers/regulator/da9063-regulator.c
··· 681 681 if (!pdata) 682 682 return ERR_PTR(-ENOMEM); 683 683 684 - pdata->regulator_data = devm_kzalloc(&pdev->dev, 685 - num * sizeof(*pdata->regulator_data), 684 + pdata->regulator_data = devm_kcalloc(&pdev->dev, 685 + num, sizeof(*pdata->regulator_data), 686 686 GFP_KERNEL); 687 687 if (!pdata->regulator_data) 688 688 return ERR_PTR(-ENOMEM);
+5 -5
drivers/regulator/gpio-regulator.c
··· 172 172 173 173 if (ret > 0) { 174 174 config->nr_gpios = ret; 175 - config->gpios = devm_kzalloc(dev, 176 - sizeof(struct gpio) * config->nr_gpios, 175 + config->gpios = devm_kcalloc(dev, 176 + config->nr_gpios, sizeof(struct gpio), 177 177 GFP_KERNEL); 178 178 if (!config->gpios) 179 179 return ERR_PTR(-ENOMEM); ··· 214 214 return ERR_PTR(-EINVAL); 215 215 } 216 216 217 - config->states = devm_kzalloc(dev, 218 - sizeof(struct gpio_regulator_state) 219 - * (proplen / 2), 217 + config->states = devm_kcalloc(dev, 218 + proplen / 2, 219 + sizeof(struct gpio_regulator_state), 220 220 GFP_KERNEL); 221 221 if (!config->states) 222 222 return ERR_PTR(-ENOMEM);
+4 -2
drivers/regulator/max1586.c
··· 194 194 if (matched <= 0) 195 195 return matched; 196 196 197 - pdata->subdevs = devm_kzalloc(dev, sizeof(struct max1586_subdev_data) * 198 - matched, GFP_KERNEL); 197 + pdata->subdevs = devm_kcalloc(dev, 198 + matched, 199 + sizeof(struct max1586_subdev_data), 200 + GFP_KERNEL); 199 201 if (!pdata->subdevs) 200 202 return -ENOMEM; 201 203
+4 -2
drivers/regulator/max8660.c
··· 351 351 if (matched <= 0) 352 352 return matched; 353 353 354 - pdata->subdevs = devm_kzalloc(dev, sizeof(struct max8660_subdev_data) * 355 - matched, GFP_KERNEL); 354 + pdata->subdevs = devm_kcalloc(dev, 355 + matched, 356 + sizeof(struct max8660_subdev_data), 357 + GFP_KERNEL); 356 358 if (!pdata->subdevs) 357 359 return -ENOMEM; 358 360
+3 -2
drivers/regulator/max8997-regulator.c
··· 929 929 /* count the number of regulators to be supported in pmic */ 930 930 pdata->num_regulators = of_get_child_count(regulators_np); 931 931 932 - rdata = devm_kzalloc(&pdev->dev, sizeof(*rdata) * 933 - pdata->num_regulators, GFP_KERNEL); 932 + rdata = devm_kcalloc(&pdev->dev, 933 + pdata->num_regulators, sizeof(*rdata), 934 + GFP_KERNEL); 934 935 if (!rdata) { 935 936 of_node_put(regulators_np); 936 937 return -ENOMEM;
+3 -2
drivers/regulator/max8998.c
··· 670 670 /* count the number of regulators to be supported in pmic */ 671 671 pdata->num_regulators = of_get_child_count(regulators_np); 672 672 673 - rdata = devm_kzalloc(iodev->dev, sizeof(*rdata) * 674 - pdata->num_regulators, GFP_KERNEL); 673 + rdata = devm_kcalloc(iodev->dev, 674 + pdata->num_regulators, sizeof(*rdata), 675 + GFP_KERNEL); 675 676 if (!rdata) { 676 677 of_node_put(regulators_np); 677 678 return -ENOMEM;
+1 -1
drivers/regulator/mc13xxx-regulator-core.c
··· 171 171 if (!parent) 172 172 return NULL; 173 173 174 - data = devm_kzalloc(&pdev->dev, sizeof(*data) * priv->num_regulators, 174 + data = devm_kcalloc(&pdev->dev, priv->num_regulators, sizeof(*data), 175 175 GFP_KERNEL); 176 176 if (!data) { 177 177 of_node_put(parent);
+3 -2
drivers/regulator/pbias-regulator.c
··· 173 173 if (count < 0) 174 174 return count; 175 175 176 - drvdata = devm_kzalloc(&pdev->dev, sizeof(struct pbias_regulator_data) 177 - * count, GFP_KERNEL); 176 + drvdata = devm_kcalloc(&pdev->dev, 177 + count, sizeof(struct pbias_regulator_data), 178 + GFP_KERNEL); 178 179 if (!drvdata) 179 180 return -ENOMEM; 180 181
+4 -2
drivers/regulator/rc5t583-regulator.c
··· 132 132 return -ENODEV; 133 133 } 134 134 135 - regs = devm_kzalloc(&pdev->dev, RC5T583_REGULATOR_MAX * 136 - sizeof(struct rc5t583_regulator), GFP_KERNEL); 135 + regs = devm_kcalloc(&pdev->dev, 136 + RC5T583_REGULATOR_MAX, 137 + sizeof(struct rc5t583_regulator), 138 + GFP_KERNEL); 137 139 if (!regs) 138 140 return -ENOMEM; 139 141
+6 -4
drivers/regulator/s5m8767.c
··· 553 553 /* count the number of regulators to be supported in pmic */ 554 554 pdata->num_regulators = of_get_child_count(regulators_np); 555 555 556 - rdata = devm_kzalloc(&pdev->dev, sizeof(*rdata) * 557 - pdata->num_regulators, GFP_KERNEL); 556 + rdata = devm_kcalloc(&pdev->dev, 557 + pdata->num_regulators, sizeof(*rdata), 558 + GFP_KERNEL); 558 559 if (!rdata) 559 560 return -ENOMEM; 560 561 561 - rmode = devm_kzalloc(&pdev->dev, sizeof(*rmode) * 562 - pdata->num_regulators, GFP_KERNEL); 562 + rmode = devm_kcalloc(&pdev->dev, 563 + pdata->num_regulators, sizeof(*rmode), 564 + GFP_KERNEL); 563 565 if (!rmode) 564 566 return -ENOMEM; 565 567
+2 -2
drivers/regulator/ti-abb-regulator.c
··· 532 532 } 533 533 num_entries /= num_values; 534 534 535 - info = devm_kzalloc(dev, sizeof(*info) * num_entries, GFP_KERNEL); 535 + info = devm_kcalloc(dev, num_entries, sizeof(*info), GFP_KERNEL); 536 536 if (!info) 537 537 return -ENOMEM; 538 538 539 539 abb->info = info; 540 540 541 - volt_table = devm_kzalloc(dev, sizeof(unsigned int) * num_entries, 541 + volt_table = devm_kcalloc(dev, num_entries, sizeof(unsigned int), 542 542 GFP_KERNEL); 543 543 if (!volt_table) 544 544 return -ENOMEM;
+6 -4
drivers/regulator/tps65090-regulator.c
··· 331 331 if (!tps65090_pdata) 332 332 return ERR_PTR(-ENOMEM); 333 333 334 - reg_pdata = devm_kzalloc(&pdev->dev, TPS65090_REGULATOR_MAX * 335 - sizeof(*reg_pdata), GFP_KERNEL); 334 + reg_pdata = devm_kcalloc(&pdev->dev, 335 + TPS65090_REGULATOR_MAX, sizeof(*reg_pdata), 336 + GFP_KERNEL); 336 337 if (!reg_pdata) 337 338 return ERR_PTR(-ENOMEM); 338 339 ··· 430 429 return tps65090_pdata ? PTR_ERR(tps65090_pdata) : -EINVAL; 431 430 } 432 431 433 - pmic = devm_kzalloc(&pdev->dev, TPS65090_REGULATOR_MAX * sizeof(*pmic), 434 - GFP_KERNEL); 432 + pmic = devm_kcalloc(&pdev->dev, 433 + TPS65090_REGULATOR_MAX, sizeof(*pmic), 434 + GFP_KERNEL); 435 435 if (!pmic) 436 436 return -ENOMEM; 437 437
+3 -2
drivers/regulator/tps65217-regulator.c
··· 229 229 unsigned int val; 230 230 231 231 /* Allocate memory for strobes */ 232 - tps->strobes = devm_kzalloc(&pdev->dev, sizeof(u8) * 233 - TPS65217_NUM_REGULATOR, GFP_KERNEL); 232 + tps->strobes = devm_kcalloc(&pdev->dev, 233 + TPS65217_NUM_REGULATOR, sizeof(u8), 234 + GFP_KERNEL); 234 235 235 236 platform_set_drvdata(pdev, tps); 236 237
+3 -2
drivers/regulator/tps65218-regulator.c
··· 324 324 config.regmap = tps->regmap; 325 325 326 326 /* Allocate memory for strobes */ 327 - tps->strobes = devm_kzalloc(&pdev->dev, sizeof(u8) * 328 - TPS65218_NUM_REGULATOR, GFP_KERNEL); 327 + tps->strobes = devm_kcalloc(&pdev->dev, 328 + TPS65218_NUM_REGULATOR, sizeof(u8), 329 + GFP_KERNEL); 329 330 if (!tps->strobes) 330 331 return -ENOMEM; 331 332
+12 -6
drivers/regulator/tps65910-regulator.c
··· 1131 1131 return -ENODEV; 1132 1132 } 1133 1133 1134 - pmic->desc = devm_kzalloc(&pdev->dev, pmic->num_regulators * 1135 - sizeof(struct regulator_desc), GFP_KERNEL); 1134 + pmic->desc = devm_kcalloc(&pdev->dev, 1135 + pmic->num_regulators, 1136 + sizeof(struct regulator_desc), 1137 + GFP_KERNEL); 1136 1138 if (!pmic->desc) 1137 1139 return -ENOMEM; 1138 1140 1139 - pmic->info = devm_kzalloc(&pdev->dev, pmic->num_regulators * 1140 - sizeof(struct tps_info *), GFP_KERNEL); 1141 + pmic->info = devm_kcalloc(&pdev->dev, 1142 + pmic->num_regulators, 1143 + sizeof(struct tps_info *), 1144 + GFP_KERNEL); 1141 1145 if (!pmic->info) 1142 1146 return -ENOMEM; 1143 1147 1144 - pmic->rdev = devm_kzalloc(&pdev->dev, pmic->num_regulators * 1145 - sizeof(struct regulator_dev *), GFP_KERNEL); 1148 + pmic->rdev = devm_kcalloc(&pdev->dev, 1149 + pmic->num_regulators, 1150 + sizeof(struct regulator_dev *), 1151 + GFP_KERNEL); 1146 1152 if (!pmic->rdev) 1147 1153 return -ENOMEM; 1148 1154
+2 -2
drivers/regulator/tps80031-regulator.c
··· 691 691 return -EINVAL; 692 692 } 693 693 694 - pmic = devm_kzalloc(&pdev->dev, 695 - TPS80031_REGULATOR_MAX * sizeof(*pmic), GFP_KERNEL); 694 + pmic = devm_kcalloc(&pdev->dev, 695 + TPS80031_REGULATOR_MAX, sizeof(*pmic), GFP_KERNEL); 696 696 if (!pmic) 697 697 return -ENOMEM; 698 698
+2 -1
drivers/reset/reset-ti-syscon.c
··· 189 189 } 190 190 191 191 nr_controls = (size / sizeof(*list)) / 7; 192 - controls = devm_kzalloc(dev, nr_controls * sizeof(*controls), GFP_KERNEL); 192 + controls = devm_kcalloc(dev, nr_controls, sizeof(*controls), 193 + GFP_KERNEL); 193 194 if (!controls) 194 195 return -ENOMEM; 195 196
+4 -4
drivers/scsi/isci/init.c
··· 232 232 struct asd_sas_phy **sas_phys; 233 233 struct asd_sas_port **sas_ports; 234 234 235 - sas_phys = devm_kzalloc(&isci_host->pdev->dev, 236 - SCI_MAX_PHYS * sizeof(void *), 235 + sas_phys = devm_kcalloc(&isci_host->pdev->dev, 236 + SCI_MAX_PHYS, sizeof(void *), 237 237 GFP_KERNEL); 238 238 if (!sas_phys) 239 239 return -ENOMEM; 240 240 241 - sas_ports = devm_kzalloc(&isci_host->pdev->dev, 242 - SCI_MAX_PORTS * sizeof(void *), 241 + sas_ports = devm_kcalloc(&isci_host->pdev->dev, 242 + SCI_MAX_PORTS, sizeof(void *), 243 243 GFP_KERNEL); 244 244 if (!sas_ports) 245 245 return -ENOMEM;
+2 -2
drivers/scsi/ufs/ufshcd-pltfrm.c
··· 86 86 goto out; 87 87 } 88 88 89 - clkfreq = devm_kzalloc(dev, sz * sizeof(*clkfreq), 90 - GFP_KERNEL); 89 + clkfreq = devm_kcalloc(dev, sz, sizeof(*clkfreq), 90 + GFP_KERNEL); 91 91 if (!clkfreq) { 92 92 ret = -ENOMEM; 93 93 goto out;
+2 -2
drivers/scsi/ufs/ufshcd.c
··· 3357 3357 } 3358 3358 3359 3359 /* Allocate memory for local reference block */ 3360 - hba->lrb = devm_kzalloc(hba->dev, 3361 - hba->nutrs * sizeof(struct ufshcd_lrb), 3360 + hba->lrb = devm_kcalloc(hba->dev, 3361 + hba->nutrs, sizeof(struct ufshcd_lrb), 3362 3362 GFP_KERNEL); 3363 3363 if (!hba->lrb) { 3364 3364 dev_err(hba->dev, "LRB Memory allocation failed\n");
+4 -2
drivers/soc/bcm/raspberrypi-power.c
··· 165 165 return -ENOMEM; 166 166 167 167 rpi_domains->xlate.domains = 168 - devm_kzalloc(dev, sizeof(*rpi_domains->xlate.domains) * 169 - RPI_POWER_DOMAIN_COUNT, GFP_KERNEL); 168 + devm_kcalloc(dev, 169 + RPI_POWER_DOMAIN_COUNT, 170 + sizeof(*rpi_domains->xlate.domains), 171 + GFP_KERNEL); 170 172 if (!rpi_domains->xlate.domains) 171 173 return -ENOMEM; 172 174
+4 -4
drivers/soc/mediatek/mtk-scpsys.c
··· 407 407 if (IS_ERR(scp->base)) 408 408 return ERR_CAST(scp->base); 409 409 410 - scp->domains = devm_kzalloc(&pdev->dev, 411 - sizeof(*scp->domains) * num, GFP_KERNEL); 410 + scp->domains = devm_kcalloc(&pdev->dev, 411 + num, sizeof(*scp->domains), GFP_KERNEL); 412 412 if (!scp->domains) 413 413 return ERR_PTR(-ENOMEM); 414 414 415 415 pd_data = &scp->pd_data; 416 416 417 - pd_data->domains = devm_kzalloc(&pdev->dev, 418 - sizeof(*pd_data->domains) * num, GFP_KERNEL); 417 + pd_data->domains = devm_kcalloc(&pdev->dev, 418 + num, sizeof(*pd_data->domains), GFP_KERNEL); 419 419 if (!pd_data->domains) 420 420 return ERR_PTR(-ENOMEM); 421 421
+3 -3
drivers/soc/ti/knav_qmss_acc.c
··· 405 405 { 406 406 unsigned id = kq->id - range->queue_base; 407 407 408 - kq->descs = devm_kzalloc(range->kdev->dev, 409 - ACC_DESCS_MAX * sizeof(u32), GFP_KERNEL); 408 + kq->descs = devm_kcalloc(range->kdev->dev, 409 + ACC_DESCS_MAX, sizeof(u32), GFP_KERNEL); 410 410 if (!kq->descs) 411 411 return -ENOMEM; 412 412 ··· 552 552 info->list_size = list_size; 553 553 mem_size = PAGE_ALIGN(list_size * 2); 554 554 info->mem_size = mem_size; 555 - range->acc = devm_kzalloc(kdev->dev, channels * sizeof(*range->acc), 555 + range->acc = devm_kcalloc(kdev->dev, channels, sizeof(*range->acc), 556 556 GFP_KERNEL); 557 557 if (!range->acc) 558 558 return -ENOMEM;
+4 -3
drivers/spi/spi-davinci.c
··· 923 923 /* pdata in dspi is now updated and point pdata to that */ 924 924 pdata = &dspi->pdata; 925 925 926 - dspi->bytes_per_word = devm_kzalloc(&pdev->dev, 927 - sizeof(*dspi->bytes_per_word) * 928 - pdata->num_chipselect, GFP_KERNEL); 926 + dspi->bytes_per_word = devm_kcalloc(&pdev->dev, 927 + pdata->num_chipselect, 928 + sizeof(*dspi->bytes_per_word), 929 + GFP_KERNEL); 929 930 if (dspi->bytes_per_word == NULL) { 930 931 ret = -ENOMEM; 931 932 goto free_master;
+2 -2
drivers/spi/spi-ep93xx.c
··· 671 671 master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 16); 672 672 673 673 master->num_chipselect = info->num_chipselect; 674 - master->cs_gpios = devm_kzalloc(&master->dev, 675 - sizeof(int) * master->num_chipselect, 674 + master->cs_gpios = devm_kcalloc(&master->dev, 675 + master->num_chipselect, sizeof(int), 676 676 GFP_KERNEL); 677 677 if (!master->cs_gpios) { 678 678 error = -ENOMEM;
+3 -2
drivers/spi/spi-gpio.c
··· 373 373 374 374 spi_gpio = spi_master_get_devdata(master); 375 375 376 - spi_gpio->cs_gpios = devm_kzalloc(&pdev->dev, 377 - pdata->num_chipselect * sizeof(*spi_gpio->cs_gpios), 376 + spi_gpio->cs_gpios = devm_kcalloc(&pdev->dev, 377 + pdata->num_chipselect, 378 + sizeof(*spi_gpio->cs_gpios), 378 379 GFP_KERNEL); 379 380 if (!spi_gpio->cs_gpios) 380 381 return -ENOMEM;
+3 -2
drivers/spi/spi-imx.c
··· 1511 1511 if (mxc_platform_info) { 1512 1512 master->num_chipselect = mxc_platform_info->num_chipselect; 1513 1513 if (mxc_platform_info->chipselect) { 1514 - master->cs_gpios = devm_kzalloc(&master->dev, 1515 - sizeof(int) * master->num_chipselect, GFP_KERNEL); 1514 + master->cs_gpios = devm_kcalloc(&master->dev, 1515 + master->num_chipselect, sizeof(int), 1516 + GFP_KERNEL); 1516 1517 if (!master->cs_gpios) 1517 1518 return -ENOMEM; 1518 1519
+2 -2
drivers/spi/spi-oc-tiny.c
··· 213 213 return 0; 214 214 hw->gpio_cs_count = of_gpio_count(np); 215 215 if (hw->gpio_cs_count > 0) { 216 - hw->gpio_cs = devm_kzalloc(&pdev->dev, 217 - hw->gpio_cs_count * sizeof(unsigned int), 216 + hw->gpio_cs = devm_kcalloc(&pdev->dev, 217 + hw->gpio_cs_count, sizeof(unsigned int), 218 218 GFP_KERNEL); 219 219 if (!hw->gpio_cs) 220 220 return -ENOMEM;
+1 -1
drivers/spi/spi-pl022.c
··· 2135 2135 pl022->master_info = platform_info; 2136 2136 pl022->adev = adev; 2137 2137 pl022->vendor = id->data; 2138 - pl022->chipselects = devm_kzalloc(dev, num_cs * sizeof(int), 2138 + pl022->chipselects = devm_kcalloc(dev, num_cs, sizeof(int), 2139 2139 GFP_KERNEL); 2140 2140 if (!pl022->chipselects) { 2141 2141 status = -ENOMEM;
+1 -1
drivers/spi/spi.c
··· 2049 2049 else if (nb < 0) 2050 2050 return nb; 2051 2051 2052 - cs = devm_kzalloc(&ctlr->dev, sizeof(int) * ctlr->num_chipselect, 2052 + cs = devm_kcalloc(&ctlr->dev, ctlr->num_chipselect, sizeof(int), 2053 2053 GFP_KERNEL); 2054 2054 ctlr->cs_gpios = cs; 2055 2055
+1 -1
drivers/staging/greybus/audio_topology.c
··· 144 144 __u8 *data; 145 145 146 146 items = le32_to_cpu(gbenum->items); 147 - strings = devm_kzalloc(gb->dev, sizeof(char *) * items, GFP_KERNEL); 147 + strings = devm_kcalloc(gb->dev, items, sizeof(char *), GFP_KERNEL); 148 148 data = gbenum->names; 149 149 150 150 for (i = 0; i < items; i++) {
+3 -3
drivers/staging/media/imx/imx-media-dev.c
··· 303 303 304 304 list_for_each_entry(sd, &imxmd->v4l2_dev.subdevs, list) { 305 305 entity = &sd->entity; 306 - vdev_lists = devm_kzalloc( 306 + vdev_lists = devm_kcalloc( 307 307 imxmd->md.dev, 308 - entity->num_pads * sizeof(*vdev_lists), 308 + entity->num_pads, sizeof(*vdev_lists), 309 309 GFP_KERNEL); 310 310 if (!vdev_lists) 311 311 return -ENOMEM; ··· 544 544 goto unreg_dev; 545 545 } 546 546 547 - subdevs = devm_kzalloc(imxmd->md.dev, sizeof(*subdevs) * num_subdevs, 547 + subdevs = devm_kcalloc(imxmd->md.dev, num_subdevs, sizeof(*subdevs), 548 548 GFP_KERNEL); 549 549 if (!subdevs) { 550 550 ret = -ENOMEM;
+16 -8
drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
··· 287 287 } 288 288 289 289 /* allocate the group names array needed by the gpio function */ 290 - p->group_names = devm_kzalloc(p->dev, sizeof(char *) * p->group_count, GFP_KERNEL); 290 + p->group_names = devm_kcalloc(p->dev, p->group_count, sizeof(char *), 291 + GFP_KERNEL); 291 292 if (!p->group_names) 292 293 return -1; 293 294 ··· 301 300 p->func_count++; 302 301 303 302 /* allocate our function and group mapping index buffers */ 304 - f = p->func = devm_kzalloc(p->dev, sizeof(struct rt2880_pmx_func) * p->func_count, GFP_KERNEL); 305 - gpio_func.groups = devm_kzalloc(p->dev, sizeof(int) * p->group_count, GFP_KERNEL); 303 + f = p->func = devm_kcalloc(p->dev, 304 + p->func_count, 305 + sizeof(struct rt2880_pmx_func), 306 + GFP_KERNEL); 307 + gpio_func.groups = devm_kcalloc(p->dev, p->group_count, sizeof(int), 308 + GFP_KERNEL); 306 309 if (!f || !gpio_func.groups) 307 310 return -1; 308 311 ··· 342 337 if (!p->func[i]->pin_count) 343 338 continue; 344 339 345 - p->func[i]->pins = devm_kzalloc(p->dev, sizeof(int) * p->func[i]->pin_count, GFP_KERNEL); 340 + p->func[i]->pins = devm_kcalloc(p->dev, 341 + p->func[i]->pin_count, 342 + sizeof(int), 343 + GFP_KERNEL); 346 344 for (j = 0; j < p->func[i]->pin_count; j++) 347 345 p->func[i]->pins[j] = p->func[i]->pin_first + j; 348 346 ··· 355 347 } 356 348 357 349 /* the buffer that tells us which pins are gpio */ 358 - p->gpio = devm_kzalloc(p->dev,sizeof(uint8_t) * p->max_pins, 359 - GFP_KERNEL); 350 + p->gpio = devm_kcalloc(p->dev,p->max_pins, sizeof(uint8_t), 351 + GFP_KERNEL); 360 352 /* the pads needed to tell pinctrl about our pins */ 361 - p->pads = devm_kzalloc(p->dev, 362 - sizeof(struct pinctrl_pin_desc) * p->max_pins, 353 + p->pads = devm_kcalloc(p->dev, 354 + p->max_pins, sizeof(struct pinctrl_pin_desc), 363 355 GFP_KERNEL); 364 356 if (!p->pads || !p->gpio ) { 365 357 dev_err(p->dev, "Failed to allocate gpio data\n");
+4 -4
drivers/thermal/tegra/soctherm.c
··· 1343 1343 return PTR_ERR(tegra->clock_soctherm); 1344 1344 } 1345 1345 1346 - tegra->calib = devm_kzalloc(&pdev->dev, 1347 - sizeof(u32) * soc->num_tsensors, 1346 + tegra->calib = devm_kcalloc(&pdev->dev, 1347 + soc->num_tsensors, sizeof(u32), 1348 1348 GFP_KERNEL); 1349 1349 if (!tegra->calib) 1350 1350 return -ENOMEM; ··· 1363 1363 return err; 1364 1364 } 1365 1365 1366 - tegra->thermctl_tzs = devm_kzalloc(&pdev->dev, 1367 - sizeof(*z) * soc->num_ttgs, 1366 + tegra->thermctl_tzs = devm_kcalloc(&pdev->dev, 1367 + soc->num_ttgs, sizeof(*z), 1368 1368 GFP_KERNEL); 1369 1369 if (!tegra->thermctl_tzs) 1370 1370 return -ENOMEM;
+3 -2
drivers/thermal/thermal-generic-adc.c
··· 87 87 return -EINVAL; 88 88 } 89 89 90 - gti->lookup_table = devm_kzalloc(dev, sizeof(*gti->lookup_table) * 91 - ntable, GFP_KERNEL); 90 + gti->lookup_table = devm_kcalloc(dev, 91 + ntable, sizeof(*gti->lookup_table), 92 + GFP_KERNEL); 92 93 if (!gti->lookup_table) 93 94 return -ENOMEM; 94 95
+1 -1
drivers/tty/serial/rp2.c
··· 774 774 775 775 rp2_init_card(card); 776 776 777 - ports = devm_kzalloc(&pdev->dev, sizeof(*ports) * card->n_ports, 777 + ports = devm_kcalloc(&pdev->dev, card->n_ports, sizeof(*ports), 778 778 GFP_KERNEL); 779 779 if (!ports) 780 780 return -ENOMEM;
+1 -1
drivers/usb/gadget/udc/atmel_usba_udc.c
··· 2036 2036 udc->num_ep = usba_config_fifo_table(udc); 2037 2037 } 2038 2038 2039 - eps = devm_kzalloc(&pdev->dev, sizeof(struct usba_ep) * udc->num_ep, 2039 + eps = devm_kcalloc(&pdev->dev, udc->num_ep, sizeof(struct usba_ep), 2040 2040 GFP_KERNEL); 2041 2041 if (!eps) 2042 2042 return ERR_PTR(-ENOMEM);
+2 -1
drivers/usb/gadget/udc/renesas_usb3.c
··· 2427 2427 if (usb3->num_usb3_eps > USB3_MAX_NUM_PIPES) 2428 2428 usb3->num_usb3_eps = USB3_MAX_NUM_PIPES; 2429 2429 2430 - usb3->usb3_ep = devm_kzalloc(dev, sizeof(*usb3_ep) * usb3->num_usb3_eps, 2430 + usb3->usb3_ep = devm_kcalloc(dev, 2431 + usb3->num_usb3_eps, sizeof(*usb3_ep), 2431 2432 GFP_KERNEL); 2432 2433 if (!usb3->usb3_ep) 2433 2434 return -ENOMEM;
+1 -1
drivers/video/backlight/adp8860_bl.c
··· 223 223 struct led_info *cur_led; 224 224 int ret, i; 225 225 226 - led = devm_kzalloc(&client->dev, sizeof(*led) * pdata->num_leds, 226 + led = devm_kcalloc(&client->dev, pdata->num_leds, sizeof(*led), 227 227 GFP_KERNEL); 228 228 if (led == NULL) 229 229 return -ENOMEM;
+1 -1
drivers/video/backlight/adp8870_bl.c
··· 246 246 struct led_info *cur_led; 247 247 int ret, i; 248 248 249 - led = devm_kzalloc(&client->dev, pdata->num_leds * sizeof(*led), 249 + led = devm_kcalloc(&client->dev, pdata->num_leds, sizeof(*led), 250 250 GFP_KERNEL); 251 251 if (led == NULL) 252 252 return -ENOMEM;
+1 -1
drivers/video/backlight/lp855x_bl.c
··· 374 374 struct device_node *child; 375 375 int i = 0; 376 376 377 - rom = devm_kzalloc(dev, sizeof(*rom) * rom_length, GFP_KERNEL); 377 + rom = devm_kcalloc(dev, rom_length, sizeof(*rom), GFP_KERNEL); 378 378 if (!rom) 379 379 return -ENOMEM; 380 380
+1 -1
drivers/video/fbdev/au1100fb.c
··· 501 501 fbdev->info.fix = au1100fb_fix; 502 502 503 503 fbdev->info.pseudo_palette = 504 - devm_kzalloc(&dev->dev, sizeof(u32) * 16, GFP_KERNEL); 504 + devm_kcalloc(&dev->dev, 16, sizeof(u32), GFP_KERNEL); 505 505 if (!fbdev->info.pseudo_palette) 506 506 return -ENOMEM; 507 507
+1 -1
drivers/video/fbdev/mxsfb.c
··· 931 931 if (IS_ERR(host->reg_lcd)) 932 932 host->reg_lcd = NULL; 933 933 934 - fb_info->pseudo_palette = devm_kzalloc(&pdev->dev, sizeof(u32) * 16, 934 + fb_info->pseudo_palette = devm_kcalloc(&pdev->dev, 16, sizeof(u32), 935 935 GFP_KERNEL); 936 936 if (!fb_info->pseudo_palette) { 937 937 ret = -ENOMEM;
+2 -2
drivers/video/fbdev/omap2/omapfb/vrfb.c
··· 359 359 360 360 num_ctxs = pdev->num_resources - 1; 361 361 362 - ctxs = devm_kzalloc(&pdev->dev, 363 - sizeof(struct vrfb_ctx) * num_ctxs, 362 + ctxs = devm_kcalloc(&pdev->dev, 363 + num_ctxs, sizeof(struct vrfb_ctx), 364 364 GFP_KERNEL); 365 365 366 366 if (!ctxs)
+2 -2
sound/soc/au1x/dbdma2.c
··· 339 339 { 340 340 struct au1xpsc_audio_dmadata *dmadata; 341 341 342 - dmadata = devm_kzalloc(&pdev->dev, 343 - 2 * sizeof(struct au1xpsc_audio_dmadata), 342 + dmadata = devm_kcalloc(&pdev->dev, 343 + 2, sizeof(struct au1xpsc_audio_dmadata), 344 344 GFP_KERNEL); 345 345 if (!dmadata) 346 346 return -ENOMEM;
+1 -1
sound/soc/codecs/hdmi-codec.c
··· 771 771 hcp->hcd = *hcd; 772 772 mutex_init(&hcp->current_stream_lock); 773 773 774 - hcp->daidrv = devm_kzalloc(dev, dai_count * sizeof(*hcp->daidrv), 774 + hcp->daidrv = devm_kcalloc(dev, dai_count, sizeof(*hcp->daidrv), 775 775 GFP_KERNEL); 776 776 if (!hcp->daidrv) 777 777 return -ENOMEM;
+3 -2
sound/soc/codecs/rt5645.c
··· 3449 3449 if (rt5645->pdata.long_name) 3450 3450 component->card->long_name = rt5645->pdata.long_name; 3451 3451 3452 - rt5645->eq_param = devm_kzalloc(component->dev, 3453 - RT5645_HWEQ_NUM * sizeof(struct rt5645_eq_param_s), GFP_KERNEL); 3452 + rt5645->eq_param = devm_kcalloc(component->dev, 3453 + RT5645_HWEQ_NUM, sizeof(struct rt5645_eq_param_s), 3454 + GFP_KERNEL); 3454 3455 3455 3456 return 0; 3456 3457 }
+2 -2
sound/soc/codecs/wm8994.c
··· 3298 3298 }; 3299 3299 3300 3300 /* We need an array of texts for the enum API */ 3301 - wm8994->drc_texts = devm_kzalloc(wm8994->hubs.component->dev, 3302 - sizeof(char *) * pdata->num_drc_cfgs, GFP_KERNEL); 3301 + wm8994->drc_texts = devm_kcalloc(wm8994->hubs.component->dev, 3302 + pdata->num_drc_cfgs, sizeof(char *), GFP_KERNEL); 3303 3303 if (!wm8994->drc_texts) 3304 3304 return; 3305 3305
+8 -6
sound/soc/davinci/davinci-mcasp.c
··· 1868 1868 1869 1869 mcasp->num_serializer = pdata->num_serializer; 1870 1870 #ifdef CONFIG_PM_SLEEP 1871 - mcasp->context.xrsr_regs = devm_kzalloc(&pdev->dev, 1872 - sizeof(u32) * mcasp->num_serializer, 1871 + mcasp->context.xrsr_regs = devm_kcalloc(&pdev->dev, 1872 + mcasp->num_serializer, sizeof(u32), 1873 1873 GFP_KERNEL); 1874 1874 if (!mcasp->context.xrsr_regs) { 1875 1875 ret = -ENOMEM; ··· 2004 2004 * bytes. 2005 2005 */ 2006 2006 mcasp->chconstr[SNDRV_PCM_STREAM_PLAYBACK].list = 2007 - devm_kzalloc(mcasp->dev, sizeof(unsigned int) * 2008 - (32 + mcasp->num_serializer - 1), 2007 + devm_kcalloc(mcasp->dev, 2008 + 32 + mcasp->num_serializer - 1, 2009 + sizeof(unsigned int), 2009 2010 GFP_KERNEL); 2010 2011 2011 2012 mcasp->chconstr[SNDRV_PCM_STREAM_CAPTURE].list = 2012 - devm_kzalloc(mcasp->dev, sizeof(unsigned int) * 2013 - (32 + mcasp->num_serializer - 1), 2013 + devm_kcalloc(mcasp->dev, 2014 + 32 + mcasp->num_serializer - 1, 2015 + sizeof(unsigned int), 2014 2016 GFP_KERNEL); 2015 2017 2016 2018 if (!mcasp->chconstr[SNDRV_PCM_STREAM_PLAYBACK].list ||
+2 -2
sound/soc/generic/audio-graph-card.c
··· 296 296 if (num == 0) 297 297 return -EINVAL; 298 298 299 - dai_props = devm_kzalloc(dev, sizeof(*dai_props) * num, GFP_KERNEL); 300 - dai_link = devm_kzalloc(dev, sizeof(*dai_link) * num, GFP_KERNEL); 299 + dai_props = devm_kcalloc(dev, num, sizeof(*dai_props), GFP_KERNEL); 300 + dai_link = devm_kcalloc(dev, num, sizeof(*dai_link), GFP_KERNEL); 301 301 if (!dai_props || !dai_link) 302 302 return -ENOMEM; 303 303
+2 -2
sound/soc/generic/audio-graph-scu-card.c
··· 348 348 if (num == 0) 349 349 return -EINVAL; 350 350 351 - dai_props = devm_kzalloc(dev, sizeof(*dai_props) * num, GFP_KERNEL); 352 - dai_link = devm_kzalloc(dev, sizeof(*dai_link) * num, GFP_KERNEL); 351 + dai_props = devm_kcalloc(dev, num, sizeof(*dai_props), GFP_KERNEL); 352 + dai_link = devm_kcalloc(dev, num, sizeof(*dai_link), GFP_KERNEL); 353 353 if (!dai_props || !dai_link) 354 354 return -ENOMEM; 355 355
+4 -4
sound/soc/generic/simple-card.c
··· 340 340 if (n <= 0) 341 341 return -EINVAL; 342 342 343 - card->aux_dev = devm_kzalloc(dev, 344 - n * sizeof(*card->aux_dev), GFP_KERNEL); 343 + card->aux_dev = devm_kcalloc(dev, 344 + n, sizeof(*card->aux_dev), GFP_KERNEL); 345 345 if (!card->aux_dev) 346 346 return -ENOMEM; 347 347 ··· 435 435 if (!priv) 436 436 return -ENOMEM; 437 437 438 - dai_props = devm_kzalloc(dev, sizeof(*dai_props) * num, GFP_KERNEL); 439 - dai_link = devm_kzalloc(dev, sizeof(*dai_link) * num, GFP_KERNEL); 438 + dai_props = devm_kcalloc(dev, num, sizeof(*dai_props), GFP_KERNEL); 439 + dai_link = devm_kcalloc(dev, num, sizeof(*dai_link), GFP_KERNEL); 440 440 if (!dai_props || !dai_link) 441 441 return -ENOMEM; 442 442
+2 -2
sound/soc/generic/simple-scu-card.c
··· 246 246 247 247 num = of_get_child_count(np); 248 248 249 - dai_props = devm_kzalloc(dev, sizeof(*dai_props) * num, GFP_KERNEL); 250 - dai_link = devm_kzalloc(dev, sizeof(*dai_link) * num, GFP_KERNEL); 249 + dai_props = devm_kcalloc(dev, num, sizeof(*dai_props), GFP_KERNEL); 250 + dai_link = devm_kcalloc(dev, num, sizeof(*dai_link), GFP_KERNEL); 251 251 if (!dai_props || !dai_link) 252 252 return -ENOMEM; 253 253
+2 -2
sound/soc/img/img-i2s-in.c
··· 509 509 510 510 pm_runtime_put(&pdev->dev); 511 511 512 - i2s->suspend_ch_ctl = devm_kzalloc(dev, 513 - sizeof(*i2s->suspend_ch_ctl) * i2s->max_i2s_chan, GFP_KERNEL); 512 + i2s->suspend_ch_ctl = devm_kcalloc(dev, 513 + i2s->max_i2s_chan, sizeof(*i2s->suspend_ch_ctl), GFP_KERNEL); 514 514 if (!i2s->suspend_ch_ctl) { 515 515 ret = -ENOMEM; 516 516 goto err_suspend;
+2 -2
sound/soc/img/img-i2s-out.c
··· 479 479 return PTR_ERR(i2s->clk_ref); 480 480 } 481 481 482 - i2s->suspend_ch_ctl = devm_kzalloc(dev, 483 - sizeof(*i2s->suspend_ch_ctl) * i2s->max_i2s_chan, GFP_KERNEL); 482 + i2s->suspend_ch_ctl = devm_kcalloc(dev, 483 + i2s->max_i2s_chan, sizeof(*i2s->suspend_ch_ctl), GFP_KERNEL); 484 484 if (!i2s->suspend_ch_ctl) 485 485 return -ENOMEM; 486 486
+12 -8
sound/soc/intel/skylake/skl-topology.c
··· 2428 2428 2429 2429 case SKL_TKN_U8_DYN_IN_PIN: 2430 2430 if (!mconfig->m_in_pin) 2431 - mconfig->m_in_pin = devm_kzalloc(dev, MAX_IN_QUEUE * 2432 - sizeof(*mconfig->m_in_pin), GFP_KERNEL); 2431 + mconfig->m_in_pin = 2432 + devm_kcalloc(dev, MAX_IN_QUEUE, 2433 + sizeof(*mconfig->m_in_pin), 2434 + GFP_KERNEL); 2433 2435 if (!mconfig->m_in_pin) 2434 2436 return -ENOMEM; 2435 2437 ··· 2441 2439 2442 2440 case SKL_TKN_U8_DYN_OUT_PIN: 2443 2441 if (!mconfig->m_out_pin) 2444 - mconfig->m_out_pin = devm_kzalloc(dev, MAX_IN_QUEUE * 2445 - sizeof(*mconfig->m_in_pin), GFP_KERNEL); 2442 + mconfig->m_out_pin = 2443 + devm_kcalloc(dev, MAX_IN_QUEUE, 2444 + sizeof(*mconfig->m_in_pin), 2445 + GFP_KERNEL); 2446 2446 if (!mconfig->m_out_pin) 2447 2447 return -ENOMEM; 2448 2448 ··· 2856 2852 mconfig->time_slot = dfw->time_slot; 2857 2853 mconfig->formats_config.caps_size = dfw->caps.caps_size; 2858 2854 2859 - mconfig->m_in_pin = devm_kzalloc(dev, 2860 - MAX_IN_QUEUE * sizeof(*mconfig->m_in_pin), 2855 + mconfig->m_in_pin = devm_kcalloc(dev, 2856 + MAX_IN_QUEUE, sizeof(*mconfig->m_in_pin), 2861 2857 GFP_KERNEL); 2862 2858 if (!mconfig->m_in_pin) 2863 2859 return -ENOMEM; 2864 2860 2865 - mconfig->m_out_pin = devm_kzalloc(dev, 2866 - MAX_OUT_QUEUE * sizeof(*mconfig->m_out_pin), 2861 + mconfig->m_out_pin = devm_kcalloc(dev, 2862 + MAX_OUT_QUEUE, sizeof(*mconfig->m_out_pin), 2867 2863 GFP_KERNEL); 2868 2864 if (!mconfig->m_out_pin) 2869 2865 return -ENOMEM;
+2 -1
sound/soc/mediatek/mt2701/mt2701-afe-pcm.c
··· 1347 1347 afe->dev = &pdev->dev; 1348 1348 dev = afe->dev; 1349 1349 1350 - afe_priv->i2s_path = devm_kzalloc(dev, afe_priv->soc->i2s_num * 1350 + afe_priv->i2s_path = devm_kcalloc(dev, 1351 + afe_priv->soc->i2s_num, 1351 1352 sizeof(struct mt2701_i2s_path), 1352 1353 GFP_KERNEL); 1353 1354 if (!afe_priv->i2s_path)
+2 -2
sound/soc/pxa/mmp-sspa.c
··· 425 425 if (priv->sspa == NULL) 426 426 return -ENOMEM; 427 427 428 - priv->dma_params = devm_kzalloc(&pdev->dev, 429 - 2 * sizeof(struct snd_dmaengine_dai_dma_data), 428 + priv->dma_params = devm_kcalloc(&pdev->dev, 429 + 2, sizeof(struct snd_dmaengine_dai_dma_data), 430 430 GFP_KERNEL); 431 431 if (priv->dma_params == NULL) 432 432 return -ENOMEM;
+1 -1
sound/soc/rockchip/rk3399_gru_sound.c
··· 462 462 num_routes = 0; 463 463 for (i = 0; i < ARRAY_SIZE(rockchip_routes); i++) 464 464 num_routes += rockchip_routes[i].num_routes; 465 - routes = devm_kzalloc(dev, num_routes * sizeof(*routes), 465 + routes = devm_kcalloc(dev, num_routes, sizeof(*routes), 466 466 GFP_KERNEL); 467 467 if (!routes) 468 468 return -ENOMEM;
+1 -1
sound/soc/sh/rcar/cmd.c
··· 155 155 if (!nr) 156 156 return 0; 157 157 158 - cmd = devm_kzalloc(dev, sizeof(*cmd) * nr, GFP_KERNEL); 158 + cmd = devm_kcalloc(dev, nr, sizeof(*cmd), GFP_KERNEL); 159 159 if (!cmd) 160 160 return -ENOMEM; 161 161
+2 -2
sound/soc/sh/rcar/core.c
··· 1110 1110 if (!nr) 1111 1111 return -EINVAL; 1112 1112 1113 - rdrv = devm_kzalloc(dev, sizeof(*rdrv) * nr, GFP_KERNEL); 1114 - rdai = devm_kzalloc(dev, sizeof(*rdai) * nr, GFP_KERNEL); 1113 + rdrv = devm_kcalloc(dev, nr, sizeof(*rdrv), GFP_KERNEL); 1114 + rdai = devm_kcalloc(dev, nr, sizeof(*rdai), GFP_KERNEL); 1115 1115 if (!rdrv || !rdai) 1116 1116 return -ENOMEM; 1117 1117
+1 -1
sound/soc/sh/rcar/ctu.c
··· 378 378 goto rsnd_ctu_probe_done; 379 379 } 380 380 381 - ctu = devm_kzalloc(dev, sizeof(*ctu) * nr, GFP_KERNEL); 381 + ctu = devm_kcalloc(dev, nr, sizeof(*ctu), GFP_KERNEL); 382 382 if (!ctu) { 383 383 ret = -ENOMEM; 384 384 goto rsnd_ctu_probe_done;
+1 -1
sound/soc/sh/rcar/dvc.c
··· 344 344 goto rsnd_dvc_probe_done; 345 345 } 346 346 347 - dvc = devm_kzalloc(dev, sizeof(*dvc) * nr, GFP_KERNEL); 347 + dvc = devm_kcalloc(dev, nr, sizeof(*dvc), GFP_KERNEL); 348 348 if (!dvc) { 349 349 ret = -ENOMEM; 350 350 goto rsnd_dvc_probe_done;
+1 -1
sound/soc/sh/rcar/mix.c
··· 294 294 goto rsnd_mix_probe_done; 295 295 } 296 296 297 - mix = devm_kzalloc(dev, sizeof(*mix) * nr, GFP_KERNEL); 297 + mix = devm_kcalloc(dev, nr, sizeof(*mix), GFP_KERNEL); 298 298 if (!mix) { 299 299 ret = -ENOMEM; 300 300 goto rsnd_mix_probe_done;
+1 -1
sound/soc/sh/rcar/src.c
··· 575 575 goto rsnd_src_probe_done; 576 576 } 577 577 578 - src = devm_kzalloc(dev, sizeof(*src) * nr, GFP_KERNEL); 578 + src = devm_kcalloc(dev, nr, sizeof(*src), GFP_KERNEL); 579 579 if (!src) { 580 580 ret = -ENOMEM; 581 581 goto rsnd_src_probe_done;
+1 -1
sound/soc/sh/rcar/ssi.c
··· 1116 1116 goto rsnd_ssi_probe_done; 1117 1117 } 1118 1118 1119 - ssi = devm_kzalloc(dev, sizeof(*ssi) * nr, GFP_KERNEL); 1119 + ssi = devm_kcalloc(dev, nr, sizeof(*ssi), GFP_KERNEL); 1120 1120 if (!ssi) { 1121 1121 ret = -ENOMEM; 1122 1122 goto rsnd_ssi_probe_done;
+1 -1
sound/soc/sh/rcar/ssiu.c
··· 258 258 259 259 /* same number to SSI */ 260 260 nr = priv->ssi_nr; 261 - ssiu = devm_kzalloc(dev, sizeof(*ssiu) * nr, GFP_KERNEL); 261 + ssiu = devm_kcalloc(dev, nr, sizeof(*ssiu), GFP_KERNEL); 262 262 if (!ssiu) 263 263 return -ENOMEM; 264 264
+3 -3
sound/soc/soc-core.c
··· 3354 3354 return -EINVAL; 3355 3355 } 3356 3356 3357 - routes = devm_kzalloc(card->dev, num_routes * sizeof(*routes), 3357 + routes = devm_kcalloc(card->dev, num_routes, sizeof(*routes), 3358 3358 GFP_KERNEL); 3359 3359 if (!routes) { 3360 3360 dev_err(card->dev, ··· 3678 3678 dev_err(dev, "Bad phandle in 'sound-dai'\n"); 3679 3679 return num_codecs; 3680 3680 } 3681 - component = devm_kzalloc(dev, 3682 - sizeof *component * num_codecs, 3681 + component = devm_kcalloc(dev, 3682 + num_codecs, sizeof(*component), 3683 3683 GFP_KERNEL); 3684 3684 if (!component) 3685 3685 return -ENOMEM;
+6 -4
sound/soc/uniphier/aio-cpu.c
··· 624 624 return PTR_ERR(chip->rst); 625 625 626 626 chip->num_aios = chip->chip_spec->num_dais; 627 - chip->aios = devm_kzalloc(dev, 628 - sizeof(struct uniphier_aio) * chip->num_aios, 627 + chip->aios = devm_kcalloc(dev, 628 + chip->num_aios, sizeof(struct uniphier_aio), 629 629 GFP_KERNEL); 630 630 if (!chip->aios) 631 631 return -ENOMEM; 632 632 633 633 chip->num_plls = chip->chip_spec->num_plls; 634 - chip->plls = devm_kzalloc(dev, sizeof(struct uniphier_aio_pll) * 635 - chip->num_plls, GFP_KERNEL); 634 + chip->plls = devm_kcalloc(dev, 635 + chip->num_plls, 636 + sizeof(struct uniphier_aio_pll), 637 + GFP_KERNEL); 636 638 if (!chip->plls) 637 639 return -ENOMEM; 638 640 memcpy(chip->plls, chip->chip_spec->plls,