1
0
Fork 0

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>
hifive-unleashed-5.1
Kees Cook 2018-06-12 14:07:58 -07:00
parent 3c4211ba8a
commit a86854d0c5
229 changed files with 847 additions and 664 deletions

View File

@ -298,8 +298,8 @@ static int acpi_fan_get_fps(struct acpi_device *device)
} }
fan->fps_count = obj->package.count - 1; /* minus revision field */ fan->fps_count = obj->package.count - 1; /* minus revision field */
fan->fps = devm_kzalloc(&device->dev, fan->fps = devm_kcalloc(&device->dev,
fan->fps_count * sizeof(struct acpi_fan_fps), fan->fps_count, sizeof(struct acpi_fan_fps),
GFP_KERNEL); GFP_KERNEL);
if (!fan->fps) { if (!fan->fps) {
dev_err(&device->dev, "Not enough memory\n"); dev_err(&device->dev, "Not enough memory\n");

View File

@ -1082,9 +1082,10 @@ static int __nfit_mem_init(struct acpi_nfit_desc *acpi_desc,
continue; continue;
nfit_mem->nfit_flush = nfit_flush; nfit_mem->nfit_flush = nfit_flush;
flush = nfit_flush->flush; flush = nfit_flush->flush;
nfit_mem->flush_wpq = devm_kzalloc(acpi_desc->dev, nfit_mem->flush_wpq = devm_kcalloc(acpi_desc->dev,
flush->hint_count flush->hint_count,
* sizeof(struct resource), GFP_KERNEL); sizeof(struct resource),
GFP_KERNEL);
if (!nfit_mem->flush_wpq) if (!nfit_mem->flush_wpq)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < flush->hint_count; i++) { for (i = 0; i < flush->hint_count; i++) {

View File

@ -4114,13 +4114,13 @@ static int mv_platform_probe(struct platform_device *pdev)
if (!host || !hpriv) if (!host || !hpriv)
return -ENOMEM; return -ENOMEM;
hpriv->port_clks = devm_kzalloc(&pdev->dev, hpriv->port_clks = devm_kcalloc(&pdev->dev,
sizeof(struct clk *) * n_ports, n_ports, sizeof(struct clk *),
GFP_KERNEL); GFP_KERNEL);
if (!hpriv->port_clks) if (!hpriv->port_clks)
return -ENOMEM; return -ENOMEM;
hpriv->port_phys = devm_kzalloc(&pdev->dev, hpriv->port_phys = devm_kcalloc(&pdev->dev,
sizeof(struct phy *) * n_ports, n_ports, sizeof(struct phy *),
GFP_KERNEL); GFP_KERNEL);
if (!hpriv->port_phys) if (!hpriv->port_phys)
return -ENOMEM; return -ENOMEM;

View File

@ -354,8 +354,8 @@ int fsl_mc_populate_irq_pool(struct fsl_mc_bus *mc_bus,
if (error < 0) if (error < 0)
return error; return error;
irq_resources = devm_kzalloc(&mc_bus_dev->dev, irq_resources = devm_kcalloc(&mc_bus_dev->dev,
sizeof(*irq_resources) * irq_count, irq_count, sizeof(*irq_resources),
GFP_KERNEL); GFP_KERNEL);
if (!irq_resources) { if (!irq_resources) {
error = -ENOMEM; error = -ENOMEM;
@ -455,7 +455,7 @@ int __must_check fsl_mc_allocate_irqs(struct fsl_mc_device *mc_dev)
return -ENOSPC; return -ENOSPC;
} }
irqs = devm_kzalloc(&mc_dev->dev, irq_count * sizeof(irqs[0]), irqs = devm_kcalloc(&mc_dev->dev, irq_count, sizeof(irqs[0]),
GFP_KERNEL); GFP_KERNEL);
if (!irqs) if (!irqs)
return -ENOMEM; return -ENOMEM;

View File

@ -980,7 +980,7 @@ static int tpm2_get_cc_attrs_tbl(struct tpm_chip *chip)
goto out; goto out;
} }
chip->cc_attrs_tbl = devm_kzalloc(&chip->dev, 4 * nr_commands, chip->cc_attrs_tbl = devm_kcalloc(&chip->dev, 4, nr_commands,
GFP_KERNEL); GFP_KERNEL);
rc = tpm_buf_init(&buf, TPM2_ST_NO_SESSIONS, TPM2_CC_GET_CAPABILITY); rc = tpm_buf_init(&buf, TPM2_ST_NO_SESSIONS, TPM2_CC_GET_CAPABILITY);

View File

@ -734,7 +734,7 @@ static void bcm2835_pll_debug_init(struct clk_hw *hw,
const struct bcm2835_pll_data *data = pll->data; const struct bcm2835_pll_data *data = pll->data;
struct debugfs_reg32 *regs; struct debugfs_reg32 *regs;
regs = devm_kzalloc(cprman->dev, 7 * sizeof(*regs), GFP_KERNEL); regs = devm_kcalloc(cprman->dev, 7, sizeof(*regs), GFP_KERNEL);
if (!regs) if (!regs)
return; return;
@ -865,7 +865,7 @@ static void bcm2835_pll_divider_debug_init(struct clk_hw *hw,
const struct bcm2835_pll_divider_data *data = divider->data; const struct bcm2835_pll_divider_data *data = divider->data;
struct debugfs_reg32 *regs; struct debugfs_reg32 *regs;
regs = devm_kzalloc(cprman->dev, 7 * sizeof(*regs), GFP_KERNEL); regs = devm_kcalloc(cprman->dev, 7, sizeof(*regs), GFP_KERNEL);
if (!regs) if (!regs)
return; return;

View File

@ -501,8 +501,9 @@ static int ti_adpll_init_dco(struct ti_adpll_data *d)
const char *postfix; const char *postfix;
int width, err; int width, err;
d->outputs.clks = devm_kzalloc(d->dev, sizeof(struct clk *) * d->outputs.clks = devm_kcalloc(d->dev,
MAX_ADPLL_OUTPUTS, MAX_ADPLL_OUTPUTS,
sizeof(struct clk *),
GFP_KERNEL); GFP_KERNEL);
if (!d->outputs.clks) if (!d->outputs.clks)
return -ENOMEM; return -ENOMEM;
@ -915,8 +916,9 @@ static int ti_adpll_probe(struct platform_device *pdev)
if (err) if (err)
return err; return err;
d->clocks = devm_kzalloc(d->dev, sizeof(struct ti_adpll_clock) * d->clocks = devm_kcalloc(d->dev,
TI_ADPLL_NR_CLOCKS, TI_ADPLL_NR_CLOCKS,
sizeof(struct ti_adpll_clock),
GFP_KERNEL); GFP_KERNEL);
if (!d->clocks) if (!d->clocks)
return -ENOMEM; return -ENOMEM;

View File

@ -410,7 +410,7 @@ brcm_avs_get_freq_table(struct device *dev, struct private_data *priv)
if (ret) if (ret)
return ERR_PTR(ret); return ERR_PTR(ret);
table = devm_kzalloc(dev, (AVS_PSTATE_MAX + 1) * sizeof(*table), table = devm_kcalloc(dev, AVS_PSTATE_MAX + 1, sizeof(*table),
GFP_KERNEL); GFP_KERNEL);
if (!table) if (!table)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);

View File

@ -377,7 +377,8 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
} }
/* Make imx6_soc_volt array's size same as arm opp number */ /* Make imx6_soc_volt array's size same as arm opp number */
imx6_soc_volt = devm_kzalloc(cpu_dev, sizeof(*imx6_soc_volt) * num, GFP_KERNEL); imx6_soc_volt = devm_kcalloc(cpu_dev, num, sizeof(*imx6_soc_volt),
GFP_KERNEL);
if (imx6_soc_volt == NULL) { if (imx6_soc_volt == NULL) {
ret = -ENOMEM; ret = -ENOMEM;
goto free_freq_table; goto free_freq_table;

View File

@ -471,7 +471,7 @@ static int mv_cesa_probe(struct platform_device *pdev)
sram_size = CESA_SA_MIN_SRAM_SIZE; sram_size = CESA_SA_MIN_SRAM_SIZE;
cesa->sram_size = sram_size; cesa->sram_size = sram_size;
cesa->engines = devm_kzalloc(dev, caps->nengines * sizeof(*engines), cesa->engines = devm_kcalloc(dev, caps->nengines, sizeof(*engines),
GFP_KERNEL); GFP_KERNEL);
if (!cesa->engines) if (!cesa->engines)
return -ENOMEM; return -ENOMEM;

View File

@ -3393,8 +3393,10 @@ static int talitos_probe(struct platform_device *ofdev)
} }
} }
priv->chan = devm_kzalloc(dev, sizeof(struct talitos_channel) * priv->chan = devm_kcalloc(dev,
priv->num_channels, GFP_KERNEL); priv->num_channels,
sizeof(struct talitos_channel),
GFP_KERNEL);
if (!priv->chan) { if (!priv->chan) {
dev_err(dev, "failed to allocate channel management space\n"); dev_err(dev, "failed to allocate channel management space\n");
err = -ENOMEM; err = -ENOMEM;
@ -3411,9 +3413,10 @@ static int talitos_probe(struct platform_device *ofdev)
spin_lock_init(&priv->chan[i].head_lock); spin_lock_init(&priv->chan[i].head_lock);
spin_lock_init(&priv->chan[i].tail_lock); spin_lock_init(&priv->chan[i].tail_lock);
priv->chan[i].fifo = devm_kzalloc(dev, priv->chan[i].fifo = devm_kcalloc(dev,
sizeof(struct talitos_request) * priv->fifo_len,
priv->fifo_len, GFP_KERNEL); sizeof(struct talitos_request),
GFP_KERNEL);
if (!priv->chan[i].fifo) { if (!priv->chan[i].fifo) {
dev_err(dev, "failed to allocate request fifo %d\n", i); dev_err(dev, "failed to allocate request fifo %d\n", i);
err = -ENOMEM; err = -ENOMEM;

View File

@ -628,14 +628,15 @@ struct devfreq *devfreq_add_device(struct device *dev,
goto err_dev; goto err_dev;
} }
devfreq->trans_table = devm_kzalloc(&devfreq->dev, devfreq->trans_table =
sizeof(unsigned int) * devm_kzalloc(&devfreq->dev,
devfreq->profile->max_state * array3_size(sizeof(unsigned int),
devfreq->profile->max_state, devfreq->profile->max_state,
GFP_KERNEL); devfreq->profile->max_state),
devfreq->time_in_state = devm_kzalloc(&devfreq->dev, GFP_KERNEL);
sizeof(unsigned long) * devfreq->time_in_state = devm_kcalloc(&devfreq->dev,
devfreq->profile->max_state, devfreq->profile->max_state,
sizeof(unsigned long),
GFP_KERNEL); GFP_KERNEL);
devfreq->last_stat_updated = jiffies; devfreq->last_stat_updated = jiffies;

View File

@ -518,7 +518,7 @@ static int of_get_devfreq_events(struct device_node *np,
event_ops = exynos_bus_get_ops(np); event_ops = exynos_bus_get_ops(np);
count = of_get_child_count(events_np); count = of_get_child_count(events_np);
desc = devm_kzalloc(dev, sizeof(*desc) * count, GFP_KERNEL); desc = devm_kcalloc(dev, count, sizeof(*desc), GFP_KERNEL);
if (!desc) if (!desc)
return -ENOMEM; return -ENOMEM;
info->num_events = count; info->num_events = count;

View File

@ -848,8 +848,8 @@ static int k3_dma_probe(struct platform_device *op)
return -ENOMEM; return -ENOMEM;
/* init phy channel */ /* init phy channel */
d->phy = devm_kzalloc(&op->dev, d->phy = devm_kcalloc(&op->dev,
d->dma_channels * sizeof(struct k3_dma_phy), GFP_KERNEL); d->dma_channels, sizeof(struct k3_dma_phy), GFP_KERNEL);
if (d->phy == NULL) if (d->phy == NULL)
return -ENOMEM; return -ENOMEM;
@ -879,8 +879,8 @@ static int k3_dma_probe(struct platform_device *op)
d->slave.copy_align = DMAENGINE_ALIGN_8_BYTES; d->slave.copy_align = DMAENGINE_ALIGN_8_BYTES;
/* init virtual channel */ /* init virtual channel */
d->chans = devm_kzalloc(&op->dev, d->chans = devm_kcalloc(&op->dev,
d->dma_requests * sizeof(struct k3_dma_chan), GFP_KERNEL); d->dma_requests, sizeof(struct k3_dma_chan), GFP_KERNEL);
if (d->chans == NULL) if (d->chans == NULL)
return -ENOMEM; return -ENOMEM;

View File

@ -809,8 +809,9 @@ static int mv_xor_v2_probe(struct platform_device *pdev)
} }
/* alloc memory for the SW descriptors */ /* alloc memory for the SW descriptors */
xor_dev->sw_desq = devm_kzalloc(&pdev->dev, sizeof(*sw_desc) * xor_dev->sw_desq = devm_kcalloc(&pdev->dev,
MV_XOR_V2_DESC_NUM, GFP_KERNEL); MV_XOR_V2_DESC_NUM, sizeof(*sw_desc),
GFP_KERNEL);
if (!xor_dev->sw_desq) { if (!xor_dev->sw_desq) {
ret = -ENOMEM; ret = -ENOMEM;
goto free_hw_desq; goto free_hw_desq;

View File

@ -1223,9 +1223,9 @@ static int s3c24xx_dma_probe(struct platform_device *pdev)
if (IS_ERR(s3cdma->base)) if (IS_ERR(s3cdma->base))
return PTR_ERR(s3cdma->base); return PTR_ERR(s3cdma->base);
s3cdma->phy_chans = devm_kzalloc(&pdev->dev, s3cdma->phy_chans = devm_kcalloc(&pdev->dev,
sizeof(struct s3c24xx_dma_phy) * pdata->num_phy_channels,
pdata->num_phy_channels, sizeof(struct s3c24xx_dma_phy),
GFP_KERNEL); GFP_KERNEL);
if (!s3cdma->phy_chans) if (!s3cdma->phy_chans)
return -ENOMEM; return -ENOMEM;

View File

@ -798,8 +798,8 @@ static int zx_dma_probe(struct platform_device *op)
return -ENOMEM; return -ENOMEM;
/* init phy channel */ /* init phy channel */
d->phy = devm_kzalloc(&op->dev, d->phy = devm_kcalloc(&op->dev,
d->dma_channels * sizeof(struct zx_dma_phy), GFP_KERNEL); d->dma_channels, sizeof(struct zx_dma_phy), GFP_KERNEL);
if (!d->phy) if (!d->phy)
return -ENOMEM; return -ENOMEM;
@ -834,8 +834,8 @@ static int zx_dma_probe(struct platform_device *op)
d->slave.residue_granularity = DMA_RESIDUE_GRANULARITY_SEGMENT; d->slave.residue_granularity = DMA_RESIDUE_GRANULARITY_SEGMENT;
/* init virtual channel */ /* init virtual channel */
d->chans = devm_kzalloc(&op->dev, d->chans = devm_kcalloc(&op->dev,
d->dma_requests * sizeof(struct zx_dma_chan), GFP_KERNEL); d->dma_requests, sizeof(struct zx_dma_chan), GFP_KERNEL);
if (!d->chans) if (!d->chans)
return -ENOMEM; return -ENOMEM;

View File

@ -890,7 +890,7 @@ static int scpi_alloc_xfer_list(struct device *dev, struct scpi_chan *ch)
int i; int i;
struct scpi_xfer *xfers; struct scpi_xfer *xfers;
xfers = devm_kzalloc(dev, MAX_SCPI_XFERS * sizeof(*xfers), GFP_KERNEL); xfers = devm_kcalloc(dev, MAX_SCPI_XFERS, sizeof(*xfers), GFP_KERNEL);
if (!xfers) if (!xfers)
return -ENOMEM; return -ENOMEM;

View File

@ -1862,9 +1862,9 @@ static int ti_sci_probe(struct platform_device *pdev)
if (!minfo->xfer_block) if (!minfo->xfer_block)
return -ENOMEM; return -ENOMEM;
minfo->xfer_alloc_table = devm_kzalloc(dev, minfo->xfer_alloc_table = devm_kcalloc(dev,
BITS_TO_LONGS(desc->max_msgs) BITS_TO_LONGS(desc->max_msgs),
* sizeof(unsigned long), sizeof(unsigned long),
GFP_KERNEL); GFP_KERNEL);
if (!minfo->xfer_alloc_table) if (!minfo->xfer_alloc_table)
return -ENOMEM; return -ENOMEM;

View File

@ -427,7 +427,7 @@ static int adnp_irq_setup(struct adnp *adnp)
* is chosen to match the register layout of the hardware in that * is chosen to match the register layout of the hardware in that
* each segment contains the corresponding bits for all interrupts. * each segment contains the corresponding bits for all interrupts.
*/ */
adnp->irq_enable = devm_kzalloc(chip->parent, num_regs * 6, adnp->irq_enable = devm_kcalloc(chip->parent, num_regs, 6,
GFP_KERNEL); GFP_KERNEL);
if (!adnp->irq_enable) if (!adnp->irq_enable)
return -ENOMEM; return -ENOMEM;

View File

@ -897,8 +897,8 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev)
/* Allocate a cache of the output registers */ /* Allocate a cache of the output registers */
banks = gpio->config->nr_gpios >> 5; banks = gpio->config->nr_gpios >> 5;
gpio->dcache = devm_kzalloc(&pdev->dev, gpio->dcache = devm_kcalloc(&pdev->dev,
sizeof(u32) * banks, GFP_KERNEL); banks, sizeof(u32), GFP_KERNEL);
if (!gpio->dcache) if (!gpio->dcache)
return -ENOMEM; return -ENOMEM;

View File

@ -601,9 +601,10 @@ static int bcm_kona_gpio_probe(struct platform_device *pdev)
GPIO_MAX_BANK_NUM); GPIO_MAX_BANK_NUM);
return -ENXIO; return -ENXIO;
} }
kona_gpio->banks = devm_kzalloc(dev, kona_gpio->banks = devm_kcalloc(dev,
kona_gpio->num_bank * kona_gpio->num_bank,
sizeof(*kona_gpio->banks), GFP_KERNEL); sizeof(*kona_gpio->banks),
GFP_KERNEL);
if (!kona_gpio->banks) if (!kona_gpio->banks)
return -ENOMEM; return -ENOMEM;

View File

@ -198,8 +198,8 @@ static int davinci_gpio_probe(struct platform_device *pdev)
ngpio = ARCH_NR_GPIOS; ngpio = ARCH_NR_GPIOS;
nbank = DIV_ROUND_UP(ngpio, 32); nbank = DIV_ROUND_UP(ngpio, 32);
chips = devm_kzalloc(dev, chips = devm_kcalloc(dev,
nbank * sizeof(struct davinci_gpio_controller), nbank, sizeof(struct davinci_gpio_controller),
GFP_KERNEL); GFP_KERNEL);
if (!chips) if (!chips)
return -ENOMEM; return -ENOMEM;

View File

@ -321,8 +321,8 @@ static int __init egpio_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ei); platform_set_drvdata(pdev, ei);
ei->nchips = pdata->num_chips; ei->nchips = pdata->num_chips;
ei->chip = devm_kzalloc(&pdev->dev, ei->chip = devm_kcalloc(&pdev->dev,
sizeof(struct egpio_chip) * ei->nchips, ei->nchips, sizeof(struct egpio_chip),
GFP_KERNEL); GFP_KERNEL);
if (!ei->chip) { if (!ei->chip) {
ret = -ENOMEM; ret = -ENOMEM;

View File

@ -504,16 +504,17 @@ static int thunderx_gpio_probe(struct pci_dev *pdev,
txgpio->base_msi = (c >> 8) & 0xff; txgpio->base_msi = (c >> 8) & 0xff;
} }
txgpio->msix_entries = devm_kzalloc(dev, txgpio->msix_entries = devm_kcalloc(dev,
sizeof(struct msix_entry) * ngpio, ngpio, sizeof(struct msix_entry),
GFP_KERNEL); GFP_KERNEL);
if (!txgpio->msix_entries) { if (!txgpio->msix_entries) {
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
} }
txgpio->line_entries = devm_kzalloc(dev, txgpio->line_entries = devm_kcalloc(dev,
sizeof(struct thunderx_line) * ngpio, ngpio,
sizeof(struct thunderx_line),
GFP_KERNEL); GFP_KERNEL);
if (!txgpio->line_entries) { if (!txgpio->line_entries) {
err = -ENOMEM; err = -ENOMEM;

View File

@ -1723,8 +1723,8 @@ static int exynos_dsi_probe(struct platform_device *pdev)
return -EPROBE_DEFER; return -EPROBE_DEFER;
} }
dsi->clks = devm_kzalloc(dev, dsi->clks = devm_kcalloc(dev,
sizeof(*dsi->clks) * dsi->driver_data->num_clks, dsi->driver_data->num_clks, sizeof(*dsi->clks),
GFP_KERNEL); GFP_KERNEL);
if (!dsi->clks) if (!dsi->clks)
return -ENOMEM; return -ENOMEM;

View File

@ -1271,7 +1271,8 @@ static int fimc_probe(struct platform_device *pdev)
/* construct formats/limits array */ /* construct formats/limits array */
num_formats = ARRAY_SIZE(fimc_formats) + ARRAY_SIZE(fimc_tiled_formats); num_formats = ARRAY_SIZE(fimc_formats) + ARRAY_SIZE(fimc_tiled_formats);
formats = devm_kzalloc(dev, sizeof(*formats) * num_formats, GFP_KERNEL); formats = devm_kcalloc(dev, num_formats, sizeof(*formats),
GFP_KERNEL);
if (!formats) if (!formats)
return -ENOMEM; return -ENOMEM;

View File

@ -1202,8 +1202,9 @@ static int gsc_probe(struct platform_device *pdev)
if (!ctx) if (!ctx)
return -ENOMEM; return -ENOMEM;
formats = devm_kzalloc(dev, sizeof(*formats) * formats = devm_kcalloc(dev,
(ARRAY_SIZE(gsc_formats)), GFP_KERNEL); ARRAY_SIZE(gsc_formats), sizeof(*formats),
GFP_KERNEL);
if (!formats) if (!formats)
return -ENOMEM; return -ENOMEM;

View File

@ -1692,7 +1692,7 @@ static int hdmi_clk_init(struct hdmi_context *hdata)
if (!count) if (!count)
return 0; return 0;
clks = devm_kzalloc(dev, sizeof(*clks) * count, GFP_KERNEL); clks = devm_kcalloc(dev, count, sizeof(*clks), GFP_KERNEL);
if (!clks) if (!clks)
return -ENOMEM; return -ENOMEM;

View File

@ -157,8 +157,10 @@ static struct hdmi *msm_hdmi_init(struct platform_device *pdev)
hdmi->qfprom_mmio = NULL; hdmi->qfprom_mmio = NULL;
} }
hdmi->hpd_regs = devm_kzalloc(&pdev->dev, sizeof(hdmi->hpd_regs[0]) * hdmi->hpd_regs = devm_kcalloc(&pdev->dev,
config->hpd_reg_cnt, GFP_KERNEL); config->hpd_reg_cnt,
sizeof(hdmi->hpd_regs[0]),
GFP_KERNEL);
if (!hdmi->hpd_regs) { if (!hdmi->hpd_regs) {
ret = -ENOMEM; ret = -ENOMEM;
goto fail; goto fail;
@ -178,8 +180,10 @@ static struct hdmi *msm_hdmi_init(struct platform_device *pdev)
hdmi->hpd_regs[i] = reg; hdmi->hpd_regs[i] = reg;
} }
hdmi->pwr_regs = devm_kzalloc(&pdev->dev, sizeof(hdmi->pwr_regs[0]) * hdmi->pwr_regs = devm_kcalloc(&pdev->dev,
config->pwr_reg_cnt, GFP_KERNEL); config->pwr_reg_cnt,
sizeof(hdmi->pwr_regs[0]),
GFP_KERNEL);
if (!hdmi->pwr_regs) { if (!hdmi->pwr_regs) {
ret = -ENOMEM; ret = -ENOMEM;
goto fail; goto fail;
@ -199,8 +203,10 @@ static struct hdmi *msm_hdmi_init(struct platform_device *pdev)
hdmi->pwr_regs[i] = reg; hdmi->pwr_regs[i] = reg;
} }
hdmi->hpd_clks = devm_kzalloc(&pdev->dev, sizeof(hdmi->hpd_clks[0]) * hdmi->hpd_clks = devm_kcalloc(&pdev->dev,
config->hpd_clk_cnt, GFP_KERNEL); config->hpd_clk_cnt,
sizeof(hdmi->hpd_clks[0]),
GFP_KERNEL);
if (!hdmi->hpd_clks) { if (!hdmi->hpd_clks) {
ret = -ENOMEM; ret = -ENOMEM;
goto fail; goto fail;
@ -219,8 +225,10 @@ static struct hdmi *msm_hdmi_init(struct platform_device *pdev)
hdmi->hpd_clks[i] = clk; hdmi->hpd_clks[i] = clk;
} }
hdmi->pwr_clks = devm_kzalloc(&pdev->dev, sizeof(hdmi->pwr_clks[0]) * hdmi->pwr_clks = devm_kcalloc(&pdev->dev,
config->pwr_clk_cnt, GFP_KERNEL); config->pwr_clk_cnt,
sizeof(hdmi->pwr_clks[0]),
GFP_KERNEL);
if (!hdmi->pwr_clks) { if (!hdmi->pwr_clks) {
ret = -ENOMEM; ret = -ENOMEM;
goto fail; goto fail;

View File

@ -21,12 +21,12 @@ static int msm_hdmi_phy_resource_init(struct hdmi_phy *phy)
struct device *dev = &phy->pdev->dev; struct device *dev = &phy->pdev->dev;
int i, ret; int i, ret;
phy->regs = devm_kzalloc(dev, sizeof(phy->regs[0]) * cfg->num_regs, phy->regs = devm_kcalloc(dev, cfg->num_regs, sizeof(phy->regs[0]),
GFP_KERNEL); GFP_KERNEL);
if (!phy->regs) if (!phy->regs)
return -ENOMEM; return -ENOMEM;
phy->clks = devm_kzalloc(dev, sizeof(phy->clks[0]) * cfg->num_clks, phy->clks = devm_kcalloc(dev, cfg->num_clks, sizeof(phy->clks[0]),
GFP_KERNEL); GFP_KERNEL);
if (!phy->clks) if (!phy->clks)
return -ENOMEM; return -ENOMEM;

View File

@ -624,7 +624,8 @@ static int sensor_hub_probe(struct hid_device *hdev,
ret = -EINVAL; ret = -EINVAL;
goto err_stop_hw; goto err_stop_hw;
} }
sd->hid_sensor_hub_client_devs = devm_kzalloc(&hdev->dev, dev_cnt * sd->hid_sensor_hub_client_devs = devm_kcalloc(&hdev->dev,
dev_cnt,
sizeof(struct mfd_cell), sizeof(struct mfd_cell),
GFP_KERNEL); GFP_KERNEL);
if (sd->hid_sensor_hub_client_devs == NULL) { if (sd->hid_sensor_hub_client_devs == NULL) {

View File

@ -121,9 +121,9 @@ static void process_recv(struct ishtp_cl *hid_ishtp_cl, void *recv_buf,
} }
client_data->hid_dev_count = (unsigned int)*payload; client_data->hid_dev_count = (unsigned int)*payload;
if (!client_data->hid_devices) if (!client_data->hid_devices)
client_data->hid_devices = devm_kzalloc( client_data->hid_devices = devm_kcalloc(
&client_data->cl_device->dev, &client_data->cl_device->dev,
client_data->hid_dev_count * client_data->hid_dev_count,
sizeof(struct device_info), sizeof(struct device_info),
GFP_KERNEL); GFP_KERNEL);
if (!client_data->hid_devices) { if (!client_data->hid_devices) {

View File

@ -1363,7 +1363,7 @@ static int wacom_led_groups_alloc_and_register_one(struct device *dev,
if (!devres_open_group(dev, &wacom->led.groups[group_id], GFP_KERNEL)) if (!devres_open_group(dev, &wacom->led.groups[group_id], GFP_KERNEL))
return -ENOMEM; return -ENOMEM;
leds = devm_kzalloc(dev, sizeof(struct wacom_led) * count, GFP_KERNEL); leds = devm_kcalloc(dev, count, sizeof(struct wacom_led), GFP_KERNEL);
if (!leds) { if (!leds) {
error = -ENOMEM; error = -ENOMEM;
goto err; goto err;
@ -1463,7 +1463,7 @@ static int wacom_led_groups_allocate(struct wacom *wacom, int count)
struct wacom_group_leds *groups; struct wacom_group_leds *groups;
int error; int error;
groups = devm_kzalloc(dev, sizeof(struct wacom_group_leds) * count, groups = devm_kcalloc(dev, count, sizeof(struct wacom_group_leds),
GFP_KERNEL); GFP_KERNEL);
if (!groups) if (!groups)
return -ENOMEM; return -ENOMEM;

View File

@ -894,7 +894,7 @@ static int aspeed_create_fan(struct device *dev,
count = of_property_count_u8_elems(child, "aspeed,fan-tach-ch"); count = of_property_count_u8_elems(child, "aspeed,fan-tach-ch");
if (count < 1) if (count < 1)
return -EINVAL; return -EINVAL;
fan_tach_ch = devm_kzalloc(dev, sizeof(*fan_tach_ch) * count, fan_tach_ch = devm_kcalloc(dev, count, sizeof(*fan_tach_ch),
GFP_KERNEL); GFP_KERNEL);
if (!fan_tach_ch) if (!fan_tach_ch)
return -ENOMEM; return -ENOMEM;

View File

@ -441,8 +441,8 @@ static int gpio_fan_get_of_data(struct gpio_fan_data *fan_data)
dev_err(dev, "DT properties empty / missing"); dev_err(dev, "DT properties empty / missing");
return -ENODEV; return -ENODEV;
} }
gpios = devm_kzalloc(dev, gpios = devm_kcalloc(dev,
fan_data->num_gpios * sizeof(struct gpio_desc *), fan_data->num_gpios, sizeof(struct gpio_desc *),
GFP_KERNEL); GFP_KERNEL);
if (!gpios) if (!gpios)
return -ENOMEM; return -ENOMEM;
@ -471,8 +471,8 @@ static int gpio_fan_get_of_data(struct gpio_fan_data *fan_data)
* Speed map is in the form <RPM ctrl_val RPM ctrl_val ...> * Speed map is in the form <RPM ctrl_val RPM ctrl_val ...>
* this needs splitting into pairs to create gpio_fan_speed structs * this needs splitting into pairs to create gpio_fan_speed structs
*/ */
speed = devm_kzalloc(dev, speed = devm_kcalloc(dev,
fan_data->num_speed * sizeof(struct gpio_fan_speed), fan_data->num_speed, sizeof(struct gpio_fan_speed),
GFP_KERNEL); GFP_KERNEL);
if (!speed) if (!speed)
return -ENOMEM; return -ENOMEM;

View File

@ -326,9 +326,9 @@ static int populate_attr_groups(struct platform_device *pdev)
of_node_put(opal); of_node_put(opal);
for (type = 0; type < MAX_SENSOR_TYPE; type++) { for (type = 0; type < MAX_SENSOR_TYPE; type++) {
sensor_groups[type].group.attrs = devm_kzalloc(&pdev->dev, sensor_groups[type].group.attrs = devm_kcalloc(&pdev->dev,
sizeof(struct attribute *) * sensor_groups[type].attr_count + 1,
(sensor_groups[type].attr_count + 1), sizeof(struct attribute *),
GFP_KERNEL); GFP_KERNEL);
if (!sensor_groups[type].group.attrs) if (!sensor_groups[type].group.attrs)
return -ENOMEM; return -ENOMEM;
@ -409,7 +409,8 @@ static int create_device_attrs(struct platform_device *pdev)
int err = 0; int err = 0;
opal = of_find_node_by_path("/ibm,opal/sensors"); opal = of_find_node_by_path("/ibm,opal/sensors");
sdata = devm_kzalloc(&pdev->dev, pdata->sensors_count * sizeof(*sdata), sdata = devm_kcalloc(&pdev->dev,
pdata->sensors_count, sizeof(*sdata),
GFP_KERNEL); GFP_KERNEL);
if (!sdata) { if (!sdata) {
err = -ENOMEM; err = -ENOMEM;

View File

@ -92,8 +92,8 @@ static int iio_hwmon_probe(struct platform_device *pdev)
while (st->channels[st->num_channels].indio_dev) while (st->channels[st->num_channels].indio_dev)
st->num_channels++; st->num_channels++;
st->attrs = devm_kzalloc(dev, st->attrs = devm_kcalloc(dev,
sizeof(*st->attrs) * (st->num_channels + 1), st->num_channels + 1, sizeof(*st->attrs),
GFP_KERNEL); GFP_KERNEL);
if (st->attrs == NULL) { if (st->attrs == NULL) {
ret = -ENOMEM; ret = -ENOMEM;

View File

@ -426,12 +426,12 @@ nct6683_create_attr_group(struct device *dev,
if (group == NULL) if (group == NULL)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
attrs = devm_kzalloc(dev, sizeof(*attrs) * (repeat * count + 1), attrs = devm_kcalloc(dev, repeat * count + 1, sizeof(*attrs),
GFP_KERNEL); GFP_KERNEL);
if (attrs == NULL) if (attrs == NULL)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
su = devm_kzalloc(dev, sizeof(*su) * repeat * count, su = devm_kzalloc(dev, array3_size(repeat, count, sizeof(*su)),
GFP_KERNEL); GFP_KERNEL);
if (su == NULL) if (su == NULL)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);

View File

@ -1190,12 +1190,12 @@ nct6775_create_attr_group(struct device *dev,
if (group == NULL) if (group == NULL)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
attrs = devm_kzalloc(dev, sizeof(*attrs) * (repeat * count + 1), attrs = devm_kcalloc(dev, repeat * count + 1, sizeof(*attrs),
GFP_KERNEL); GFP_KERNEL);
if (attrs == NULL) if (attrs == NULL)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
su = devm_kzalloc(dev, sizeof(*su) * repeat * count, su = devm_kzalloc(dev, array3_size(repeat, count, sizeof(*su)),
GFP_KERNEL); GFP_KERNEL);
if (su == NULL) if (su == NULL)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);

View File

@ -2176,8 +2176,8 @@ static int pmbus_init_debugfs(struct i2c_client *client,
} }
/* Allocate the max possible entries we need. */ /* Allocate the max possible entries we need. */
entries = devm_kzalloc(data->dev, entries = devm_kcalloc(data->dev,
sizeof(*entries) * (data->info->pages * 10), data->info->pages * 10, sizeof(*entries),
GFP_KERNEL); GFP_KERNEL);
if (!entries) if (!entries)
return -ENOMEM; return -ENOMEM;

View File

@ -454,8 +454,8 @@ static int ucd9000_init_debugfs(struct i2c_client *client,
*/ */
if (mid->driver_data == ucd9090 || mid->driver_data == ucd90160 || if (mid->driver_data == ucd9090 || mid->driver_data == ucd90160 ||
mid->driver_data == ucd90910) { mid->driver_data == ucd90910) {
entries = devm_kzalloc(&client->dev, entries = devm_kcalloc(&client->dev,
sizeof(*entries) * UCD9000_GPI_COUNT, UCD9000_GPI_COUNT, sizeof(*entries),
GFP_KERNEL); GFP_KERNEL);
if (!entries) if (!entries)
return -ENOMEM; return -ENOMEM;

View File

@ -180,7 +180,7 @@ static int pwm_fan_of_get_cooling_data(struct device *dev,
} }
num = ret; num = ret;
ctx->pwm_fan_cooling_levels = devm_kzalloc(dev, num * sizeof(u32), ctx->pwm_fan_cooling_levels = devm_kcalloc(dev, num, sizeof(u32),
GFP_KERNEL); GFP_KERNEL);
if (!ctx->pwm_fan_cooling_levels) if (!ctx->pwm_fan_cooling_levels)
return -ENOMEM; return -ENOMEM;

View File

@ -683,8 +683,8 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id)
if (drvdata->buffer_depth & 0x80000000) if (drvdata->buffer_depth & 0x80000000)
return -EINVAL; return -EINVAL;
drvdata->buf = devm_kzalloc(dev, drvdata->buf = devm_kcalloc(dev,
drvdata->buffer_depth * 4, GFP_KERNEL); drvdata->buffer_depth, 4, GFP_KERNEL);
if (!drvdata->buf) if (!drvdata->buf)
return -ENOMEM; return -ENOMEM;

View File

@ -71,21 +71,24 @@ static int of_coresight_alloc_memory(struct device *dev,
struct coresight_platform_data *pdata) struct coresight_platform_data *pdata)
{ {
/* List of output port on this component */ /* List of output port on this component */
pdata->outports = devm_kzalloc(dev, pdata->nr_outport * pdata->outports = devm_kcalloc(dev,
pdata->nr_outport,
sizeof(*pdata->outports), sizeof(*pdata->outports),
GFP_KERNEL); GFP_KERNEL);
if (!pdata->outports) if (!pdata->outports)
return -ENOMEM; return -ENOMEM;
/* Children connected to this component via @outports */ /* Children connected to this component via @outports */
pdata->child_names = devm_kzalloc(dev, pdata->nr_outport * pdata->child_names = devm_kcalloc(dev,
pdata->nr_outport,
sizeof(*pdata->child_names), sizeof(*pdata->child_names),
GFP_KERNEL); GFP_KERNEL);
if (!pdata->child_names) if (!pdata->child_names)
return -ENOMEM; return -ENOMEM;
/* Port number on the child this component is connected to */ /* Port number on the child this component is connected to */
pdata->child_ports = devm_kzalloc(dev, pdata->nr_outport * pdata->child_ports = devm_kcalloc(dev,
pdata->nr_outport,
sizeof(*pdata->child_ports), sizeof(*pdata->child_ports),
GFP_KERNEL); GFP_KERNEL);
if (!pdata->child_ports) if (!pdata->child_ports)

View File

@ -1691,8 +1691,8 @@ static int qup_i2c_probe(struct platform_device *pdev)
qup->max_xfer_sg_len = (MX_BLOCKS << 1); qup->max_xfer_sg_len = (MX_BLOCKS << 1);
blocks = (MX_DMA_BLOCKS << 1) + 1; blocks = (MX_DMA_BLOCKS << 1) + 1;
qup->btx.sg = devm_kzalloc(&pdev->dev, qup->btx.sg = devm_kcalloc(&pdev->dev,
sizeof(*qup->btx.sg) * blocks, blocks, sizeof(*qup->btx.sg),
GFP_KERNEL); GFP_KERNEL);
if (!qup->btx.sg) { if (!qup->btx.sg) {
ret = -ENOMEM; ret = -ENOMEM;
@ -1700,8 +1700,8 @@ static int qup_i2c_probe(struct platform_device *pdev)
} }
sg_init_table(qup->btx.sg, blocks); sg_init_table(qup->btx.sg, blocks);
qup->brx.sg = devm_kzalloc(&pdev->dev, qup->brx.sg = devm_kcalloc(&pdev->dev,
sizeof(*qup->brx.sg) * blocks, blocks, sizeof(*qup->brx.sg),
GFP_KERNEL); GFP_KERNEL);
if (!qup->brx.sg) { if (!qup->brx.sg) {
ret = -ENOMEM; ret = -ENOMEM;

View File

@ -88,8 +88,8 @@ static int i2c_mux_gpio_probe_dt(struct gpiomux *mux,
mux->data.n_values = of_get_child_count(np); mux->data.n_values = of_get_child_count(np);
values = devm_kzalloc(&pdev->dev, values = devm_kcalloc(&pdev->dev,
sizeof(*mux->data.values) * mux->data.n_values, mux->data.n_values, sizeof(*mux->data.values),
GFP_KERNEL); GFP_KERNEL);
if (!values) { if (!values) {
dev_err(&pdev->dev, "Cannot allocate values array"); dev_err(&pdev->dev, "Cannot allocate values array");
@ -111,8 +111,9 @@ static int i2c_mux_gpio_probe_dt(struct gpiomux *mux,
return -EINVAL; return -EINVAL;
} }
gpios = devm_kzalloc(&pdev->dev, gpios = devm_kcalloc(&pdev->dev,
sizeof(*mux->data.gpios) * mux->data.n_gpios, GFP_KERNEL); mux->data.n_gpios, sizeof(*mux->data.gpios),
GFP_KERNEL);
if (!gpios) { if (!gpios) {
dev_err(&pdev->dev, "Cannot allocate gpios array"); dev_err(&pdev->dev, "Cannot allocate gpios array");
return -ENOMEM; return -ENOMEM;

View File

@ -124,8 +124,8 @@ static int i2c_mux_reg_probe_dt(struct regmux *mux,
} }
mux->data.write_only = of_property_read_bool(np, "write-only"); mux->data.write_only = of_property_read_bool(np, "write-only");
values = devm_kzalloc(&pdev->dev, values = devm_kcalloc(&pdev->dev,
sizeof(*mux->data.values) * mux->data.n_values, mux->data.n_values, sizeof(*mux->data.values),
GFP_KERNEL); GFP_KERNEL);
if (!values) { if (!values) {
dev_err(&pdev->dev, "Cannot allocate values array"); dev_err(&pdev->dev, "Cannot allocate values array");

View File

@ -624,8 +624,8 @@ static int at91_adc_trigger_init(struct iio_dev *idev)
struct at91_adc_state *st = iio_priv(idev); struct at91_adc_state *st = iio_priv(idev);
int i, ret; int i, ret;
st->trig = devm_kzalloc(&idev->dev, st->trig = devm_kcalloc(&idev->dev,
st->trigger_number * sizeof(*st->trig), st->trigger_number, sizeof(*st->trig),
GFP_KERNEL); GFP_KERNEL);
if (st->trig == NULL) { if (st->trig == NULL) {
@ -908,7 +908,8 @@ static int at91_adc_probe_dt(struct at91_adc_state *st,
st->registers = &st->caps->registers; st->registers = &st->caps->registers;
st->num_channels = st->caps->num_channels; st->num_channels = st->caps->num_channels;
st->trigger_number = of_get_child_count(node); st->trigger_number = of_get_child_count(node);
st->trigger_list = devm_kzalloc(&idev->dev, st->trigger_number * st->trigger_list = devm_kcalloc(&idev->dev,
st->trigger_number,
sizeof(struct at91_adc_trigger), sizeof(struct at91_adc_trigger),
GFP_KERNEL); GFP_KERNEL);
if (!st->trigger_list) { if (!st->trigger_list) {

View File

@ -1453,8 +1453,10 @@ static int max1363_alloc_scan_masks(struct iio_dev *indio_dev)
int i; int i;
masks = devm_kzalloc(&indio_dev->dev, masks = devm_kzalloc(&indio_dev->dev,
BITS_TO_LONGS(MAX1363_MAX_CHANNELS) * sizeof(long) * array3_size(BITS_TO_LONGS(MAX1363_MAX_CHANNELS),
(st->chip_info->num_modes + 1), GFP_KERNEL); sizeof(long),
st->chip_info->num_modes + 1),
GFP_KERNEL);
if (!masks) if (!masks)
return -ENOMEM; return -ENOMEM;

View File

@ -898,9 +898,10 @@ static int twl6030_gpadc_probe(struct platform_device *pdev)
gpadc = iio_priv(indio_dev); gpadc = iio_priv(indio_dev);
gpadc->twl6030_cal_tbl = devm_kzalloc(dev, gpadc->twl6030_cal_tbl = devm_kcalloc(dev,
sizeof(*gpadc->twl6030_cal_tbl) * pdata->nchannels,
pdata->nchannels, GFP_KERNEL); sizeof(*gpadc->twl6030_cal_tbl),
GFP_KERNEL);
if (!gpadc->twl6030_cal_tbl) if (!gpadc->twl6030_cal_tbl)
return -ENOMEM; return -ENOMEM;

View File

@ -536,8 +536,9 @@ static int ad5592r_alloc_channels(struct ad5592r_state *st)
st->channel_offstate[reg] = tmp; st->channel_offstate[reg] = tmp;
} }
channels = devm_kzalloc(st->dev, channels = devm_kcalloc(st->dev,
(1 + 2 * num_channels) * sizeof(*channels), GFP_KERNEL); 1 + 2 * num_channels, sizeof(*channels),
GFP_KERNEL);
if (!channels) if (!channels)
return -ENOMEM; return -ENOMEM;

View File

@ -281,9 +281,10 @@ static int mux_configure_channel(struct device *dev, struct mux *mux,
if (!page) if (!page)
return -ENOMEM; return -ENOMEM;
} }
child->ext_info_cache = devm_kzalloc(dev, child->ext_info_cache = devm_kcalloc(dev,
sizeof(*child->ext_info_cache) * num_ext_info,
num_ext_info, GFP_KERNEL); sizeof(*child->ext_info_cache),
GFP_KERNEL);
if (!child->ext_info_cache) if (!child->ext_info_cache)
return -ENOMEM; return -ENOMEM;

View File

@ -109,8 +109,8 @@ static int clps711x_keypad_probe(struct platform_device *pdev)
if (priv->row_count < 1) if (priv->row_count < 1)
return -EINVAL; return -EINVAL;
priv->gpio_data = devm_kzalloc(dev, priv->gpio_data = devm_kcalloc(dev,
sizeof(*priv->gpio_data) * priv->row_count, priv->row_count, sizeof(*priv->gpio_data),
GFP_KERNEL); GFP_KERNEL);
if (!priv->gpio_data) if (!priv->gpio_data)
return -ENOMEM; return -ENOMEM;

View File

@ -443,9 +443,9 @@ matrix_keypad_parse_dt(struct device *dev)
of_property_read_u32(np, "col-scan-delay-us", of_property_read_u32(np, "col-scan-delay-us",
&pdata->col_scan_delay_us); &pdata->col_scan_delay_us);
gpios = devm_kzalloc(dev, gpios = devm_kcalloc(dev,
sizeof(unsigned int) * pdata->num_row_gpios + pdata->num_col_gpios,
(pdata->num_row_gpios + pdata->num_col_gpios), sizeof(unsigned int),
GFP_KERNEL); GFP_KERNEL);
if (!gpios) { if (!gpios) {
dev_err(dev, "could not allocate memory for gpios\n"); dev_err(dev, "could not allocate memory for gpios\n");

View File

@ -281,7 +281,7 @@ samsung_keypad_parse_dt(struct device *dev)
key_count = of_get_child_count(np); key_count = of_get_child_count(np);
keymap_data->keymap_size = key_count; keymap_data->keymap_size = key_count;
keymap = devm_kzalloc(dev, sizeof(uint32_t) * key_count, GFP_KERNEL); keymap = devm_kcalloc(dev, key_count, sizeof(uint32_t), GFP_KERNEL);
if (!keymap) { if (!keymap) {
dev_err(dev, "could not allocate memory for keymap\n"); dev_err(dev, "could not allocate memory for keymap\n");
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);

View File

@ -170,8 +170,8 @@ int matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data,
return -EINVAL; return -EINVAL;
if (!keymap) { if (!keymap) {
keymap = devm_kzalloc(input_dev->dev.parent, keymap = devm_kcalloc(input_dev->dev.parent,
max_keys * sizeof(*keymap), max_keys, sizeof(*keymap),
GFP_KERNEL); GFP_KERNEL);
if (!keymap) { if (!keymap) {
dev_err(input_dev->dev.parent, dev_err(input_dev->dev.parent,

View File

@ -283,8 +283,8 @@ static int rotary_encoder_probe(struct platform_device *pdev)
} }
encoder->irq = encoder->irq =
devm_kzalloc(dev, devm_kcalloc(dev,
sizeof(*encoder->irq) * encoder->gpios->ndescs, encoder->gpios->ndescs, sizeof(*encoder->irq),
GFP_KERNEL); GFP_KERNEL);
if (!encoder->irq) if (!encoder->irq)
return -ENOMEM; return -ENOMEM;

View File

@ -636,9 +636,10 @@ int rmi_read_register_desc(struct rmi_device *d, u16 addr,
rdesc->num_registers = bitmap_weight(rdesc->presense_map, rdesc->num_registers = bitmap_weight(rdesc->presense_map,
RMI_REG_DESC_PRESENSE_BITS); RMI_REG_DESC_PRESENSE_BITS);
rdesc->registers = devm_kzalloc(&d->dev, rdesc->num_registers * rdesc->registers = devm_kcalloc(&d->dev,
sizeof(struct rmi_register_desc_item), rdesc->num_registers,
GFP_KERNEL); sizeof(struct rmi_register_desc_item),
GFP_KERNEL);
if (!rdesc->registers) if (!rdesc->registers)
return -ENOMEM; return -ENOMEM;
@ -1061,7 +1062,7 @@ int rmi_probe_interrupts(struct rmi_driver_data *data)
data->num_of_irq_regs = (data->irq_count + 7) / 8; data->num_of_irq_regs = (data->irq_count + 7) / 8;
size = BITS_TO_LONGS(data->irq_count) * sizeof(unsigned long); size = BITS_TO_LONGS(data->irq_count) * sizeof(unsigned long);
data->irq_memory = devm_kzalloc(dev, size * 4, GFP_KERNEL); data->irq_memory = devm_kcalloc(dev, size, 4, GFP_KERNEL);
if (!data->irq_memory) { if (!data->irq_memory) {
dev_err(dev, "Failed to allocate memory for irq masks.\n"); dev_err(dev, "Failed to allocate memory for irq masks.\n");
return -ENOMEM; return -ENOMEM;

View File

@ -1190,14 +1190,15 @@ static int rmi_f11_initialize(struct rmi_function *fn)
f11->sensor.attn_size += f11->sensor.nbr_fingers * 2; f11->sensor.attn_size += f11->sensor.nbr_fingers * 2;
/* allocate the in-kernel tracking buffers */ /* allocate the in-kernel tracking buffers */
sensor->tracking_pos = devm_kzalloc(&fn->dev, sensor->tracking_pos = devm_kcalloc(&fn->dev,
sizeof(struct input_mt_pos) * sensor->nbr_fingers, sensor->nbr_fingers, sizeof(struct input_mt_pos),
GFP_KERNEL);
sensor->tracking_slots = devm_kcalloc(&fn->dev,
sensor->nbr_fingers, sizeof(int), GFP_KERNEL);
sensor->objs = devm_kcalloc(&fn->dev,
sensor->nbr_fingers,
sizeof(struct rmi_2d_sensor_abs_object),
GFP_KERNEL); GFP_KERNEL);
sensor->tracking_slots = devm_kzalloc(&fn->dev,
sizeof(int) * sensor->nbr_fingers, GFP_KERNEL);
sensor->objs = devm_kzalloc(&fn->dev,
sizeof(struct rmi_2d_sensor_abs_object)
* sensor->nbr_fingers, GFP_KERNEL);
if (!sensor->tracking_pos || !sensor->tracking_slots || !sensor->objs) if (!sensor->tracking_pos || !sensor->tracking_slots || !sensor->objs)
return -ENOMEM; return -ENOMEM;

View File

@ -502,14 +502,15 @@ static int rmi_f12_probe(struct rmi_function *fn)
} }
/* allocate the in-kernel tracking buffers */ /* allocate the in-kernel tracking buffers */
sensor->tracking_pos = devm_kzalloc(&fn->dev, sensor->tracking_pos = devm_kcalloc(&fn->dev,
sizeof(struct input_mt_pos) * sensor->nbr_fingers, sensor->nbr_fingers, sizeof(struct input_mt_pos),
GFP_KERNEL);
sensor->tracking_slots = devm_kcalloc(&fn->dev,
sensor->nbr_fingers, sizeof(int), GFP_KERNEL);
sensor->objs = devm_kcalloc(&fn->dev,
sensor->nbr_fingers,
sizeof(struct rmi_2d_sensor_abs_object),
GFP_KERNEL); GFP_KERNEL);
sensor->tracking_slots = devm_kzalloc(&fn->dev,
sizeof(int) * sensor->nbr_fingers, GFP_KERNEL);
sensor->objs = devm_kzalloc(&fn->dev,
sizeof(struct rmi_2d_sensor_abs_object)
* sensor->nbr_fingers, GFP_KERNEL);
if (!sensor->tracking_pos || !sensor->tracking_slots || !sensor->objs) if (!sensor->tracking_pos || !sensor->tracking_slots || !sensor->objs)
return -ENOMEM; return -ENOMEM;

View File

@ -685,7 +685,7 @@ static int rmi_f54_probe(struct rmi_function *fn)
rx = f54->num_rx_electrodes; rx = f54->num_rx_electrodes;
tx = f54->num_tx_electrodes; tx = f54->num_tx_electrodes;
f54->report_data = devm_kzalloc(&fn->dev, f54->report_data = devm_kzalloc(&fn->dev,
sizeof(u16) * tx * rx, array3_size(tx, rx, sizeof(u16)),
GFP_KERNEL); GFP_KERNEL);
if (f54->report_data == NULL) if (f54->report_data == NULL)
return -ENOMEM; return -ENOMEM;

View File

@ -69,7 +69,7 @@ static int rmi_spi_manage_pools(struct rmi_spi_xport *rmi_spi, int len)
buf_size = RMI_SPI_XFER_SIZE_LIMIT; buf_size = RMI_SPI_XFER_SIZE_LIMIT;
tmp = rmi_spi->rx_buf; tmp = rmi_spi->rx_buf;
buf = devm_kzalloc(&spi->dev, buf_size * 2, buf = devm_kcalloc(&spi->dev, buf_size, 2,
GFP_KERNEL | GFP_DMA); GFP_KERNEL | GFP_DMA);
if (!buf) if (!buf)
return -ENOMEM; return -ENOMEM;
@ -96,9 +96,10 @@ static int rmi_spi_manage_pools(struct rmi_spi_xport *rmi_spi, int len)
* per byte delays. * per byte delays.
*/ */
tmp = rmi_spi->rx_xfers; tmp = rmi_spi->rx_xfers;
xfer_buf = devm_kzalloc(&spi->dev, xfer_buf = devm_kcalloc(&spi->dev,
(rmi_spi->rx_xfer_count + rmi_spi->tx_xfer_count) rmi_spi->rx_xfer_count + rmi_spi->tx_xfer_count,
* sizeof(struct spi_transfer), GFP_KERNEL); sizeof(struct spi_transfer),
GFP_KERNEL);
if (!xfer_buf) if (!xfer_buf)
return -ENOMEM; return -ENOMEM;

View File

@ -2082,7 +2082,7 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
return -ENODEV; return -ENODEV;
} }
smmu->irqs = devm_kzalloc(dev, sizeof(*smmu->irqs) * num_irqs, smmu->irqs = devm_kcalloc(dev, num_irqs, sizeof(*smmu->irqs),
GFP_KERNEL); GFP_KERNEL);
if (!smmu->irqs) { if (!smmu->irqs) {
dev_err(dev, "failed to allocate %d irqs\n", num_irqs); dev_err(dev, "failed to allocate %d irqs\n", num_irqs);

View File

@ -1135,7 +1135,7 @@ static int rk_iommu_probe(struct platform_device *pdev)
iommu->dev = dev; iommu->dev = dev;
iommu->num_mmu = 0; iommu->num_mmu = 0;
iommu->bases = devm_kzalloc(dev, sizeof(*iommu->bases) * num_res, iommu->bases = devm_kcalloc(dev, num_res, sizeof(*iommu->bases),
GFP_KERNEL); GFP_KERNEL);
if (!iommu->bases) if (!iommu->bases)
return -ENOMEM; return -ENOMEM;

View File

@ -354,7 +354,7 @@ static int pdc_intc_probe(struct platform_device *pdev)
priv->nr_syswakes = val; priv->nr_syswakes = val;
/* Get peripheral IRQ numbers */ /* Get peripheral IRQ numbers */
priv->perip_irqs = devm_kzalloc(&pdev->dev, 4 * priv->nr_perips, priv->perip_irqs = devm_kcalloc(&pdev->dev, 4, priv->nr_perips,
GFP_KERNEL); GFP_KERNEL);
if (!priv->perip_irqs) { if (!priv->perip_irqs) {
dev_err(&pdev->dev, "cannot allocate perip IRQ list\n"); dev_err(&pdev->dev, "cannot allocate perip IRQ list\n");

View File

@ -191,8 +191,8 @@ static int mvebu_gicp_probe(struct platform_device *pdev)
gicp->spi_ranges_cnt = ret / 2; gicp->spi_ranges_cnt = ret / 2;
gicp->spi_ranges = gicp->spi_ranges =
devm_kzalloc(&pdev->dev, devm_kcalloc(&pdev->dev,
gicp->spi_ranges_cnt * gicp->spi_ranges_cnt,
sizeof(struct mvebu_gicp_spi_range), sizeof(struct mvebu_gicp_spi_range),
GFP_KERNEL); GFP_KERNEL);
if (!gicp->spi_ranges) if (!gicp->spi_ranges)
@ -210,8 +210,8 @@ static int mvebu_gicp_probe(struct platform_device *pdev)
gicp->spi_cnt += gicp->spi_ranges[i].count; gicp->spi_cnt += gicp->spi_ranges[i].count;
} }
gicp->spi_bitmap = devm_kzalloc(&pdev->dev, gicp->spi_bitmap = devm_kcalloc(&pdev->dev,
BITS_TO_LONGS(gicp->spi_cnt) * sizeof(long), BITS_TO_LONGS(gicp->spi_cnt), sizeof(long),
GFP_KERNEL); GFP_KERNEL);
if (!gicp->spi_bitmap) if (!gicp->spi_bitmap)
return -ENOMEM; return -ENOMEM;

View File

@ -108,7 +108,7 @@ static int adp5520_led_probe(struct platform_device *pdev)
return -EFAULT; return -EFAULT;
} }
led = devm_kzalloc(&pdev->dev, sizeof(*led) * pdata->num_leds, led = devm_kcalloc(&pdev->dev, pdata->num_leds, sizeof(*led),
GFP_KERNEL); GFP_KERNEL);
if (!led) if (!led)
return -ENOMEM; return -ENOMEM;

View File

@ -171,8 +171,8 @@ static int apu_led_config(struct device *dev, struct apu_led_pdata *apuld)
int i; int i;
int err; int err;
apu_led->pled = devm_kzalloc(dev, apu_led->pled = devm_kcalloc(dev,
sizeof(struct apu_led_priv) * apu_led->num_led_instances, apu_led->num_led_instances, sizeof(struct apu_led_priv),
GFP_KERNEL); GFP_KERNEL);
if (!apu_led->pled) if (!apu_led->pled)

View File

@ -113,8 +113,8 @@ static int da9052_led_probe(struct platform_device *pdev)
goto err; goto err;
} }
led = devm_kzalloc(&pdev->dev, led = devm_kcalloc(&pdev->dev,
sizeof(struct da9052_led) * pled->num_leds, pled->num_leds, sizeof(struct da9052_led),
GFP_KERNEL); GFP_KERNEL);
if (!led) { if (!led) {
error = -ENOMEM; error = -ENOMEM;

View File

@ -533,8 +533,8 @@ static int lp5521_probe(struct i2c_client *client,
if (!chip) if (!chip)
return -ENOMEM; return -ENOMEM;
led = devm_kzalloc(&client->dev, led = devm_kcalloc(&client->dev,
sizeof(*led) * pdata->num_channels, GFP_KERNEL); pdata->num_channels, sizeof(*led), GFP_KERNEL);
if (!led) if (!led)
return -ENOMEM; return -ENOMEM;

View File

@ -898,8 +898,8 @@ static int lp5523_probe(struct i2c_client *client,
if (!chip) if (!chip)
return -ENOMEM; return -ENOMEM;
led = devm_kzalloc(&client->dev, led = devm_kcalloc(&client->dev,
sizeof(*led) * pdata->num_channels, GFP_KERNEL); pdata->num_channels, sizeof(*led), GFP_KERNEL);
if (!led) if (!led)
return -ENOMEM; return -ENOMEM;

View File

@ -534,8 +534,8 @@ static int lp5562_probe(struct i2c_client *client,
if (!chip) if (!chip)
return -ENOMEM; return -ENOMEM;
led = devm_kzalloc(&client->dev, led = devm_kcalloc(&client->dev,
sizeof(*led) * pdata->num_channels, GFP_KERNEL); pdata->num_channels, sizeof(*led), GFP_KERNEL);
if (!led) if (!led)
return -ENOMEM; return -ENOMEM;

View File

@ -560,7 +560,7 @@ struct lp55xx_platform_data *lp55xx_of_populate_pdata(struct device *dev,
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
cfg = devm_kzalloc(dev, sizeof(*cfg) * num_channels, GFP_KERNEL); cfg = devm_kcalloc(dev, num_channels, sizeof(*cfg), GFP_KERNEL);
if (!cfg) if (!cfg)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);

View File

@ -327,8 +327,8 @@ static int lp8501_probe(struct i2c_client *client,
if (!chip) if (!chip)
return -ENOMEM; return -ENOMEM;
led = devm_kzalloc(&client->dev, led = devm_kcalloc(&client->dev,
sizeof(*led) * pdata->num_channels, GFP_KERNEL); pdata->num_channels, sizeof(*led), GFP_KERNEL);
if (!led) if (!led)
return -ENOMEM; return -ENOMEM;

View File

@ -128,8 +128,8 @@ static int lt3593_led_probe(struct platform_device *pdev)
if (!pdata) if (!pdata)
return -EBUSY; return -EBUSY;
leds_data = devm_kzalloc(&pdev->dev, leds_data = devm_kcalloc(&pdev->dev,
sizeof(struct lt3593_led_data) * pdata->num_leds, pdata->num_leds, sizeof(struct lt3593_led_data),
GFP_KERNEL); GFP_KERNEL);
if (!leds_data) if (!leds_data)
return -ENOMEM; return -ENOMEM;

View File

@ -136,7 +136,7 @@ static struct mc13xxx_leds_platform_data __init *mc13xxx_led_probe_dt(
pdata->num_leds = of_get_child_count(parent); pdata->num_leds = of_get_child_count(parent);
pdata->led = devm_kzalloc(dev, pdata->num_leds * sizeof(*pdata->led), pdata->led = devm_kcalloc(dev, pdata->num_leds, sizeof(*pdata->led),
GFP_KERNEL); GFP_KERNEL);
if (!pdata->led) { if (!pdata->led) {
ret = -ENOMEM; ret = -ENOMEM;
@ -210,7 +210,7 @@ static int __init mc13xxx_led_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
leds->led = devm_kzalloc(dev, leds->num_leds * sizeof(*leds->led), leds->led = devm_kcalloc(dev, leds->num_leds, sizeof(*leds->led),
GFP_KERNEL); GFP_KERNEL);
if (!leds->led) if (!leds->led)
return -ENOMEM; return -ENOMEM;

View File

@ -329,8 +329,10 @@ static int mlxcpld_led_config(struct device *dev,
int i; int i;
int err; int err;
cpld->pled = devm_kzalloc(dev, sizeof(struct mlxcpld_led_priv) * cpld->pled = devm_kcalloc(dev,
cpld->num_led_instances, GFP_KERNEL); cpld->num_led_instances,
sizeof(struct mlxcpld_led_priv),
GFP_KERNEL);
if (!cpld->pled) if (!cpld->pled)
return -ENOMEM; return -ENOMEM;

View File

@ -335,7 +335,7 @@ static int gpio_ext_get_of_pdata(struct device *dev, struct device_node *np,
return ret; return ret;
} }
num_addr = ret; num_addr = ret;
addr = devm_kzalloc(dev, num_addr * sizeof(*addr), GFP_KERNEL); addr = devm_kcalloc(dev, num_addr, sizeof(*addr), GFP_KERNEL);
if (!addr) if (!addr)
return -ENOMEM; return -ENOMEM;
@ -355,7 +355,7 @@ static int gpio_ext_get_of_pdata(struct device *dev, struct device_node *np,
return ret; return ret;
} }
num_data = ret; num_data = ret;
data = devm_kzalloc(dev, num_data * sizeof(*data), GFP_KERNEL); data = devm_kcalloc(dev, num_data, sizeof(*data), GFP_KERNEL);
if (!data) if (!data)
return -ENOMEM; return -ENOMEM;
@ -415,7 +415,7 @@ static int netxbig_leds_get_of_pdata(struct device *dev,
if (ret % 3) if (ret % 3)
return -EINVAL; return -EINVAL;
num_timers = ret / 3; num_timers = ret / 3;
timers = devm_kzalloc(dev, num_timers * sizeof(*timers), timers = devm_kcalloc(dev, num_timers, sizeof(*timers),
GFP_KERNEL); GFP_KERNEL);
if (!timers) if (!timers)
return -ENOMEM; return -ENOMEM;
@ -444,7 +444,7 @@ static int netxbig_leds_get_of_pdata(struct device *dev,
return -ENODEV; return -ENODEV;
} }
leds = devm_kzalloc(dev, num_leds * sizeof(*leds), GFP_KERNEL); leds = devm_kcalloc(dev, num_leds, sizeof(*leds), GFP_KERNEL);
if (!leds) if (!leds)
return -ENOMEM; return -ENOMEM;
@ -470,8 +470,8 @@ static int netxbig_leds_get_of_pdata(struct device *dev,
goto err_node_put; goto err_node_put;
mode_val = mode_val =
devm_kzalloc(dev, devm_kcalloc(dev,
NETXBIG_LED_MODE_NUM * sizeof(*mode_val), NETXBIG_LED_MODE_NUM, sizeof(*mode_val),
GFP_KERNEL); GFP_KERNEL);
if (!mode_val) { if (!mode_val) {
ret = -ENOMEM; ret = -ENOMEM;
@ -560,8 +560,8 @@ static int netxbig_led_probe(struct platform_device *pdev)
return ret; return ret;
} }
leds_data = devm_kzalloc(&pdev->dev, leds_data = devm_kcalloc(&pdev->dev,
pdata->num_leds * sizeof(*leds_data), pdata->num_leds, sizeof(*leds_data),
GFP_KERNEL); GFP_KERNEL);
if (!leds_data) if (!leds_data)
return -ENOMEM; return -ENOMEM;

View File

@ -264,7 +264,7 @@ ns2_leds_get_of_pdata(struct device *dev, struct ns2_led_platform_data *pdata)
if (!num_leds) if (!num_leds)
return -ENODEV; return -ENODEV;
leds = devm_kzalloc(dev, num_leds * sizeof(struct ns2_led), leds = devm_kcalloc(dev, num_leds, sizeof(struct ns2_led),
GFP_KERNEL); GFP_KERNEL);
if (!leds) if (!leds)
return -ENOMEM; return -ENOMEM;
@ -298,8 +298,9 @@ ns2_leds_get_of_pdata(struct device *dev, struct ns2_led_platform_data *pdata)
} }
num_modes = ret / 3; num_modes = ret / 3;
modval = devm_kzalloc(dev, modval = devm_kcalloc(dev,
num_modes * sizeof(struct ns2_led_modval), num_modes,
sizeof(struct ns2_led_modval),
GFP_KERNEL); GFP_KERNEL);
if (!modval) if (!modval)
return -ENOMEM; return -ENOMEM;

View File

@ -390,8 +390,8 @@ pca955x_pdata_of_init(struct i2c_client *client, struct pca955x_chipdef *chip)
if (!pdata) if (!pdata)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
pdata->leds = devm_kzalloc(&client->dev, pdata->leds = devm_kcalloc(&client->dev,
sizeof(struct pca955x_led) * chip->bits, chip->bits, sizeof(struct pca955x_led),
GFP_KERNEL); GFP_KERNEL);
if (!pdata->leds) if (!pdata->leds)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
@ -494,8 +494,8 @@ static int pca955x_probe(struct i2c_client *client,
if (!pca955x) if (!pca955x)
return -ENOMEM; return -ENOMEM;
pca955x->leds = devm_kzalloc(&client->dev, pca955x->leds = devm_kcalloc(&client->dev,
sizeof(*pca955x_led) * chip->bits, GFP_KERNEL); chip->bits, sizeof(*pca955x_led), GFP_KERNEL);
if (!pca955x->leds) if (!pca955x->leds)
return -ENOMEM; return -ENOMEM;

View File

@ -300,8 +300,8 @@ pca963x_dt_init(struct i2c_client *client, struct pca963x_chipdef *chip)
if (!count || count > chip->n_leds) if (!count || count > chip->n_leds)
return ERR_PTR(-ENODEV); return ERR_PTR(-ENODEV);
pca963x_leds = devm_kzalloc(&client->dev, pca963x_leds = devm_kcalloc(&client->dev,
sizeof(struct led_info) * chip->n_leds, GFP_KERNEL); chip->n_leds, sizeof(struct led_info), GFP_KERNEL);
if (!pca963x_leds) if (!pca963x_leds)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
@ -407,7 +407,7 @@ static int pca963x_probe(struct i2c_client *client,
GFP_KERNEL); GFP_KERNEL);
if (!pca963x_chip) if (!pca963x_chip)
return -ENOMEM; return -ENOMEM;
pca963x = devm_kzalloc(&client->dev, chip->n_leds * sizeof(*pca963x), pca963x = devm_kcalloc(&client->dev, chip->n_leds, sizeof(*pca963x),
GFP_KERNEL); GFP_KERNEL);
if (!pca963x) if (!pca963x)
return -ENOMEM; return -ENOMEM;

View File

@ -697,8 +697,8 @@ tca6507_led_dt_init(struct i2c_client *client)
if (!count || count > NUM_LEDS) if (!count || count > NUM_LEDS)
return ERR_PTR(-ENODEV); return ERR_PTR(-ENODEV);
tca_leds = devm_kzalloc(&client->dev, tca_leds = devm_kcalloc(&client->dev,
sizeof(struct led_info) * NUM_LEDS, GFP_KERNEL); NUM_LEDS, sizeof(struct led_info), GFP_KERNEL);
if (!tca_leds) if (!tca_leds)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);

View File

@ -282,13 +282,13 @@ static int hi6220_mbox_probe(struct platform_device *pdev)
mbox->dev = dev; mbox->dev = dev;
mbox->chan_num = MBOX_CHAN_MAX; mbox->chan_num = MBOX_CHAN_MAX;
mbox->mchan = devm_kzalloc(dev, mbox->mchan = devm_kcalloc(dev,
mbox->chan_num * sizeof(*mbox->mchan), GFP_KERNEL); mbox->chan_num, sizeof(*mbox->mchan), GFP_KERNEL);
if (!mbox->mchan) if (!mbox->mchan)
return -ENOMEM; return -ENOMEM;
mbox->chan = devm_kzalloc(dev, mbox->chan = devm_kcalloc(dev,
mbox->chan_num * sizeof(*mbox->chan), GFP_KERNEL); mbox->chan_num, sizeof(*mbox->chan), GFP_KERNEL);
if (!mbox->chan) if (!mbox->chan)
return -ENOMEM; return -ENOMEM;

View File

@ -442,8 +442,8 @@ static int sti_mbox_probe(struct platform_device *pdev)
if (!mbox) if (!mbox)
return -ENOMEM; return -ENOMEM;
chans = devm_kzalloc(&pdev->dev, chans = devm_kcalloc(&pdev->dev,
sizeof(*chans) * STI_MBOX_CHAN_MAX, GFP_KERNEL); STI_MBOX_CHAN_MAX, sizeof(*chans), GFP_KERNEL);
if (!chans) if (!chans)
return -ENOMEM; return -ENOMEM;

View File

@ -729,7 +729,7 @@ static int omap_mbox_probe(struct platform_device *pdev)
return -ENODEV; return -ENODEV;
} }
finfoblk = devm_kzalloc(&pdev->dev, info_count * sizeof(*finfoblk), finfoblk = devm_kcalloc(&pdev->dev, info_count, sizeof(*finfoblk),
GFP_KERNEL); GFP_KERNEL);
if (!finfoblk) if (!finfoblk)
return -ENOMEM; return -ENOMEM;
@ -773,23 +773,23 @@ static int omap_mbox_probe(struct platform_device *pdev)
if (IS_ERR(mdev->mbox_base)) if (IS_ERR(mdev->mbox_base))
return PTR_ERR(mdev->mbox_base); return PTR_ERR(mdev->mbox_base);
mdev->irq_ctx = devm_kzalloc(&pdev->dev, num_users * sizeof(u32), mdev->irq_ctx = devm_kcalloc(&pdev->dev, num_users, sizeof(u32),
GFP_KERNEL); GFP_KERNEL);
if (!mdev->irq_ctx) if (!mdev->irq_ctx)
return -ENOMEM; return -ENOMEM;
/* allocate one extra for marking end of list */ /* allocate one extra for marking end of list */
list = devm_kzalloc(&pdev->dev, (info_count + 1) * sizeof(*list), list = devm_kcalloc(&pdev->dev, info_count + 1, sizeof(*list),
GFP_KERNEL); GFP_KERNEL);
if (!list) if (!list)
return -ENOMEM; return -ENOMEM;
chnls = devm_kzalloc(&pdev->dev, (info_count + 1) * sizeof(*chnls), chnls = devm_kcalloc(&pdev->dev, info_count + 1, sizeof(*chnls),
GFP_KERNEL); GFP_KERNEL);
if (!chnls) if (!chnls)
return -ENOMEM; return -ENOMEM;
mboxblk = devm_kzalloc(&pdev->dev, info_count * sizeof(*mbox), mboxblk = devm_kcalloc(&pdev->dev, info_count, sizeof(*mbox),
GFP_KERNEL); GFP_KERNEL);
if (!mboxblk) if (!mboxblk)
return -ENOMEM; return -ENOMEM;

View File

@ -568,12 +568,12 @@ static int ti_msgmgr_probe(struct platform_device *pdev)
} }
inst->num_valid_queues = queue_count; inst->num_valid_queues = queue_count;
qinst = devm_kzalloc(dev, sizeof(*qinst) * queue_count, GFP_KERNEL); qinst = devm_kcalloc(dev, queue_count, sizeof(*qinst), GFP_KERNEL);
if (!qinst) if (!qinst)
return -ENOMEM; return -ENOMEM;
inst->qinsts = qinst; inst->qinsts = qinst;
chans = devm_kzalloc(dev, sizeof(*chans) * queue_count, GFP_KERNEL); chans = devm_kcalloc(dev, queue_count, sizeof(*chans), GFP_KERNEL);
if (!chans) if (!chans)
return -ENOMEM; return -ENOMEM;
inst->chans = chans; inst->chans = chans;

View File

@ -373,7 +373,7 @@ static int s5k5baf_fw_parse(struct device *dev, struct s5k5baf_fw **fw,
data += S5K5BAG_FW_TAG_LEN; data += S5K5BAG_FW_TAG_LEN;
count -= S5K5BAG_FW_TAG_LEN; count -= S5K5BAG_FW_TAG_LEN;
d = devm_kzalloc(dev, count * sizeof(u16), GFP_KERNEL); d = devm_kcalloc(dev, count, sizeof(u16), GFP_KERNEL);
if (!d) if (!d)
return -ENOMEM; return -ENOMEM;

View File

@ -2586,8 +2586,10 @@ static int vpfe_probe(struct platform_device *pdev)
pm_runtime_put_sync(&pdev->dev); pm_runtime_put_sync(&pdev->dev);
vpfe->sd = devm_kzalloc(&pdev->dev, sizeof(struct v4l2_subdev *) * vpfe->sd = devm_kcalloc(&pdev->dev,
ARRAY_SIZE(vpfe->cfg->asd), GFP_KERNEL); ARRAY_SIZE(vpfe->cfg->asd),
sizeof(struct v4l2_subdev *),
GFP_KERNEL);
if (!vpfe->sd) { if (!vpfe->sd) {
ret = -ENOMEM; ret = -ENOMEM;
goto probe_out_v4l2_unregister; goto probe_out_v4l2_unregister;

View File

@ -1528,8 +1528,10 @@ vpif_capture_get_pdata(struct platform_device *pdev)
if (!pdata) if (!pdata)
return NULL; return NULL;
pdata->subdev_info = pdata->subdev_info =
devm_kzalloc(&pdev->dev, sizeof(*pdata->subdev_info) * devm_kcalloc(&pdev->dev,
VPIF_CAPTURE_NUM_CHANNELS, GFP_KERNEL); VPIF_CAPTURE_NUM_CHANNELS,
sizeof(*pdata->subdev_info),
GFP_KERNEL);
if (!pdata->subdev_info) if (!pdata->subdev_info)
return NULL; return NULL;
@ -1546,9 +1548,9 @@ vpif_capture_get_pdata(struct platform_device *pdev)
sdinfo = &pdata->subdev_info[i]; sdinfo = &pdata->subdev_info[i];
chan = &pdata->chan_config[i]; chan = &pdata->chan_config[i];
chan->inputs = devm_kzalloc(&pdev->dev, chan->inputs = devm_kcalloc(&pdev->dev,
sizeof(*chan->inputs) *
VPIF_CAPTURE_NUM_CHANNELS, VPIF_CAPTURE_NUM_CHANNELS,
sizeof(*chan->inputs),
GFP_KERNEL); GFP_KERNEL);
if (!chan->inputs) if (!chan->inputs)
return NULL; return NULL;

View File

@ -845,7 +845,7 @@ int msm_csid_subdev_init(struct csid_device *csid,
while (res->clock[csid->nclocks]) while (res->clock[csid->nclocks])
csid->nclocks++; csid->nclocks++;
csid->clock = devm_kzalloc(dev, csid->nclocks * sizeof(*csid->clock), csid->clock = devm_kcalloc(dev, csid->nclocks, sizeof(*csid->clock),
GFP_KERNEL); GFP_KERNEL);
if (!csid->clock) if (!csid->clock)
return -ENOMEM; return -ENOMEM;
@ -868,8 +868,10 @@ int msm_csid_subdev_init(struct csid_device *csid,
continue; continue;
} }
clock->freq = devm_kzalloc(dev, clock->nfreqs * clock->freq = devm_kcalloc(dev,
sizeof(*clock->freq), GFP_KERNEL); clock->nfreqs,
sizeof(*clock->freq),
GFP_KERNEL);
if (!clock->freq) if (!clock->freq)
return -ENOMEM; return -ENOMEM;

View File

@ -732,8 +732,9 @@ int msm_csiphy_subdev_init(struct csiphy_device *csiphy,
while (res->clock[csiphy->nclocks]) while (res->clock[csiphy->nclocks])
csiphy->nclocks++; csiphy->nclocks++;
csiphy->clock = devm_kzalloc(dev, csiphy->nclocks * csiphy->clock = devm_kcalloc(dev,
sizeof(*csiphy->clock), GFP_KERNEL); csiphy->nclocks, sizeof(*csiphy->clock),
GFP_KERNEL);
if (!csiphy->clock) if (!csiphy->clock)
return -ENOMEM; return -ENOMEM;
@ -755,8 +756,10 @@ int msm_csiphy_subdev_init(struct csiphy_device *csiphy,
continue; continue;
} }
clock->freq = devm_kzalloc(dev, clock->nfreqs * clock->freq = devm_kcalloc(dev,
sizeof(*clock->freq), GFP_KERNEL); clock->nfreqs,
sizeof(*clock->freq),
GFP_KERNEL);
if (!clock->freq) if (!clock->freq)
return -ENOMEM; return -ENOMEM;

View File

@ -948,7 +948,8 @@ int msm_ispif_subdev_init(struct ispif_device *ispif,
while (res->clock[ispif->nclocks]) while (res->clock[ispif->nclocks])
ispif->nclocks++; ispif->nclocks++;
ispif->clock = devm_kzalloc(dev, ispif->nclocks * sizeof(*ispif->clock), ispif->clock = devm_kcalloc(dev,
ispif->nclocks, sizeof(*ispif->clock),
GFP_KERNEL); GFP_KERNEL);
if (!ispif->clock) if (!ispif->clock)
return -ENOMEM; return -ENOMEM;
@ -968,8 +969,10 @@ int msm_ispif_subdev_init(struct ispif_device *ispif,
while (res->clock_for_reset[ispif->nclocks_for_reset]) while (res->clock_for_reset[ispif->nclocks_for_reset])
ispif->nclocks_for_reset++; ispif->nclocks_for_reset++;
ispif->clock_for_reset = devm_kzalloc(dev, ispif->nclocks_for_reset * ispif->clock_for_reset = devm_kcalloc(dev,
sizeof(*ispif->clock_for_reset), GFP_KERNEL); ispif->nclocks_for_reset,
sizeof(*ispif->clock_for_reset),
GFP_KERNEL);
if (!ispif->clock_for_reset) if (!ispif->clock_for_reset)
return -ENOMEM; return -ENOMEM;

View File

@ -2794,7 +2794,7 @@ int msm_vfe_subdev_init(struct vfe_device *vfe, const struct resources *res)
while (res->clock[vfe->nclocks]) while (res->clock[vfe->nclocks])
vfe->nclocks++; vfe->nclocks++;
vfe->clock = devm_kzalloc(dev, vfe->nclocks * sizeof(*vfe->clock), vfe->clock = devm_kcalloc(dev, vfe->nclocks, sizeof(*vfe->clock),
GFP_KERNEL); GFP_KERNEL);
if (!vfe->clock) if (!vfe->clock)
return -ENOMEM; return -ENOMEM;
@ -2817,8 +2817,10 @@ int msm_vfe_subdev_init(struct vfe_device *vfe, const struct resources *res)
continue; continue;
} }
clock->freq = devm_kzalloc(dev, clock->nfreqs * clock->freq = devm_kcalloc(dev,
sizeof(*clock->freq), GFP_KERNEL); clock->nfreqs,
sizeof(*clock->freq),
GFP_KERNEL);
if (!clock->freq) if (!clock->freq)
return -ENOMEM; return -ENOMEM;

View File

@ -271,7 +271,8 @@ static int camss_of_parse_endpoint_node(struct device *dev,
lncfg->clk.pol = mipi_csi2->lane_polarities[0]; lncfg->clk.pol = mipi_csi2->lane_polarities[0];
lncfg->num_data = mipi_csi2->num_data_lanes; lncfg->num_data = mipi_csi2->num_data_lanes;
lncfg->data = devm_kzalloc(dev, lncfg->num_data * sizeof(*lncfg->data), lncfg->data = devm_kcalloc(dev,
lncfg->num_data, sizeof(*lncfg->data),
GFP_KERNEL); GFP_KERNEL);
if (!lncfg->data) if (!lncfg->data)
return -ENOMEM; return -ENOMEM;

View File

@ -630,7 +630,8 @@ int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity,
entity->source_pad = num_pads - 1; entity->source_pad = num_pads - 1;
/* Allocate and initialize pads. */ /* Allocate and initialize pads. */
entity->pads = devm_kzalloc(vsp1->dev, num_pads * sizeof(*entity->pads), entity->pads = devm_kcalloc(vsp1->dev,
num_pads, sizeof(*entity->pads),
GFP_KERNEL); GFP_KERNEL);
if (entity->pads == NULL) if (entity->pads == NULL)
return -ENOMEM; return -ENOMEM;

View File

@ -532,7 +532,7 @@ static int xvip_graph_init(struct xvip_composite_device *xdev)
/* Register the subdevices notifier. */ /* Register the subdevices notifier. */
num_subdevs = xdev->num_subdevs; num_subdevs = xdev->num_subdevs;
subdevs = devm_kzalloc(xdev->dev, sizeof(*subdevs) * num_subdevs, subdevs = devm_kcalloc(xdev->dev, num_subdevs, sizeof(*subdevs),
GFP_KERNEL); GFP_KERNEL);
if (subdevs == NULL) { if (subdevs == NULL) {
ret = -ENOMEM; ret = -ENOMEM;

View File

@ -412,9 +412,10 @@ static int v4l2_flash_init_controls(struct v4l2_flash *v4l2_flash,
struct v4l2_ctrl_config *ctrl_cfg; struct v4l2_ctrl_config *ctrl_cfg;
int i, ret, num_ctrls = 0; int i, ret, num_ctrls = 0;
v4l2_flash->ctrls = devm_kzalloc(v4l2_flash->sd.dev, v4l2_flash->ctrls = devm_kcalloc(v4l2_flash->sd.dev,
sizeof(*v4l2_flash->ctrls) * STROBE_SOURCE + 1,
(STROBE_SOURCE + 1), GFP_KERNEL); sizeof(*v4l2_flash->ctrls),
GFP_KERNEL);
if (!v4l2_flash->ctrls) if (!v4l2_flash->ctrls)
return -ENOMEM; return -ENOMEM;

View File

@ -126,8 +126,8 @@ const struct lpddr2_timings *of_get_ddr_timings(struct device_node *np_ddr,
arr_sz++; arr_sz++;
if (arr_sz) if (arr_sz)
timings = devm_kzalloc(dev, sizeof(*timings) * arr_sz, timings = devm_kcalloc(dev, arr_sz, sizeof(*timings),
GFP_KERNEL); GFP_KERNEL);
if (!timings) if (!timings)
goto default_timings; goto default_timings;

View File

@ -2659,18 +2659,18 @@ static int ab8500_debug_probe(struct platform_device *plf)
ab8500 = dev_get_drvdata(plf->dev.parent); ab8500 = dev_get_drvdata(plf->dev.parent);
num_irqs = ab8500->mask_size; num_irqs = ab8500->mask_size;
irq_count = devm_kzalloc(&plf->dev, irq_count = devm_kcalloc(&plf->dev,
sizeof(*irq_count)*num_irqs, GFP_KERNEL); num_irqs, sizeof(*irq_count), GFP_KERNEL);
if (!irq_count) if (!irq_count)
return -ENOMEM; return -ENOMEM;
dev_attr = devm_kzalloc(&plf->dev, dev_attr = devm_kcalloc(&plf->dev,
sizeof(*dev_attr)*num_irqs, GFP_KERNEL); num_irqs, sizeof(*dev_attr), GFP_KERNEL);
if (!dev_attr) if (!dev_attr)
return -ENOMEM; return -ENOMEM;
event_name = devm_kzalloc(&plf->dev, event_name = devm_kcalloc(&plf->dev,
sizeof(*event_name)*num_irqs, GFP_KERNEL); num_irqs, sizeof(*event_name), GFP_KERNEL);
if (!event_name) if (!event_name)
return -ENOMEM; return -ENOMEM;

Some files were not shown because too many files have changed in this diff Show More