You've already forked linux-rockchip
mirror of
https://github.com/armbian/linux-rockchip.git
synced 2026-01-06 11:08:10 -08:00
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>
This commit is contained in:
@@ -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 = devm_kzalloc(&device->dev,
|
||||
fan->fps_count * sizeof(struct acpi_fan_fps),
|
||||
fan->fps = devm_kcalloc(&device->dev,
|
||||
fan->fps_count, sizeof(struct acpi_fan_fps),
|
||||
GFP_KERNEL);
|
||||
if (!fan->fps) {
|
||||
dev_err(&device->dev, "Not enough memory\n");
|
||||
|
||||
@@ -1082,9 +1082,10 @@ static int __nfit_mem_init(struct acpi_nfit_desc *acpi_desc,
|
||||
continue;
|
||||
nfit_mem->nfit_flush = nfit_flush;
|
||||
flush = nfit_flush->flush;
|
||||
nfit_mem->flush_wpq = devm_kzalloc(acpi_desc->dev,
|
||||
flush->hint_count
|
||||
* sizeof(struct resource), GFP_KERNEL);
|
||||
nfit_mem->flush_wpq = devm_kcalloc(acpi_desc->dev,
|
||||
flush->hint_count,
|
||||
sizeof(struct resource),
|
||||
GFP_KERNEL);
|
||||
if (!nfit_mem->flush_wpq)
|
||||
return -ENOMEM;
|
||||
for (i = 0; i < flush->hint_count; i++) {
|
||||
|
||||
@@ -4114,13 +4114,13 @@ static int mv_platform_probe(struct platform_device *pdev)
|
||||
|
||||
if (!host || !hpriv)
|
||||
return -ENOMEM;
|
||||
hpriv->port_clks = devm_kzalloc(&pdev->dev,
|
||||
sizeof(struct clk *) * n_ports,
|
||||
hpriv->port_clks = devm_kcalloc(&pdev->dev,
|
||||
n_ports, sizeof(struct clk *),
|
||||
GFP_KERNEL);
|
||||
if (!hpriv->port_clks)
|
||||
return -ENOMEM;
|
||||
hpriv->port_phys = devm_kzalloc(&pdev->dev,
|
||||
sizeof(struct phy *) * n_ports,
|
||||
hpriv->port_phys = devm_kcalloc(&pdev->dev,
|
||||
n_ports, sizeof(struct phy *),
|
||||
GFP_KERNEL);
|
||||
if (!hpriv->port_phys)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -354,8 +354,8 @@ int fsl_mc_populate_irq_pool(struct fsl_mc_bus *mc_bus,
|
||||
if (error < 0)
|
||||
return error;
|
||||
|
||||
irq_resources = devm_kzalloc(&mc_bus_dev->dev,
|
||||
sizeof(*irq_resources) * irq_count,
|
||||
irq_resources = devm_kcalloc(&mc_bus_dev->dev,
|
||||
irq_count, sizeof(*irq_resources),
|
||||
GFP_KERNEL);
|
||||
if (!irq_resources) {
|
||||
error = -ENOMEM;
|
||||
@@ -455,7 +455,7 @@ int __must_check fsl_mc_allocate_irqs(struct fsl_mc_device *mc_dev)
|
||||
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);
|
||||
if (!irqs)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -980,7 +980,7 @@ static int tpm2_get_cc_attrs_tbl(struct tpm_chip *chip)
|
||||
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);
|
||||
|
||||
rc = tpm_buf_init(&buf, TPM2_ST_NO_SESSIONS, TPM2_CC_GET_CAPABILITY);
|
||||
|
||||
@@ -734,7 +734,7 @@ static void bcm2835_pll_debug_init(struct clk_hw *hw,
|
||||
const struct bcm2835_pll_data *data = pll->data;
|
||||
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)
|
||||
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;
|
||||
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)
|
||||
return;
|
||||
|
||||
|
||||
@@ -501,8 +501,9 @@ static int ti_adpll_init_dco(struct ti_adpll_data *d)
|
||||
const char *postfix;
|
||||
int width, err;
|
||||
|
||||
d->outputs.clks = devm_kzalloc(d->dev, sizeof(struct clk *) *
|
||||
d->outputs.clks = devm_kcalloc(d->dev,
|
||||
MAX_ADPLL_OUTPUTS,
|
||||
sizeof(struct clk *),
|
||||
GFP_KERNEL);
|
||||
if (!d->outputs.clks)
|
||||
return -ENOMEM;
|
||||
@@ -915,8 +916,9 @@ static int ti_adpll_probe(struct platform_device *pdev)
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
d->clocks = devm_kzalloc(d->dev, sizeof(struct ti_adpll_clock) *
|
||||
d->clocks = devm_kcalloc(d->dev,
|
||||
TI_ADPLL_NR_CLOCKS,
|
||||
sizeof(struct ti_adpll_clock),
|
||||
GFP_KERNEL);
|
||||
if (!d->clocks)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -410,7 +410,7 @@ brcm_avs_get_freq_table(struct device *dev, struct private_data *priv)
|
||||
if (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);
|
||||
if (!table)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
@@ -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 */
|
||||
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) {
|
||||
ret = -ENOMEM;
|
||||
goto free_freq_table;
|
||||
|
||||
@@ -471,7 +471,7 @@ static int mv_cesa_probe(struct platform_device *pdev)
|
||||
sram_size = CESA_SA_MIN_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);
|
||||
if (!cesa->engines)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -3393,8 +3393,10 @@ static int talitos_probe(struct platform_device *ofdev)
|
||||
}
|
||||
}
|
||||
|
||||
priv->chan = devm_kzalloc(dev, sizeof(struct talitos_channel) *
|
||||
priv->num_channels, GFP_KERNEL);
|
||||
priv->chan = devm_kcalloc(dev,
|
||||
priv->num_channels,
|
||||
sizeof(struct talitos_channel),
|
||||
GFP_KERNEL);
|
||||
if (!priv->chan) {
|
||||
dev_err(dev, "failed to allocate channel management space\n");
|
||||
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].tail_lock);
|
||||
|
||||
priv->chan[i].fifo = devm_kzalloc(dev,
|
||||
sizeof(struct talitos_request) *
|
||||
priv->fifo_len, GFP_KERNEL);
|
||||
priv->chan[i].fifo = devm_kcalloc(dev,
|
||||
priv->fifo_len,
|
||||
sizeof(struct talitos_request),
|
||||
GFP_KERNEL);
|
||||
if (!priv->chan[i].fifo) {
|
||||
dev_err(dev, "failed to allocate request fifo %d\n", i);
|
||||
err = -ENOMEM;
|
||||
|
||||
@@ -628,14 +628,15 @@ struct devfreq *devfreq_add_device(struct device *dev,
|
||||
goto err_dev;
|
||||
}
|
||||
|
||||
devfreq->trans_table = devm_kzalloc(&devfreq->dev,
|
||||
sizeof(unsigned int) *
|
||||
devfreq->profile->max_state *
|
||||
devfreq->profile->max_state,
|
||||
GFP_KERNEL);
|
||||
devfreq->time_in_state = devm_kzalloc(&devfreq->dev,
|
||||
sizeof(unsigned long) *
|
||||
devfreq->trans_table =
|
||||
devm_kzalloc(&devfreq->dev,
|
||||
array3_size(sizeof(unsigned int),
|
||||
devfreq->profile->max_state,
|
||||
devfreq->profile->max_state),
|
||||
GFP_KERNEL);
|
||||
devfreq->time_in_state = devm_kcalloc(&devfreq->dev,
|
||||
devfreq->profile->max_state,
|
||||
sizeof(unsigned long),
|
||||
GFP_KERNEL);
|
||||
devfreq->last_stat_updated = jiffies;
|
||||
|
||||
|
||||
@@ -518,7 +518,7 @@ static int of_get_devfreq_events(struct device_node *np,
|
||||
event_ops = exynos_bus_get_ops(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)
|
||||
return -ENOMEM;
|
||||
info->num_events = count;
|
||||
|
||||
@@ -848,8 +848,8 @@ static int k3_dma_probe(struct platform_device *op)
|
||||
return -ENOMEM;
|
||||
|
||||
/* init phy channel */
|
||||
d->phy = devm_kzalloc(&op->dev,
|
||||
d->dma_channels * sizeof(struct k3_dma_phy), GFP_KERNEL);
|
||||
d->phy = devm_kcalloc(&op->dev,
|
||||
d->dma_channels, sizeof(struct k3_dma_phy), GFP_KERNEL);
|
||||
if (d->phy == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -879,8 +879,8 @@ static int k3_dma_probe(struct platform_device *op)
|
||||
d->slave.copy_align = DMAENGINE_ALIGN_8_BYTES;
|
||||
|
||||
/* init virtual channel */
|
||||
d->chans = devm_kzalloc(&op->dev,
|
||||
d->dma_requests * sizeof(struct k3_dma_chan), GFP_KERNEL);
|
||||
d->chans = devm_kcalloc(&op->dev,
|
||||
d->dma_requests, sizeof(struct k3_dma_chan), GFP_KERNEL);
|
||||
if (d->chans == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
@@ -809,8 +809,9 @@ static int mv_xor_v2_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
/* alloc memory for the SW descriptors */
|
||||
xor_dev->sw_desq = devm_kzalloc(&pdev->dev, sizeof(*sw_desc) *
|
||||
MV_XOR_V2_DESC_NUM, GFP_KERNEL);
|
||||
xor_dev->sw_desq = devm_kcalloc(&pdev->dev,
|
||||
MV_XOR_V2_DESC_NUM, sizeof(*sw_desc),
|
||||
GFP_KERNEL);
|
||||
if (!xor_dev->sw_desq) {
|
||||
ret = -ENOMEM;
|
||||
goto free_hw_desq;
|
||||
|
||||
@@ -1223,9 +1223,9 @@ static int s3c24xx_dma_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(s3cdma->base))
|
||||
return PTR_ERR(s3cdma->base);
|
||||
|
||||
s3cdma->phy_chans = devm_kzalloc(&pdev->dev,
|
||||
sizeof(struct s3c24xx_dma_phy) *
|
||||
pdata->num_phy_channels,
|
||||
s3cdma->phy_chans = devm_kcalloc(&pdev->dev,
|
||||
pdata->num_phy_channels,
|
||||
sizeof(struct s3c24xx_dma_phy),
|
||||
GFP_KERNEL);
|
||||
if (!s3cdma->phy_chans)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -798,8 +798,8 @@ static int zx_dma_probe(struct platform_device *op)
|
||||
return -ENOMEM;
|
||||
|
||||
/* init phy channel */
|
||||
d->phy = devm_kzalloc(&op->dev,
|
||||
d->dma_channels * sizeof(struct zx_dma_phy), GFP_KERNEL);
|
||||
d->phy = devm_kcalloc(&op->dev,
|
||||
d->dma_channels, sizeof(struct zx_dma_phy), GFP_KERNEL);
|
||||
if (!d->phy)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -834,8 +834,8 @@ static int zx_dma_probe(struct platform_device *op)
|
||||
d->slave.residue_granularity = DMA_RESIDUE_GRANULARITY_SEGMENT;
|
||||
|
||||
/* init virtual channel */
|
||||
d->chans = devm_kzalloc(&op->dev,
|
||||
d->dma_requests * sizeof(struct zx_dma_chan), GFP_KERNEL);
|
||||
d->chans = devm_kcalloc(&op->dev,
|
||||
d->dma_requests, sizeof(struct zx_dma_chan), GFP_KERNEL);
|
||||
if (!d->chans)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
@@ -890,7 +890,7 @@ static int scpi_alloc_xfer_list(struct device *dev, struct scpi_chan *ch)
|
||||
int i;
|
||||
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)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
@@ -1862,9 +1862,9 @@ static int ti_sci_probe(struct platform_device *pdev)
|
||||
if (!minfo->xfer_block)
|
||||
return -ENOMEM;
|
||||
|
||||
minfo->xfer_alloc_table = devm_kzalloc(dev,
|
||||
BITS_TO_LONGS(desc->max_msgs)
|
||||
* sizeof(unsigned long),
|
||||
minfo->xfer_alloc_table = devm_kcalloc(dev,
|
||||
BITS_TO_LONGS(desc->max_msgs),
|
||||
sizeof(unsigned long),
|
||||
GFP_KERNEL);
|
||||
if (!minfo->xfer_alloc_table)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -427,7 +427,7 @@ static int adnp_irq_setup(struct adnp *adnp)
|
||||
* is chosen to match the register layout of the hardware in that
|
||||
* 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);
|
||||
if (!adnp->irq_enable)
|
||||
return -ENOMEM;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user