treewide: devm_kzalloc() -> devm_kcalloc()
authorKees Cook <keescook@chromium.org>
Tue, 12 Jun 2018 21:07:58 +0000 (14:07 -0700)
committerKees Cook <keescook@chromium.org>
Tue, 12 Jun 2018 23:19:22 +0000 (16:19 -0700)
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>
229 files changed:
drivers/acpi/fan.c
drivers/acpi/nfit/core.c
drivers/ata/sata_mv.c
drivers/bus/fsl-mc/fsl-mc-allocator.c
drivers/char/tpm/tpm2-cmd.c
drivers/clk/bcm/clk-bcm2835.c
drivers/clk/ti/adpll.c
drivers/cpufreq/brcmstb-avs-cpufreq.c
drivers/cpufreq/imx6q-cpufreq.c
drivers/crypto/marvell/cesa.c
drivers/crypto/talitos.c
drivers/devfreq/devfreq.c
drivers/devfreq/event/exynos-ppmu.c
drivers/dma/k3dma.c
drivers/dma/mv_xor_v2.c
drivers/dma/s3c24xx-dma.c
drivers/dma/zx_dma.c
drivers/firmware/arm_scpi.c
drivers/firmware/ti_sci.c
drivers/gpio/gpio-adnp.c
drivers/gpio/gpio-aspeed.c
drivers/gpio/gpio-bcm-kona.c
drivers/gpio/gpio-davinci.c
drivers/gpio/gpio-htc-egpio.c
drivers/gpio/gpio-thunderx.c
drivers/gpu/drm/exynos/exynos_drm_dsi.c
drivers/gpu/drm/exynos/exynos_drm_fimc.c
drivers/gpu/drm/exynos/exynos_drm_gsc.c
drivers/gpu/drm/exynos/exynos_hdmi.c
drivers/gpu/drm/msm/hdmi/hdmi.c
drivers/gpu/drm/msm/hdmi/hdmi_phy.c
drivers/hid/hid-sensor-hub.c
drivers/hid/intel-ish-hid/ishtp-hid-client.c
drivers/hid/wacom_sys.c
drivers/hwmon/aspeed-pwm-tacho.c
drivers/hwmon/gpio-fan.c
drivers/hwmon/ibmpowernv.c
drivers/hwmon/iio_hwmon.c
drivers/hwmon/nct6683.c
drivers/hwmon/nct6775.c
drivers/hwmon/pmbus/pmbus_core.c
drivers/hwmon/pmbus/ucd9000.c
drivers/hwmon/pwm-fan.c
drivers/hwtracing/coresight/coresight-etb10.c
drivers/hwtracing/coresight/of_coresight.c
drivers/i2c/busses/i2c-qup.c
drivers/i2c/muxes/i2c-mux-gpio.c
drivers/i2c/muxes/i2c-mux-reg.c
drivers/iio/adc/at91_adc.c
drivers/iio/adc/max1363.c
drivers/iio/adc/twl6030-gpadc.c
drivers/iio/dac/ad5592r-base.c
drivers/iio/multiplexer/iio-mux.c
drivers/input/keyboard/clps711x-keypad.c
drivers/input/keyboard/matrix_keypad.c
drivers/input/keyboard/samsung-keypad.c
drivers/input/matrix-keymap.c
drivers/input/misc/rotary_encoder.c
drivers/input/rmi4/rmi_driver.c
drivers/input/rmi4/rmi_f11.c
drivers/input/rmi4/rmi_f12.c
drivers/input/rmi4/rmi_f54.c
drivers/input/rmi4/rmi_spi.c
drivers/iommu/arm-smmu.c
drivers/iommu/rockchip-iommu.c
drivers/irqchip/irq-imgpdc.c
drivers/irqchip/irq-mvebu-gicp.c
drivers/leds/leds-adp5520.c
drivers/leds/leds-apu.c
drivers/leds/leds-da9052.c
drivers/leds/leds-lp5521.c
drivers/leds/leds-lp5523.c
drivers/leds/leds-lp5562.c
drivers/leds/leds-lp55xx-common.c
drivers/leds/leds-lp8501.c
drivers/leds/leds-lt3593.c
drivers/leds/leds-mc13783.c
drivers/leds/leds-mlxcpld.c
drivers/leds/leds-netxbig.c
drivers/leds/leds-ns2.c
drivers/leds/leds-pca955x.c
drivers/leds/leds-pca963x.c
drivers/leds/leds-tca6507.c
drivers/mailbox/hi6220-mailbox.c
drivers/mailbox/mailbox-sti.c
drivers/mailbox/omap-mailbox.c
drivers/mailbox/ti-msgmgr.c
drivers/media/i2c/s5k5baf.c
drivers/media/platform/am437x/am437x-vpfe.c
drivers/media/platform/davinci/vpif_capture.c
drivers/media/platform/qcom/camss-8x16/camss-csid.c
drivers/media/platform/qcom/camss-8x16/camss-csiphy.c
drivers/media/platform/qcom/camss-8x16/camss-ispif.c
drivers/media/platform/qcom/camss-8x16/camss-vfe.c
drivers/media/platform/qcom/camss-8x16/camss.c
drivers/media/platform/vsp1/vsp1_entity.c
drivers/media/platform/xilinx/xilinx-vipp.c
drivers/media/v4l2-core/v4l2-flash-led-class.c
drivers/memory/of_memory.c
drivers/mfd/ab8500-debugfs.c
drivers/mfd/htc-i2cpld.c
drivers/mfd/motorola-cpcap.c
drivers/mfd/sprd-sc27xx-spi.c
drivers/mfd/twl-core.c
drivers/mfd/wm8994-core.c
drivers/misc/sram.c
drivers/mmc/host/sdhci-omap.c
drivers/mtd/devices/docg3.c
drivers/mtd/nand/raw/qcom_nandc.c
drivers/mtd/nand/raw/s3c2410.c
drivers/net/dsa/b53/b53_common.c
drivers/net/ethernet/amazon/ena/ena_ethtool.c
drivers/net/ethernet/ethoc.c
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
drivers/net/ethernet/ni/nixge.c
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
drivers/net/ethernet/ti/cpsw.c
drivers/net/ethernet/ti/netcp_ethss.c
drivers/net/phy/phy_led_triggers.c
drivers/net/wireless/mediatek/mt76/mac80211.c
drivers/pci/cadence/pcie-cadence-ep.c
drivers/pci/dwc/pci-dra7xx.c
drivers/pci/dwc/pcie-designware-ep.c
drivers/pci/host/pcie-rockchip-ep.c
drivers/pinctrl/berlin/berlin.c
drivers/pinctrl/freescale/pinctrl-imx.c
drivers/pinctrl/freescale/pinctrl-imx1-core.c
drivers/pinctrl/freescale/pinctrl-mxs.c
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
drivers/pinctrl/mvebu/pinctrl-mvebu.c
drivers/pinctrl/pinctrl-at91-pio4.c
drivers/pinctrl/pinctrl-at91.c
drivers/pinctrl/pinctrl-axp209.c
drivers/pinctrl/pinctrl-digicolor.c
drivers/pinctrl/pinctrl-ingenic.c
drivers/pinctrl/pinctrl-lpc18xx.c
drivers/pinctrl/pinctrl-ocelot.c
drivers/pinctrl/pinctrl-rockchip.c
drivers/pinctrl/pinctrl-single.c
drivers/pinctrl/pinctrl-st.c
drivers/pinctrl/pinctrl-xway.c
drivers/pinctrl/samsung/pinctrl-exynos.c
drivers/pinctrl/samsung/pinctrl-samsung.c
drivers/pinctrl/sh-pfc/core.c
drivers/pinctrl/sh-pfc/gpio.c
drivers/pinctrl/sh-pfc/pinctrl.c
drivers/pinctrl/spear/pinctrl-plgpio.c
drivers/pinctrl/sprd/pinctrl-sprd.c
drivers/pinctrl/sunxi/pinctrl-sunxi.c
drivers/pinctrl/tegra/pinctrl-tegra.c
drivers/pinctrl/ti/pinctrl-ti-iodelay.c
drivers/pinctrl/zte/pinctrl-zx.c
drivers/platform/mellanox/mlxreg-hotplug.c
drivers/power/supply/charger-manager.c
drivers/power/supply/power_supply_core.c
drivers/pwm/pwm-lp3943.c
drivers/regulator/act8865-regulator.c
drivers/regulator/as3711-regulator.c
drivers/regulator/bcm590xx-regulator.c
drivers/regulator/da9063-regulator.c
drivers/regulator/gpio-regulator.c
drivers/regulator/max1586.c
drivers/regulator/max8660.c
drivers/regulator/max8997-regulator.c
drivers/regulator/max8998.c
drivers/regulator/mc13xxx-regulator-core.c
drivers/regulator/pbias-regulator.c
drivers/regulator/rc5t583-regulator.c
drivers/regulator/s5m8767.c
drivers/regulator/ti-abb-regulator.c
drivers/regulator/tps65090-regulator.c
drivers/regulator/tps65217-regulator.c
drivers/regulator/tps65218-regulator.c
drivers/regulator/tps65910-regulator.c
drivers/regulator/tps80031-regulator.c
drivers/reset/reset-ti-syscon.c
drivers/scsi/isci/init.c
drivers/scsi/ufs/ufshcd-pltfrm.c
drivers/scsi/ufs/ufshcd.c
drivers/soc/bcm/raspberrypi-power.c
drivers/soc/mediatek/mtk-scpsys.c
drivers/soc/ti/knav_qmss_acc.c
drivers/spi/spi-davinci.c
drivers/spi/spi-ep93xx.c
drivers/spi/spi-gpio.c
drivers/spi/spi-imx.c
drivers/spi/spi-oc-tiny.c
drivers/spi/spi-pl022.c
drivers/spi/spi.c
drivers/staging/greybus/audio_topology.c
drivers/staging/media/imx/imx-media-dev.c
drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
drivers/thermal/tegra/soctherm.c
drivers/thermal/thermal-generic-adc.c
drivers/tty/serial/rp2.c
drivers/usb/gadget/udc/atmel_usba_udc.c
drivers/usb/gadget/udc/renesas_usb3.c
drivers/video/backlight/adp8860_bl.c
drivers/video/backlight/adp8870_bl.c
drivers/video/backlight/lp855x_bl.c
drivers/video/fbdev/au1100fb.c
drivers/video/fbdev/mxsfb.c
drivers/video/fbdev/omap2/omapfb/vrfb.c
sound/soc/au1x/dbdma2.c
sound/soc/codecs/hdmi-codec.c
sound/soc/codecs/rt5645.c
sound/soc/codecs/wm8994.c
sound/soc/davinci/davinci-mcasp.c
sound/soc/generic/audio-graph-card.c
sound/soc/generic/audio-graph-scu-card.c
sound/soc/generic/simple-card.c
sound/soc/generic/simple-scu-card.c
sound/soc/img/img-i2s-in.c
sound/soc/img/img-i2s-out.c
sound/soc/intel/skylake/skl-topology.c
sound/soc/mediatek/mt2701/mt2701-afe-pcm.c
sound/soc/pxa/mmp-sspa.c
sound/soc/rockchip/rk3399_gru_sound.c
sound/soc/sh/rcar/cmd.c
sound/soc/sh/rcar/core.c
sound/soc/sh/rcar/ctu.c
sound/soc/sh/rcar/dvc.c
sound/soc/sh/rcar/mix.c
sound/soc/sh/rcar/src.c
sound/soc/sh/rcar/ssi.c
sound/soc/sh/rcar/ssiu.c
sound/soc/soc-core.c
sound/soc/uniphier/aio-cpu.c

index 3563103590c6f69e4cc5abbf7fd3a9ea727ad501..fe0183d48dcd7ab7d0e81bfe53f8c07bc8e284ef 100644 (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 = 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");
index b87252bf4571775ba8344376e7a2c985b91e0487..d15814e1727fad991bf8c24c2d7fa728ad1bfcad 100644 (file)
@@ -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++) {
index cddf96f6e431fa7676db9d9fe097d80d864413ff..73ba8e134ca9a9054867ae4e32581f9cc825539d 100644 (file)
@@ -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;
index fb1442b08962fed3a61550d09958cae4e0730cd4..e906ecfe23dd82025cdfc9b412f309a7f04fdfdf 100644 (file)
@@ -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;
index 96c77c8e7f402818fc629d10e115bd882937a9d6..d31b090992163d12a4f7bda31be1464f6caf66e9 100644 (file)
@@ -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);
index 9e0b2f2b48e7421b3214f451f6d52c9f075592bf..7bef0666ae7e74646a59298eb4abddf1753e9e37 100644 (file)
@@ -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;
 
index d6036c788fab8fcbebb72bebbf9a6eaaccbda839..688e403333b914ef900a001c452da96110a40cd0 100644 (file)
@@ -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;
index b07559b9ed99a6e256ba5afce20b5e156304ade7..e6f9cbe5835f96883599d86006c54fd805f4e7e7 100644 (file)
@@ -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);
index 83cf631fc9bc6fe9d9ff3a9ebea418f87a40d139..70912104a19966d44e62ba76d517cdea9b0327f3 100644 (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 */
-       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;
index f81fa4a3e66bdcea4b64419f3f2586fbc1d70d68..a4aa6813de4b8b2e67e32a63c3cf519332e74bd5 100644 (file)
@@ -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;
index 7cebf0a6ffbca83201f88a20a00c40924ed3f52f..cf14f099ce4a0d8092e113f49848e1accef63755 100644 (file)
@@ -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;
index fe2af6aa88fc2b0cec9a103fcc2ca682f073659a..0b5b3abe054e6427f779beca3098a8d37d15cee3 100644 (file)
@@ -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;
 
index d96e3dc71cf8ba74fa92078d97c79d434344c949..3cd6a184fe7cfcb01b0bada99d73cac19d9c23b4 100644 (file)
@@ -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;
index 26b67455208fbd24d172e010fb224c16f2cd1a25..fa31cccbe04faf5fa6a8adb07abf6b48a4a6cdd2 100644 (file)
@@ -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;
 
index 3548caa9e9339f17208a62066ad055c842491e3b..c6589ccf1b9a3a4c49dcae612d86d08ab5c2ebdd 100644 (file)
@@ -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;
index cd92d696bcf98f8a5c762a4ef0117e1682503778..7056fe7513b4f73c98f1b4637161d70b4e9c5349 100644 (file)
@@ -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;
index 2bb695315300d9f9fab6c1b32f8ef85b6486ab05..2571bc7693dfc6e73d6d2726981f150c3bbad908 100644 (file)
@@ -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;
 
index 6d7a6c0a5e07ab67997a337b7c1f5ac7c1d978a9..c7d06a36b23a5670f4e2ddbe339698e38bce5796 100644 (file)
@@ -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;
 
index 5229036dcfbfc3ca8cb1065d636950e5d9e80a3b..a7d9a2046352cb4c41660d66af975ae6c28c2276 100644 (file)
@@ -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;
index 44c09904daa6adcbd261333986e4c09fbb627fc0..91b90c0cea731778bd524a13d801433e7df0a2ab 100644 (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
         * 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;
index 5e89f1c74a3398b6fb8337b63f29f5e4ad4c1264..b31ae16170e77fbfea0bcee1dd4525a859ffe83b 100644 (file)
@@ -897,8 +897,8 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev)
 
        /* Allocate a cache of the output registers */
        banks = gpio->config->nr_gpios >> 5;
-       gpio->dcache = devm_kzalloc(&pdev->dev,
-                                   sizeof(u32) * banks, GFP_KERNEL);
+       gpio->dcache = devm_kcalloc(&pdev->dev,
+                                   banks, sizeof(u32), GFP_KERNEL);
        if (!gpio->dcache)
                return -ENOMEM;
 
index eb8369b21e9074d65599c1cafbc37e05a35e12d9..00272fa7cc4faa3d64d3cacbd887b3c0b814aee2 100644 (file)
@@ -601,9 +601,10 @@ static int bcm_kona_gpio_probe(struct platform_device *pdev)
                        GPIO_MAX_BANK_NUM);
                return -ENXIO;
        }
-       kona_gpio->banks = devm_kzalloc(dev,
-                                       kona_gpio->num_bank *
-                                       sizeof(*kona_gpio->banks), GFP_KERNEL);
+       kona_gpio->banks = devm_kcalloc(dev,
+                                       kona_gpio->num_bank,
+                                       sizeof(*kona_gpio->banks),
+                                       GFP_KERNEL);
        if (!kona_gpio->banks)
                return -ENOMEM;
 
index b574ecff7761696d63bd2fc613c07238098fc441..035a454eca43b5534e9b8ef5e60c7d82ad44a0ca 100644 (file)
@@ -198,8 +198,8 @@ static int davinci_gpio_probe(struct platform_device *pdev)
                ngpio = ARCH_NR_GPIOS;
 
        nbank = DIV_ROUND_UP(ngpio, 32);
-       chips = devm_kzalloc(dev,
-                            nbank * sizeof(struct davinci_gpio_controller),
+       chips = devm_kcalloc(dev,
+                            nbank, sizeof(struct davinci_gpio_controller),
                             GFP_KERNEL);
        if (!chips)
                return -ENOMEM;
index 5163839349453115708eea5346d842d6a526ed81..ad6e5b5186691b01ed7cd301acc6a95985c41933 100644 (file)
@@ -321,8 +321,8 @@ static int __init egpio_probe(struct platform_device *pdev)
        platform_set_drvdata(pdev, ei);
 
        ei->nchips = pdata->num_chips;
-       ei->chip = devm_kzalloc(&pdev->dev,
-                               sizeof(struct egpio_chip) * ei->nchips,
+       ei->chip = devm_kcalloc(&pdev->dev,
+                               ei->nchips, sizeof(struct egpio_chip),
                                GFP_KERNEL);
        if (!ei->chip) {
                ret = -ENOMEM;
index d16e9d4a129bdd86874305d3d443b9eed9f9df7f..1306722faa5aa5ff727752f153803200d7f476e8 100644 (file)
@@ -504,16 +504,17 @@ static int thunderx_gpio_probe(struct pci_dev *pdev,
                txgpio->base_msi = (c >> 8) & 0xff;
        }
 
-       txgpio->msix_entries = devm_kzalloc(dev,
-                                         sizeof(struct msix_entry) * ngpio,
+       txgpio->msix_entries = devm_kcalloc(dev,
+                                         ngpio, sizeof(struct msix_entry),
                                          GFP_KERNEL);
        if (!txgpio->msix_entries) {
                err = -ENOMEM;
                goto out;
        }
 
-       txgpio->line_entries = devm_kzalloc(dev,
-                                           sizeof(struct thunderx_line) * ngpio,
+       txgpio->line_entries = devm_kcalloc(dev,
+                                           ngpio,
+                                           sizeof(struct thunderx_line),
                                            GFP_KERNEL);
        if (!txgpio->line_entries) {
                err = -ENOMEM;
index 7c3030b7e586db7ca245249a028dbfbedb829798..6d29777884f931eab3cde84986823b5341f0df76 100644 (file)
@@ -1723,8 +1723,8 @@ static int exynos_dsi_probe(struct platform_device *pdev)
                return -EPROBE_DEFER;
        }
 
-       dsi->clks = devm_kzalloc(dev,
-                       sizeof(*dsi->clks) * dsi->driver_data->num_clks,
+       dsi->clks = devm_kcalloc(dev,
+                       dsi->driver_data->num_clks, sizeof(*dsi->clks),
                        GFP_KERNEL);
        if (!dsi->clks)
                return -ENOMEM;
index 5ce84025d1cb80e577d47dc1f826fa5acb3e2bf4..6127ef25acd60ec5ec6db92655d364220963fc0b 100644 (file)
@@ -1271,7 +1271,8 @@ static int fimc_probe(struct platform_device *pdev)
 
        /* construct formats/limits array */
        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)
                return -ENOMEM;
 
index e99dd1e4ba652ef493e7bec2e92642f5611ee492..35ac66730563944e83dcb1a6be7ec39999ead086 100644 (file)
@@ -1202,8 +1202,9 @@ static int gsc_probe(struct platform_device *pdev)
        if (!ctx)
                return -ENOMEM;
 
-       formats = devm_kzalloc(dev, sizeof(*formats) *
-                              (ARRAY_SIZE(gsc_formats)), GFP_KERNEL);
+       formats = devm_kcalloc(dev,
+                              ARRAY_SIZE(gsc_formats), sizeof(*formats),
+                              GFP_KERNEL);
        if (!formats)
                return -ENOMEM;
 
index 09c4bc0b1859f7bc8412cc3dfb3806ddaa0d3134..db91932550cf77d6459efab1b5540e7c8501dc38 100644 (file)
@@ -1692,7 +1692,7 @@ static int hdmi_clk_init(struct hdmi_context *hdata)
        if (!count)
                return 0;
 
-       clks = devm_kzalloc(dev, sizeof(*clks) * count, GFP_KERNEL);
+       clks = devm_kcalloc(dev, count, sizeof(*clks), GFP_KERNEL);
        if (!clks)
                return -ENOMEM;
 
index e63dc0fb55f8c79225c1898964c0caa27c2ea6dc..c79659ca570655da77888052fc47a16bc53cf409 100644 (file)
@@ -157,8 +157,10 @@ static struct hdmi *msm_hdmi_init(struct platform_device *pdev)
                hdmi->qfprom_mmio = NULL;
        }
 
-       hdmi->hpd_regs = devm_kzalloc(&pdev->dev, sizeof(hdmi->hpd_regs[0]) *
-                       config->hpd_reg_cnt, GFP_KERNEL);
+       hdmi->hpd_regs = devm_kcalloc(&pdev->dev,
+                                     config->hpd_reg_cnt,
+                                     sizeof(hdmi->hpd_regs[0]),
+                                     GFP_KERNEL);
        if (!hdmi->hpd_regs) {
                ret = -ENOMEM;
                goto fail;
@@ -178,8 +180,10 @@ static struct hdmi *msm_hdmi_init(struct platform_device *pdev)
                hdmi->hpd_regs[i] = reg;
        }
 
-       hdmi->pwr_regs = devm_kzalloc(&pdev->dev, sizeof(hdmi->pwr_regs[0]) *
-                       config->pwr_reg_cnt, GFP_KERNEL);
+       hdmi->pwr_regs = devm_kcalloc(&pdev->dev,
+                                     config->pwr_reg_cnt,
+                                     sizeof(hdmi->pwr_regs[0]),
+                                     GFP_KERNEL);
        if (!hdmi->pwr_regs) {
                ret = -ENOMEM;
                goto fail;
@@ -199,8 +203,10 @@ static struct hdmi *msm_hdmi_init(struct platform_device *pdev)
                hdmi->pwr_regs[i] = reg;
        }
 
-       hdmi->hpd_clks = devm_kzalloc(&pdev->dev, sizeof(hdmi->hpd_clks[0]) *
-                       config->hpd_clk_cnt, GFP_KERNEL);
+       hdmi->hpd_clks = devm_kcalloc(&pdev->dev,
+                                     config->hpd_clk_cnt,
+                                     sizeof(hdmi->hpd_clks[0]),
+                                     GFP_KERNEL);
        if (!hdmi->hpd_clks) {
                ret = -ENOMEM;
                goto fail;
@@ -219,8 +225,10 @@ static struct hdmi *msm_hdmi_init(struct platform_device *pdev)
                hdmi->hpd_clks[i] = clk;
        }
 
-       hdmi->pwr_clks = devm_kzalloc(&pdev->dev, sizeof(hdmi->pwr_clks[0]) *
-                       config->pwr_clk_cnt, GFP_KERNEL);
+       hdmi->pwr_clks = devm_kcalloc(&pdev->dev,
+                                     config->pwr_clk_cnt,
+                                     sizeof(hdmi->pwr_clks[0]),
+                                     GFP_KERNEL);
        if (!hdmi->pwr_clks) {
                ret = -ENOMEM;
                goto fail;
index 5e631392dc851a035bdf8ee19a78deabe9ff3808..4157722d6b4dc897bd46cda2ce27436b2caa368b 100644 (file)
@@ -21,12 +21,12 @@ static int msm_hdmi_phy_resource_init(struct hdmi_phy *phy)
        struct device *dev = &phy->pdev->dev;
        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);
        if (!phy->regs)
                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);
        if (!phy->clks)
                return -ENOMEM;
index 25363fc571bcc285a009cffd4fb9ceaf7a28c24f..50af72baa5ca9a6dbf37505cda39fbd4290668c4 100644 (file)
@@ -624,7 +624,8 @@ static int sensor_hub_probe(struct hid_device *hdev,
                ret = -EINVAL;
                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),
                                                      GFP_KERNEL);
        if (sd->hid_sensor_hub_client_devs == NULL) {
index acc2536c80948522f66873f6e61da1499502066a..2d28cffc14046c94277b1960fa81aaede7cbd637 100644 (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;
                        if (!client_data->hid_devices)
-                               client_data->hid_devices = devm_kzalloc(
+                               client_data->hid_devices = devm_kcalloc(
                                                &client_data->cl_device->dev,
-                                               client_data->hid_dev_count *
+                                               client_data->hid_dev_count,
                                                sizeof(struct device_info),
                                                GFP_KERNEL);
                        if (!client_data->hid_devices) {
index ee7a37eb159acf41fcb6c40ac685c7f659672b29..c101369b51de88b927fdf2295f3bb664ed415899 100644 (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))
                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) {
                error = -ENOMEM;
                goto err;
@@ -1463,7 +1463,7 @@ static int wacom_led_groups_allocate(struct wacom *wacom, int count)
        struct wacom_group_leds *groups;
        int error;
 
-       groups = devm_kzalloc(dev, sizeof(struct wacom_group_leds) * count,
+       groups = devm_kcalloc(dev, count, sizeof(struct wacom_group_leds),
                              GFP_KERNEL);
        if (!groups)
                return -ENOMEM;
index 693a3d53cab5d9f281c3c66bddab76a60461733f..5e449eac788a1311ee1f3be0c6ba7f91c9415964 100644 (file)
@@ -894,7 +894,7 @@ static int aspeed_create_fan(struct device *dev,
        count = of_property_count_u8_elems(child, "aspeed,fan-tach-ch");
        if (count < 1)
                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);
        if (!fan_tach_ch)
                return -ENOMEM;
index 5c9a52599cf68ff8d7dcb181ac3cfdc162ea3d1b..a3974cddef07908abe354f41efda61f7a391f610 100644 (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");
                return -ENODEV;
        }
-       gpios = devm_kzalloc(dev,
-                            fan_data->num_gpios * sizeof(struct gpio_desc *),
+       gpios = devm_kcalloc(dev,
+                            fan_data->num_gpios, sizeof(struct gpio_desc *),
                             GFP_KERNEL);
        if (!gpios)
                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 ...>
         * this needs splitting into pairs to create gpio_fan_speed structs
         */
-       speed = devm_kzalloc(dev,
-                       fan_data->num_speed * sizeof(struct gpio_fan_speed),
+       speed = devm_kcalloc(dev,
+                       fan_data->num_speed, sizeof(struct gpio_fan_speed),
                        GFP_KERNEL);
        if (!speed)
                return -ENOMEM;
index 0298745d46e40626de00a1e36474b242f302adcf..f829dadfd5a06b5ec69fe48695ade65f51a370c8 100644 (file)
@@ -326,9 +326,9 @@ static int populate_attr_groups(struct platform_device *pdev)
        of_node_put(opal);
 
        for (type = 0; type < MAX_SENSOR_TYPE; type++) {
-               sensor_groups[type].group.attrs = devm_kzalloc(&pdev->dev,
-                                       sizeof(struct attribute *) *
-                                       (sensor_groups[type].attr_count + 1),
+               sensor_groups[type].group.attrs = devm_kcalloc(&pdev->dev,
+                                       sensor_groups[type].attr_count + 1,
+                                       sizeof(struct attribute *),
                                        GFP_KERNEL);
                if (!sensor_groups[type].group.attrs)
                        return -ENOMEM;
@@ -409,7 +409,8 @@ static int create_device_attrs(struct platform_device *pdev)
        int err = 0;
 
        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);
        if (!sdata) {
                err = -ENOMEM;
index 5e5b32a1ec4b7e3480cf4255658f6ec943cda83e..69031a0f7ed2c5ff44df47e102fbd7eacea3a1fc 100644 (file)
@@ -92,8 +92,8 @@ static int iio_hwmon_probe(struct platform_device *pdev)
        while (st->channels[st->num_channels].indio_dev)
                st->num_channels++;
 
-       st->attrs = devm_kzalloc(dev,
-                                sizeof(*st->attrs) * (st->num_channels + 1),
+       st->attrs = devm_kcalloc(dev,
+                                st->num_channels + 1, sizeof(*st->attrs),
                                 GFP_KERNEL);
        if (st->attrs == NULL) {
                ret = -ENOMEM;
index b0bc77bf2cd9b3a92f6c186add19aa34b5a6cc7d..a753464a1a33f5f0d2c6da89581feb330911d15e 100644 (file)
@@ -426,12 +426,12 @@ nct6683_create_attr_group(struct device *dev,
        if (group == NULL)
                return ERR_PTR(-ENOMEM);
 
-       attrs = devm_kzalloc(dev, sizeof(*attrs) * (repeat * count + 1),
+       attrs = devm_kcalloc(dev, repeat * count + 1, sizeof(*attrs),
                             GFP_KERNEL);
        if (attrs == NULL)
                return ERR_PTR(-ENOMEM);
 
-       su = devm_kzalloc(dev, sizeof(*su) * repeat * count,
+       su = devm_kzalloc(dev, array3_size(repeat, count, sizeof(*su)),
                          GFP_KERNEL);
        if (su == NULL)
                return ERR_PTR(-ENOMEM);
index aebce560bfaf39bbe826ab8cf3a1e2c5fb5895ca..155d4d1d1585af4aa7debc37163072af4979bd02 100644 (file)
@@ -1190,12 +1190,12 @@ nct6775_create_attr_group(struct device *dev,
        if (group == NULL)
                return ERR_PTR(-ENOMEM);
 
-       attrs = devm_kzalloc(dev, sizeof(*attrs) * (repeat * count + 1),
+       attrs = devm_kcalloc(dev, repeat * count + 1, sizeof(*attrs),
                             GFP_KERNEL);
        if (attrs == NULL)
                return ERR_PTR(-ENOMEM);
 
-       su = devm_kzalloc(dev, sizeof(*su) * repeat * count,
+       su = devm_kzalloc(dev, array3_size(repeat, count, sizeof(*su)),
                               GFP_KERNEL);
        if (su == NULL)
                return ERR_PTR(-ENOMEM);
index f7c47d7994e7f652bba64e6bc2336b6f603c4b94..82c3754e21e337c83b4d7e3a12236da78500f370 100644 (file)
@@ -2176,8 +2176,8 @@ static int pmbus_init_debugfs(struct i2c_client *client,
        }
 
        /* Allocate the max possible entries we need. */
-       entries = devm_kzalloc(data->dev,
-                              sizeof(*entries) * (data->info->pages * 10),
+       entries = devm_kcalloc(data->dev,
+                              data->info->pages * 10, sizeof(*entries),
                               GFP_KERNEL);
        if (!entries)
                return -ENOMEM;
index 70cecb06f93cae04f52f8cd3ff02a3a327d406ef..ae93885fccd81757662f534949b6d0604e51d708 100644 (file)
@@ -454,8 +454,8 @@ static int ucd9000_init_debugfs(struct i2c_client *client,
         */
        if (mid->driver_data == ucd9090 || mid->driver_data == ucd90160 ||
            mid->driver_data == ucd90910) {
-               entries = devm_kzalloc(&client->dev,
-                                      sizeof(*entries) * UCD9000_GPI_COUNT,
+               entries = devm_kcalloc(&client->dev,
+                                      UCD9000_GPI_COUNT, sizeof(*entries),
                                       GFP_KERNEL);
                if (!entries)
                        return -ENOMEM;
index 70cc0d134f3cd75f13ddc45eaaab905eecbaa779..7838af58f92d51639570d4134b3a95e488d91225 100644 (file)
@@ -180,7 +180,7 @@ static int pwm_fan_of_get_cooling_data(struct device *dev,
        }
 
        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);
        if (!ctx->pwm_fan_cooling_levels)
                return -ENOMEM;
index 9b6c55523c5833663a739a6712d29d17c23ade7a..320d29df17e109132edd2277760a3bf03a090265 100644 (file)
@@ -683,8 +683,8 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id)
        if (drvdata->buffer_depth & 0x80000000)
                return -EINVAL;
 
-       drvdata->buf = devm_kzalloc(dev,
-                                   drvdata->buffer_depth * 4, GFP_KERNEL);
+       drvdata->buf = devm_kcalloc(dev,
+                                   drvdata->buffer_depth, 4, GFP_KERNEL);
        if (!drvdata->buf)
                return -ENOMEM;
 
index a33a92ebe74bf05eb3696d872968f2f8c4ffde4d..6880bee195c8cfe35d947d4f203b6e2fe68a224e 100644 (file)
@@ -71,21 +71,24 @@ static int of_coresight_alloc_memory(struct device *dev,
                        struct coresight_platform_data *pdata)
 {
        /* 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),
                                       GFP_KERNEL);
        if (!pdata->outports)
                return -ENOMEM;
 
        /* 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),
                                          GFP_KERNEL);
        if (!pdata->child_names)
                return -ENOMEM;
 
        /* 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),
                                          GFP_KERNEL);
        if (!pdata->child_ports)
index 904dfec7ab96e5492c6563af4a60e01baa150f36..ebbf9cdec86b94c8bb75274fcd3469bd3f1ee837 100644 (file)
@@ -1691,8 +1691,8 @@ static int qup_i2c_probe(struct platform_device *pdev)
 
                qup->max_xfer_sg_len = (MX_BLOCKS << 1);
                blocks = (MX_DMA_BLOCKS << 1) + 1;
-               qup->btx.sg = devm_kzalloc(&pdev->dev,
-                                          sizeof(*qup->btx.sg) * blocks,
+               qup->btx.sg = devm_kcalloc(&pdev->dev,
+                                          blocks, sizeof(*qup->btx.sg),
                                           GFP_KERNEL);
                if (!qup->btx.sg) {
                        ret = -ENOMEM;
@@ -1700,8 +1700,8 @@ static int qup_i2c_probe(struct platform_device *pdev)
                }
                sg_init_table(qup->btx.sg, blocks);
 
-               qup->brx.sg = devm_kzalloc(&pdev->dev,
-                                          sizeof(*qup->brx.sg) * blocks,
+               qup->brx.sg = devm_kcalloc(&pdev->dev,
+                                          blocks, sizeof(*qup->brx.sg),
                                           GFP_KERNEL);
                if (!qup->brx.sg) {
                        ret = -ENOMEM;
index 1a9973ede4436d7f583c9c602b5c12e265f680fa..ddc4bd4ca13b3be4b170f395441223d9dc520adb 100644 (file)
@@ -88,8 +88,8 @@ static int i2c_mux_gpio_probe_dt(struct gpiomux *mux,
 
        mux->data.n_values = of_get_child_count(np);
 
-       values = devm_kzalloc(&pdev->dev,
-                             sizeof(*mux->data.values) * mux->data.n_values,
+       values = devm_kcalloc(&pdev->dev,
+                             mux->data.n_values, sizeof(*mux->data.values),
                              GFP_KERNEL);
        if (!values) {
                dev_err(&pdev->dev, "Cannot allocate values array");
@@ -111,8 +111,9 @@ static int i2c_mux_gpio_probe_dt(struct gpiomux *mux,
                return -EINVAL;
        }
 
-       gpios = devm_kzalloc(&pdev->dev,
-                            sizeof(*mux->data.gpios) * mux->data.n_gpios, GFP_KERNEL);
+       gpios = devm_kcalloc(&pdev->dev,
+                            mux->data.n_gpios, sizeof(*mux->data.gpios),
+                            GFP_KERNEL);
        if (!gpios) {
                dev_err(&pdev->dev, "Cannot allocate gpios array");
                return -ENOMEM;
index c948e5a4cb045198cf6ffd61d698f9f759f47059..f583f805fee9e5f7c96912a79eb67fdf24b3a3da 100644 (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");
 
-       values = devm_kzalloc(&pdev->dev,
-                             sizeof(*mux->data.values) * mux->data.n_values,
+       values = devm_kcalloc(&pdev->dev,
+                             mux->data.n_values, sizeof(*mux->data.values),
                              GFP_KERNEL);
        if (!values) {
                dev_err(&pdev->dev, "Cannot allocate values array");
index 71a5ee652b796f8666be32d174c466536c6c6244..44b516863c9d4d220f3323ca580d98fbb6f8e772 100644 (file)
@@ -624,8 +624,8 @@ static int at91_adc_trigger_init(struct iio_dev *idev)
        struct at91_adc_state *st = iio_priv(idev);
        int i, ret;
 
-       st->trig = devm_kzalloc(&idev->dev,
-                               st->trigger_number * sizeof(*st->trig),
+       st->trig = devm_kcalloc(&idev->dev,
+                               st->trigger_number, sizeof(*st->trig),
                                GFP_KERNEL);
 
        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->num_channels = st->caps->num_channels;
        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),
                                        GFP_KERNEL);
        if (!st->trigger_list) {
index 7f1848dac9bf06bf75f99d43d242253867d960ef..7fb4f525714a154e706a5e70dfbc0438b6308967 100644 (file)
@@ -1453,8 +1453,10 @@ static int max1363_alloc_scan_masks(struct iio_dev *indio_dev)
        int i;
 
        masks = devm_kzalloc(&indio_dev->dev,
-                       BITS_TO_LONGS(MAX1363_MAX_CHANNELS) * sizeof(long) *
-                       (st->chip_info->num_modes + 1), GFP_KERNEL);
+                       array3_size(BITS_TO_LONGS(MAX1363_MAX_CHANNELS),
+                                   sizeof(long),
+                                   st->chip_info->num_modes + 1),
+                       GFP_KERNEL);
        if (!masks)
                return -ENOMEM;
 
index dc83f8f6c3d359b762ee851de180d8e530aa57bc..e470510e76ea43d287f0eb13c55bcdc1422b7992 100644 (file)
@@ -898,9 +898,10 @@ static int twl6030_gpadc_probe(struct platform_device *pdev)
 
        gpadc = iio_priv(indio_dev);
 
-       gpadc->twl6030_cal_tbl = devm_kzalloc(dev,
-                                       sizeof(*gpadc->twl6030_cal_tbl) *
-                                       pdata->nchannels, GFP_KERNEL);
+       gpadc->twl6030_cal_tbl = devm_kcalloc(dev,
+                                       pdata->nchannels,
+                                       sizeof(*gpadc->twl6030_cal_tbl),
+                                       GFP_KERNEL);
        if (!gpadc->twl6030_cal_tbl)
                return -ENOMEM;
 
index 9234c6a09a932ba353c054638d530323f48430f5..095530c233e412242e83c55bb3085a643c2ba77f 100644 (file)
@@ -536,8 +536,9 @@ static int ad5592r_alloc_channels(struct ad5592r_state *st)
                        st->channel_offstate[reg] = tmp;
        }
 
-       channels = devm_kzalloc(st->dev,
-                       (1 + 2 * num_channels) * sizeof(*channels), GFP_KERNEL);
+       channels = devm_kcalloc(st->dev,
+                       1 + 2 * num_channels, sizeof(*channels),
+                       GFP_KERNEL);
        if (!channels)
                return -ENOMEM;
 
index 60621ccd67e4feb5b4630b21408fe7b3ed41f46b..e1f44cecdef4c50b984878229f7afb3389c9a7ca 100644 (file)
@@ -281,9 +281,10 @@ static int mux_configure_channel(struct device *dev, struct mux *mux,
                if (!page)
                        return -ENOMEM;
        }
-       child->ext_info_cache = devm_kzalloc(dev,
-                                            sizeof(*child->ext_info_cache) *
-                                            num_ext_info, GFP_KERNEL);
+       child->ext_info_cache = devm_kcalloc(dev,
+                                            num_ext_info,
+                                            sizeof(*child->ext_info_cache),
+                                            GFP_KERNEL);
        if (!child->ext_info_cache)
                return -ENOMEM;
 
index 997e3e97f573419c1e3d17429ecffaf5c0f43dba..e319f745771aab2096943478f6867bfd748900e7 100644 (file)
@@ -109,8 +109,8 @@ static int clps711x_keypad_probe(struct platform_device *pdev)
        if (priv->row_count < 1)
                return -EINVAL;
 
-       priv->gpio_data = devm_kzalloc(dev,
-                               sizeof(*priv->gpio_data) * priv->row_count,
+       priv->gpio_data = devm_kcalloc(dev,
+                               priv->row_count, sizeof(*priv->gpio_data),
                                GFP_KERNEL);
        if (!priv->gpio_data)
                return -ENOMEM;
index 41614c185918259d54546a50125601270f3852d7..f51ae09596ef25942ff6bab030be9697c3a0eca7 100644 (file)
@@ -443,9 +443,9 @@ matrix_keypad_parse_dt(struct device *dev)
        of_property_read_u32(np, "col-scan-delay-us",
                                                &pdata->col_scan_delay_us);
 
-       gpios = devm_kzalloc(dev,
-                            sizeof(unsigned int) *
-                               (pdata->num_row_gpios + pdata->num_col_gpios),
+       gpios = devm_kcalloc(dev,
+                            pdata->num_row_gpios + pdata->num_col_gpios,
+                            sizeof(unsigned int),
                             GFP_KERNEL);
        if (!gpios) {
                dev_err(dev, "could not allocate memory for gpios\n");
index 316414465c779b23d8ec4a03b42d634013dca9a8..1fe1aa2adf85d790daf8e1935b8026cf83c846f3 100644 (file)
@@ -281,7 +281,7 @@ samsung_keypad_parse_dt(struct device *dev)
 
        key_count = of_get_child_count(np);
        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) {
                dev_err(dev, "could not allocate memory for keymap\n");
                return ERR_PTR(-ENOMEM);
index 8ccefc15c7a4dfcfb03295a681f52620ebf47d4c..8b3a5758451ea21e7d43da670c04da5c5c20a39a 100644 (file)
@@ -170,8 +170,8 @@ int matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data,
                return -EINVAL;
 
        if (!keymap) {
-               keymap = devm_kzalloc(input_dev->dev.parent,
-                                     max_keys * sizeof(*keymap),
+               keymap = devm_kcalloc(input_dev->dev.parent,
+                                     max_keys, sizeof(*keymap),
                                      GFP_KERNEL);
                if (!keymap) {
                        dev_err(input_dev->dev.parent,
index 1588aecafff79d8fdb54d80b7fa03a2ee9036f00..6d304381fc30641c4626bf498a9a74fe16fdf548 100644 (file)
@@ -283,8 +283,8 @@ static int rotary_encoder_probe(struct platform_device *pdev)
        }
 
        encoder->irq =
-               devm_kzalloc(dev,
-                            sizeof(*encoder->irq) * encoder->gpios->ndescs,
+               devm_kcalloc(dev,
+                            encoder->gpios->ndescs, sizeof(*encoder->irq),
                             GFP_KERNEL);
        if (!encoder->irq)
                return -ENOMEM;
index f5954981e9ee5bb68002af651557232c673eb30c..7d29053dfb0f06878ff7897b59f52039a299a089 100644 (file)
@@ -636,9 +636,10 @@ int rmi_read_register_desc(struct rmi_device *d, u16 addr,
        rdesc->num_registers = bitmap_weight(rdesc->presense_map,
                                                RMI_REG_DESC_PRESENSE_BITS);
 
-       rdesc->registers = devm_kzalloc(&d->dev, rdesc->num_registers *
-                               sizeof(struct rmi_register_desc_item),
-                               GFP_KERNEL);
+       rdesc->registers = devm_kcalloc(&d->dev,
+                                       rdesc->num_registers,
+                                       sizeof(struct rmi_register_desc_item),
+                                       GFP_KERNEL);
        if (!rdesc->registers)
                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;
 
        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) {
                dev_err(dev, "Failed to allocate memory for irq masks.\n");
                return -ENOMEM;
index bc5e37f30ac1cf4022ac5a8a17f63fb1793d2ce0..12a233251793c24c754224ae1b379de52db34e7d 100644 (file)
@@ -1190,14 +1190,15 @@ static int rmi_f11_initialize(struct rmi_function *fn)
                f11->sensor.attn_size += f11->sensor.nbr_fingers * 2;
 
        /* allocate the in-kernel tracking buffers */
-       sensor->tracking_pos = devm_kzalloc(&fn->dev,
-                       sizeof(struct input_mt_pos) * sensor->nbr_fingers,
+       sensor->tracking_pos = devm_kcalloc(&fn->dev,
+                       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);
-       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)
                return -ENOMEM;
 
index 8b0db086d68a9361e622bd680e021b9251c17562..a3d1aa88f2a9ce27fcd1f89d2f87d58b21686fce 100644 (file)
@@ -502,14 +502,15 @@ static int rmi_f12_probe(struct rmi_function *fn)
        }
 
        /* allocate the in-kernel tracking buffers */
-       sensor->tracking_pos = devm_kzalloc(&fn->dev,
-                       sizeof(struct input_mt_pos) * sensor->nbr_fingers,
+       sensor->tracking_pos = devm_kcalloc(&fn->dev,
+                       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);
-       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)
                return -ENOMEM;
 
index 5343f2c08f1511bb7381240773a55f4dc50f0bcd..e8a59d1640192b75e6f83db0e2ad355064c19ff9 100644 (file)
@@ -685,7 +685,7 @@ static int rmi_f54_probe(struct rmi_function *fn)
        rx = f54->num_rx_electrodes;
        tx = f54->num_tx_electrodes;
        f54->report_data = devm_kzalloc(&fn->dev,
-                                       sizeof(u16) * tx * rx,
+                                       array3_size(tx, rx, sizeof(u16)),
                                        GFP_KERNEL);
        if (f54->report_data == NULL)
                return -ENOMEM;
index 082defc329a8e2cb8e4f6744d6fb7cba4c51fe5e..33b8c6e7ac0aceaca903af36e624ffdedfd9097a 100644 (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;
 
        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);
        if (!buf)
                return -ENOMEM;
@@ -96,9 +96,10 @@ static int rmi_spi_manage_pools(struct rmi_spi_xport *rmi_spi, int len)
         * per byte delays.
         */
        tmp = rmi_spi->rx_xfers;
-       xfer_buf = devm_kzalloc(&spi->dev,
-               (rmi_spi->rx_xfer_count + rmi_spi->tx_xfer_count)
-               * sizeof(struct spi_transfer), GFP_KERNEL);
+       xfer_buf = devm_kcalloc(&spi->dev,
+               rmi_spi->rx_xfer_count + rmi_spi->tx_xfer_count,
+               sizeof(struct spi_transfer),
+               GFP_KERNEL);
        if (!xfer_buf)
                return -ENOMEM;
 
index 69e7c60792a8e37130f75b447232d25369888cb8..f7a96bcf94a62e12d40cf38639b84b68bfb52437 100644 (file)
@@ -2082,7 +2082,7 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
                return -ENODEV;
        }
 
-       smmu->irqs = devm_kzalloc(dev, sizeof(*smmu->irqs) * num_irqs,
+       smmu->irqs = devm_kcalloc(dev, num_irqs, sizeof(*smmu->irqs),
                                  GFP_KERNEL);
        if (!smmu->irqs) {
                dev_err(dev, "failed to allocate %d irqs\n", num_irqs);
index 0468acfa131fe4d1904260561c8f3052673ae0a6..054cd2c8e9c8a670ee2c4fc23fe9ae3a6f78e41a 100644 (file)
@@ -1135,7 +1135,7 @@ static int rk_iommu_probe(struct platform_device *pdev)
        iommu->dev = dev;
        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);
        if (!iommu->bases)
                return -ENOMEM;
index e80263e16c4c8fe37f7fca956523d1a810567931..d00489a4b54f35f60e0abc0b41a489101d612e15 100644 (file)
@@ -354,7 +354,7 @@ static int pdc_intc_probe(struct platform_device *pdev)
        priv->nr_syswakes = val;
 
        /* 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);
        if (!priv->perip_irqs) {
                dev_err(&pdev->dev, "cannot allocate perip IRQ list\n");
index 4e17f7081efc54e28ffe034cf25e6f0f9e00cf9c..3be5c5dba1dab0a503b07dd3274d9eebbeabf5aa 100644 (file)
@@ -191,8 +191,8 @@ static int mvebu_gicp_probe(struct platform_device *pdev)
        gicp->spi_ranges_cnt = ret / 2;
 
        gicp->spi_ranges =
-               devm_kzalloc(&pdev->dev,
-                            gicp->spi_ranges_cnt *
+               devm_kcalloc(&pdev->dev,
+                            gicp->spi_ranges_cnt,
                             sizeof(struct mvebu_gicp_spi_range),
                             GFP_KERNEL);
        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_bitmap = devm_kzalloc(&pdev->dev,
-                               BITS_TO_LONGS(gicp->spi_cnt) * sizeof(long),
+       gicp->spi_bitmap = devm_kcalloc(&pdev->dev,
+                               BITS_TO_LONGS(gicp->spi_cnt), sizeof(long),
                                GFP_KERNEL);
        if (!gicp->spi_bitmap)
                return -ENOMEM;
index 853b2d3bdb1731fbd903fe468ddf3f370ac4c156..7ecf080f73ad4602a7a144d743fd721b219f0bb8 100644 (file)
@@ -108,7 +108,7 @@ static int adp5520_led_probe(struct platform_device *pdev)
                return -EFAULT;
        }
 
-       led = devm_kzalloc(&pdev->dev, sizeof(*led) * pdata->num_leds,
+       led = devm_kcalloc(&pdev->dev, pdata->num_leds, sizeof(*led),
                                GFP_KERNEL);
        if (!led)
                return -ENOMEM;
index 90eeedcbf3711b1fc9025918936565c334caff17..8c93d68964c7d9d3e3c1e4c170748b37a58d2ea7 100644 (file)
@@ -171,8 +171,8 @@ static int apu_led_config(struct device *dev, struct apu_led_pdata *apuld)
        int i;
        int err;
 
-       apu_led->pled = devm_kzalloc(dev,
-               sizeof(struct apu_led_priv) * apu_led->num_led_instances,
+       apu_led->pled = devm_kcalloc(dev,
+               apu_led->num_led_instances, sizeof(struct apu_led_priv),
                GFP_KERNEL);
 
        if (!apu_led->pled)
index f8c7d82c26529aea6e80b5b88d95e232a2cad706..31d4c94e6fd819190dc3c4313dc9acbc8f043b4f 100644 (file)
@@ -113,8 +113,8 @@ static int da9052_led_probe(struct platform_device *pdev)
                goto err;
        }
 
-       led = devm_kzalloc(&pdev->dev,
-                          sizeof(struct da9052_led) * pled->num_leds,
+       led = devm_kcalloc(&pdev->dev,
+                          pled->num_leds, sizeof(struct da9052_led),
                           GFP_KERNEL);
        if (!led) {
                error = -ENOMEM;
index 55c0517fbe03e731de79238fa7e65f07b287d49e..99689b51a73da57609eff47525237a5a4e69caf2 100644 (file)
@@ -533,8 +533,8 @@ static int lp5521_probe(struct i2c_client *client,
        if (!chip)
                return -ENOMEM;
 
-       led = devm_kzalloc(&client->dev,
-                       sizeof(*led) * pdata->num_channels, GFP_KERNEL);
+       led = devm_kcalloc(&client->dev,
+                       pdata->num_channels, sizeof(*led), GFP_KERNEL);
        if (!led)
                return -ENOMEM;
 
index 52b6f529e27802e441cc146fd500092d4032deaf..a2e74feee2b2fa2c2dbb92d29c54a5174ba192c0 100644 (file)
@@ -898,8 +898,8 @@ static int lp5523_probe(struct i2c_client *client,
        if (!chip)
                return -ENOMEM;
 
-       led = devm_kzalloc(&client->dev,
-                       sizeof(*led) * pdata->num_channels, GFP_KERNEL);
+       led = devm_kcalloc(&client->dev,
+                       pdata->num_channels, sizeof(*led), GFP_KERNEL);
        if (!led)
                return -ENOMEM;
 
index 05ffa34fb6ad0dc41f3afc18754a87aacb36a6c6..2a9009fe5545d059d625075eb04a0ed53dbb432e 100644 (file)
@@ -534,8 +534,8 @@ static int lp5562_probe(struct i2c_client *client,
        if (!chip)
                return -ENOMEM;
 
-       led = devm_kzalloc(&client->dev,
-                       sizeof(*led) * pdata->num_channels, GFP_KERNEL);
+       led = devm_kcalloc(&client->dev,
+                       pdata->num_channels, sizeof(*led), GFP_KERNEL);
        if (!led)
                return -ENOMEM;
 
index 5377f22ff994769eba699f93f5cff31cea16bfaf..3d79a63807615a33bb40577195973ee05125ba16 100644 (file)
@@ -560,7 +560,7 @@ struct lp55xx_platform_data *lp55xx_of_populate_pdata(struct device *dev,
                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)
                return ERR_PTR(-ENOMEM);
 
index 3adb113cf02e5d781bd395c57e1269a567a7b1d9..4c800b5989a9069c9e7194a1a9ea4817955f709b 100644 (file)
@@ -327,8 +327,8 @@ static int lp8501_probe(struct i2c_client *client,
        if (!chip)
                return -ENOMEM;
 
-       led = devm_kzalloc(&client->dev,
-                       sizeof(*led) * pdata->num_channels, GFP_KERNEL);
+       led = devm_kcalloc(&client->dev,
+                       pdata->num_channels, sizeof(*led), GFP_KERNEL);
        if (!led)
                return -ENOMEM;
 
index a7ff510cbdd06e113ee5e744ea0c1c9eb8c4618e..5ec730a31b6500e4e81d72a3be7ab828454c6a4d 100644 (file)
@@ -128,8 +128,8 @@ static int lt3593_led_probe(struct platform_device *pdev)
        if (!pdata)
                return -EBUSY;
 
-       leds_data = devm_kzalloc(&pdev->dev,
-                       sizeof(struct lt3593_led_data) * pdata->num_leds,
+       leds_data = devm_kcalloc(&pdev->dev,
+                       pdata->num_leds, sizeof(struct lt3593_led_data),
                        GFP_KERNEL);
        if (!leds_data)
                return -ENOMEM;
index 2421cf1049915a6ef52fa55d31b30d0c2e88f406..47ad7de9553c5170d908ef29a76ea34830f95766 100644 (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->led = devm_kzalloc(dev, pdata->num_leds * sizeof(*pdata->led),
+       pdata->led = devm_kcalloc(dev, pdata->num_leds, sizeof(*pdata->led),
                                  GFP_KERNEL);
        if (!pdata->led) {
                ret = -ENOMEM;
@@ -210,7 +210,7 @@ static int __init mc13xxx_led_probe(struct platform_device *pdev)
                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);
        if (!leds->led)
                return -ENOMEM;
index 281482e1d50fc2eec96c25ae8b570da03e38c22f..f4721f8065f0fa54fc844343ae95a70b2e3e3222 100644 (file)
@@ -329,8 +329,10 @@ static int mlxcpld_led_config(struct device *dev,
        int i;
        int err;
 
-       cpld->pled = devm_kzalloc(dev, sizeof(struct mlxcpld_led_priv) *
-                                 cpld->num_led_instances, GFP_KERNEL);
+       cpld->pled = devm_kcalloc(dev,
+                                 cpld->num_led_instances,
+                                 sizeof(struct mlxcpld_led_priv),
+                                 GFP_KERNEL);
        if (!cpld->pled)
                return -ENOMEM;
 
index f48b1aed9b4e3b410cf33a6c1e9f31d41058cf38..62fa0de526ee51e0543a546dcac6c4cf4f699f33 100644 (file)
@@ -335,7 +335,7 @@ static int gpio_ext_get_of_pdata(struct device *dev, struct device_node *np,
                return 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)
                return -ENOMEM;
 
@@ -355,7 +355,7 @@ static int gpio_ext_get_of_pdata(struct device *dev, struct device_node *np,
                return 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)
                return -ENOMEM;
 
@@ -415,7 +415,7 @@ static int netxbig_leds_get_of_pdata(struct device *dev,
                if (ret % 3)
                        return -EINVAL;
                num_timers = ret / 3;
-               timers = devm_kzalloc(dev, num_timers * sizeof(*timers),
+               timers = devm_kcalloc(dev, num_timers, sizeof(*timers),
                                      GFP_KERNEL);
                if (!timers)
                        return -ENOMEM;
@@ -444,7 +444,7 @@ static int netxbig_leds_get_of_pdata(struct device *dev,
                return -ENODEV;
        }
 
-       leds = devm_kzalloc(dev, num_leds * sizeof(*leds), GFP_KERNEL);
+       leds = devm_kcalloc(dev, num_leds, sizeof(*leds), GFP_KERNEL);
        if (!leds)
                return -ENOMEM;
 
@@ -470,8 +470,8 @@ static int netxbig_leds_get_of_pdata(struct device *dev,
                        goto err_node_put;
 
                mode_val =
-                       devm_kzalloc(dev,
-                                    NETXBIG_LED_MODE_NUM * sizeof(*mode_val),
+                       devm_kcalloc(dev,
+                                    NETXBIG_LED_MODE_NUM, sizeof(*mode_val),
                                     GFP_KERNEL);
                if (!mode_val) {
                        ret = -ENOMEM;
@@ -560,8 +560,8 @@ static int netxbig_led_probe(struct platform_device *pdev)
                        return ret;
        }
 
-       leds_data = devm_kzalloc(&pdev->dev,
-                                pdata->num_leds * sizeof(*leds_data),
+       leds_data = devm_kcalloc(&pdev->dev,
+                                pdata->num_leds, sizeof(*leds_data),
                                 GFP_KERNEL);
        if (!leds_data)
                return -ENOMEM;
index 506b75b190e7325a46ac8517dcdcf651c50d7050..14fe5cd43232965c143992da47552818d6182380 100644 (file)
@@ -264,7 +264,7 @@ ns2_leds_get_of_pdata(struct device *dev, struct ns2_led_platform_data *pdata)
        if (!num_leds)
                return -ENODEV;
 
-       leds = devm_kzalloc(dev, num_leds * sizeof(struct ns2_led),
+       leds = devm_kcalloc(dev, num_leds, sizeof(struct ns2_led),
                            GFP_KERNEL);
        if (!leds)
                return -ENOMEM;
@@ -298,8 +298,9 @@ ns2_leds_get_of_pdata(struct device *dev, struct ns2_led_platform_data *pdata)
                }
 
                num_modes = ret / 3;
-               modval = devm_kzalloc(dev,
-                                     num_modes * sizeof(struct ns2_led_modval),
+               modval = devm_kcalloc(dev,
+                                     num_modes,
+                                     sizeof(struct ns2_led_modval),
                                      GFP_KERNEL);
                if (!modval)
                        return -ENOMEM;
index 78183f90820eac0e424315ba75302dac62a48ca7..f51b356d44264dd68918ccbe9ff599e67503f33f 100644 (file)
@@ -390,8 +390,8 @@ pca955x_pdata_of_init(struct i2c_client *client, struct pca955x_chipdef *chip)
        if (!pdata)
                return ERR_PTR(-ENOMEM);
 
-       pdata->leds = devm_kzalloc(&client->dev,
-                                  sizeof(struct pca955x_led) * chip->bits,
+       pdata->leds = devm_kcalloc(&client->dev,
+                                  chip->bits, sizeof(struct pca955x_led),
                                   GFP_KERNEL);
        if (!pdata->leds)
                return ERR_PTR(-ENOMEM);
@@ -494,8 +494,8 @@ static int pca955x_probe(struct i2c_client *client,
        if (!pca955x)
                return -ENOMEM;
 
-       pca955x->leds = devm_kzalloc(&client->dev,
-                       sizeof(*pca955x_led) * chip->bits, GFP_KERNEL);
+       pca955x->leds = devm_kcalloc(&client->dev,
+                       chip->bits, sizeof(*pca955x_led), GFP_KERNEL);
        if (!pca955x->leds)
                return -ENOMEM;
 
index 3bf9a127181927d84f374c1b60cc9373dafad149..5c0908113e388ac9e67e751b496423feb9e73e9f 100644 (file)
@@ -300,8 +300,8 @@ pca963x_dt_init(struct i2c_client *client, struct pca963x_chipdef *chip)
        if (!count || count > chip->n_leds)
                return ERR_PTR(-ENODEV);
 
-       pca963x_leds = devm_kzalloc(&client->dev,
-                       sizeof(struct led_info) * chip->n_leds, GFP_KERNEL);
+       pca963x_leds = devm_kcalloc(&client->dev,
+                       chip->n_leds, sizeof(struct led_info), GFP_KERNEL);
        if (!pca963x_leds)
                return ERR_PTR(-ENOMEM);
 
@@ -407,7 +407,7 @@ static int pca963x_probe(struct i2c_client *client,
                                                                GFP_KERNEL);
        if (!pca963x_chip)
                return -ENOMEM;
-       pca963x = devm_kzalloc(&client->dev, chip->n_leds * sizeof(*pca963x),
+       pca963x = devm_kcalloc(&client->dev, chip->n_leds, sizeof(*pca963x),
                                                                GFP_KERNEL);
        if (!pca963x)
                return -ENOMEM;
index c12c16fb1b9ce811f3dd7401bfff43eb0f9bc62c..8f343afa4787027d54fa5484a581f0bbd56c37e0 100644 (file)
@@ -697,8 +697,8 @@ tca6507_led_dt_init(struct i2c_client *client)
        if (!count || count > NUM_LEDS)
                return ERR_PTR(-ENODEV);
 
-       tca_leds = devm_kzalloc(&client->dev,
-                       sizeof(struct led_info) * NUM_LEDS, GFP_KERNEL);
+       tca_leds = devm_kcalloc(&client->dev,
+                       NUM_LEDS, sizeof(struct led_info), GFP_KERNEL);
        if (!tca_leds)
                return ERR_PTR(-ENOMEM);
 
index 519376d3534cfa05d623819b4ceb3f5a398e0cf3..4fa9803cd2041c035a0fdaff538b659f25a3327d 100644 (file)
@@ -282,13 +282,13 @@ static int hi6220_mbox_probe(struct platform_device *pdev)
 
        mbox->dev = dev;
        mbox->chan_num = MBOX_CHAN_MAX;
-       mbox->mchan = devm_kzalloc(dev,
-               mbox->chan_num * sizeof(*mbox->mchan), GFP_KERNEL);
+       mbox->mchan = devm_kcalloc(dev,
+               mbox->chan_num, sizeof(*mbox->mchan), GFP_KERNEL);
        if (!mbox->mchan)
                return -ENOMEM;
 
-       mbox->chan = devm_kzalloc(dev,
-               mbox->chan_num * sizeof(*mbox->chan), GFP_KERNEL);
+       mbox->chan = devm_kcalloc(dev,
+               mbox->chan_num, sizeof(*mbox->chan), GFP_KERNEL);
        if (!mbox->chan)
                return -ENOMEM;
 
index 41bcd339b68a1987eb1a62c1a6653c711341e350..779d41262ef0c8d9d7fde683efd7017b9eb1011c 100644 (file)
@@ -442,8 +442,8 @@ static int sti_mbox_probe(struct platform_device *pdev)
        if (!mbox)
                return -ENOMEM;
 
-       chans = devm_kzalloc(&pdev->dev,
-                            sizeof(*chans) * STI_MBOX_CHAN_MAX, GFP_KERNEL);
+       chans = devm_kcalloc(&pdev->dev,
+                            STI_MBOX_CHAN_MAX, sizeof(*chans), GFP_KERNEL);
        if (!chans)
                return -ENOMEM;
 
index 2517038a8452c638aa45a11577cd20ee0dde6a20..e1e2c085e68eee99e3b6b90af1b32f9426dcf51c 100644 (file)
@@ -729,7 +729,7 @@ static int omap_mbox_probe(struct platform_device *pdev)
                return -ENODEV;
        }
 
-       finfoblk = devm_kzalloc(&pdev->dev, info_count * sizeof(*finfoblk),
+       finfoblk = devm_kcalloc(&pdev->dev, info_count, sizeof(*finfoblk),
                                GFP_KERNEL);
        if (!finfoblk)
                return -ENOMEM;
@@ -773,23 +773,23 @@ static int omap_mbox_probe(struct platform_device *pdev)
        if (IS_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);
        if (!mdev->irq_ctx)
                return -ENOMEM;
 
        /* 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);
        if (!list)
                return -ENOMEM;
 
-       chnls = devm_kzalloc(&pdev->dev, (info_count + 1) * sizeof(*chnls),
+       chnls = devm_kcalloc(&pdev->dev, info_count + 1, sizeof(*chnls),
                             GFP_KERNEL);
        if (!chnls)
                return -ENOMEM;
 
-       mboxblk = devm_kzalloc(&pdev->dev, info_count * sizeof(*mbox),
+       mboxblk = devm_kcalloc(&pdev->dev, info_count, sizeof(*mbox),
                               GFP_KERNEL);
        if (!mboxblk)
                return -ENOMEM;
index 78753a87ba4d112367d6b4c6691cd9b0f062e575..5d04738c3c8a66e465fbe1efd505a4d5c6d4fb3a 100644 (file)
@@ -568,12 +568,12 @@ static int ti_msgmgr_probe(struct platform_device *pdev)
        }
        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)
                return -ENOMEM;
        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)
                return -ENOMEM;
        inst->chans = chans;
index ff46d2c96cea346d1c73fd0161b3c4cad05f7ee2..5007c9659342dbbd2b2e96c00453bf77163ee0ab 100644 (file)
@@ -373,7 +373,7 @@ static int s5k5baf_fw_parse(struct device *dev, struct s5k5baf_fw **fw,
        data += 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)
                return -ENOMEM;
 
index 58ebc2220d0e9d56a47ff55ea2bf2b41f5a50da0..b05738a95e55e1dc77449e0780fa6a30b019009f 100644 (file)
@@ -2586,8 +2586,10 @@ static int vpfe_probe(struct platform_device *pdev)
 
        pm_runtime_put_sync(&pdev->dev);
 
-       vpfe->sd = devm_kzalloc(&pdev->dev, sizeof(struct v4l2_subdev *) *
-                               ARRAY_SIZE(vpfe->cfg->asd), GFP_KERNEL);
+       vpfe->sd = devm_kcalloc(&pdev->dev,
+                               ARRAY_SIZE(vpfe->cfg->asd),
+                               sizeof(struct v4l2_subdev *),
+                               GFP_KERNEL);
        if (!vpfe->sd) {
                ret = -ENOMEM;
                goto probe_out_v4l2_unregister;
index 9364cdf62f5427542679458df07b800588eb4006..a96f53ce808867f21b6a658532c4264b66704801 100644 (file)
@@ -1528,8 +1528,10 @@ vpif_capture_get_pdata(struct platform_device *pdev)
        if (!pdata)
                return NULL;
        pdata->subdev_info =
-               devm_kzalloc(&pdev->dev, sizeof(*pdata->subdev_info) *
-                            VPIF_CAPTURE_NUM_CHANNELS, GFP_KERNEL);
+               devm_kcalloc(&pdev->dev,
+                            VPIF_CAPTURE_NUM_CHANNELS,
+                            sizeof(*pdata->subdev_info),
+                            GFP_KERNEL);
 
        if (!pdata->subdev_info)
                return NULL;
@@ -1546,9 +1548,9 @@ vpif_capture_get_pdata(struct platform_device *pdev)
 
                sdinfo = &pdata->subdev_info[i];
                chan = &pdata->chan_config[i];
-               chan->inputs = devm_kzalloc(&pdev->dev,
-                                           sizeof(*chan->inputs) *
+               chan->inputs = devm_kcalloc(&pdev->dev,
                                            VPIF_CAPTURE_NUM_CHANNELS,
+                                           sizeof(*chan->inputs),
                                            GFP_KERNEL);
                if (!chan->inputs)
                        return NULL;
index 64df82817de3c4ce7a9314302273320fe5d1bb7b..226f36ef741930ff2ff5240470cbb641edd1a512 100644 (file)
@@ -845,7 +845,7 @@ int msm_csid_subdev_init(struct csid_device *csid,
        while (res->clock[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);
        if (!csid->clock)
                return -ENOMEM;
@@ -868,8 +868,10 @@ int msm_csid_subdev_init(struct csid_device *csid,
                        continue;
                }
 
-               clock->freq = devm_kzalloc(dev, clock->nfreqs *
-                                          sizeof(*clock->freq), GFP_KERNEL);
+               clock->freq = devm_kcalloc(dev,
+                                          clock->nfreqs,
+                                          sizeof(*clock->freq),
+                                          GFP_KERNEL);
                if (!clock->freq)
                        return -ENOMEM;
 
index 072c6cf053f6a576e906e299d4fe6ab189ff099d..7e61caba6a2dcbfafa23d7a574faa6104e18fb77 100644 (file)
@@ -732,8 +732,9 @@ int msm_csiphy_subdev_init(struct csiphy_device *csiphy,
        while (res->clock[csiphy->nclocks])
                csiphy->nclocks++;
 
-       csiphy->clock = devm_kzalloc(dev, csiphy->nclocks *
-                                    sizeof(*csiphy->clock), GFP_KERNEL);
+       csiphy->clock = devm_kcalloc(dev,
+                                    csiphy->nclocks, sizeof(*csiphy->clock),
+                                    GFP_KERNEL);
        if (!csiphy->clock)
                return -ENOMEM;
 
@@ -755,8 +756,10 @@ int msm_csiphy_subdev_init(struct csiphy_device *csiphy,
                        continue;
                }
 
-               clock->freq = devm_kzalloc(dev, clock->nfreqs *
-                                          sizeof(*clock->freq), GFP_KERNEL);
+               clock->freq = devm_kcalloc(dev,
+                                          clock->nfreqs,
+                                          sizeof(*clock->freq),
+                                          GFP_KERNEL);
                if (!clock->freq)
                        return -ENOMEM;
 
index 24da529397b5ba5ccb71d386e8ce3d4591a83a5b..9d1af9353c1dcde30b0bbe732b14ec28626f9ce8 100644 (file)
@@ -948,7 +948,8 @@ int msm_ispif_subdev_init(struct ispif_device *ispif,
        while (res->clock[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);
        if (!ispif->clock)
                return -ENOMEM;
@@ -968,8 +969,10 @@ int msm_ispif_subdev_init(struct ispif_device *ispif,
        while (res->clock_for_reset[ispif->nclocks_for_reset])
                ispif->nclocks_for_reset++;
 
-       ispif->clock_for_reset = devm_kzalloc(dev, ispif->nclocks_for_reset *
-                       sizeof(*ispif->clock_for_reset), GFP_KERNEL);
+       ispif->clock_for_reset = devm_kcalloc(dev,
+                                             ispif->nclocks_for_reset,
+                                             sizeof(*ispif->clock_for_reset),
+                                             GFP_KERNEL);
        if (!ispif->clock_for_reset)
                return -ENOMEM;
 
index 55232a9129503e3dda670a3821d0a0f6390a6f2c..a6329a8a7c4a3ab82457b2573f06c0fc7464c10f 100644 (file)
@@ -2794,7 +2794,7 @@ int msm_vfe_subdev_init(struct vfe_device *vfe, const struct resources *res)
        while (res->clock[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);
        if (!vfe->clock)
                return -ENOMEM;
@@ -2817,8 +2817,10 @@ int msm_vfe_subdev_init(struct vfe_device *vfe, const struct resources *res)
                        continue;
                }
 
-               clock->freq = devm_kzalloc(dev, clock->nfreqs *
-                                          sizeof(*clock->freq), GFP_KERNEL);
+               clock->freq = devm_kcalloc(dev,
+                                          clock->nfreqs,
+                                          sizeof(*clock->freq),
+                                          GFP_KERNEL);
                if (!clock->freq)
                        return -ENOMEM;
 
index 05f06c98aa64592ceb9c1307af98df9359d05c4c..23fda6207a230330879fba5b3dbb4a3a709e9f99 100644 (file)
@@ -271,7 +271,8 @@ static int camss_of_parse_endpoint_node(struct device *dev,
        lncfg->clk.pol = mipi_csi2->lane_polarities[0];
        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);
        if (!lncfg->data)
                return -ENOMEM;
index da276a85aa95398a97c1a569ec877fbbba4795d5..36a29e13109ece5a0b0cf7d11d178b91b9334f2c 100644 (file)
@@ -630,7 +630,8 @@ int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity,
        entity->source_pad = num_pads - 1;
 
        /* 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);
        if (entity->pads == NULL)
                return -ENOMEM;
index 6bb28cd49dae90513fb089c355b32511e94df00e..6d95ec1e9a6b4b4450d4c60266c27ac72e807137 100644 (file)
@@ -532,7 +532,7 @@ static int xvip_graph_init(struct xvip_composite_device *xdev)
 
        /* Register the subdevices notifier. */
        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);
        if (subdevs == NULL) {
                ret = -ENOMEM;
index 4ceef217de83529e469fc82c5db4e7bd0078ae81..215b4804ada29a5d8b037c96ad6bc1ebfd968eaa 100644 (file)
@@ -412,9 +412,10 @@ static int v4l2_flash_init_controls(struct v4l2_flash *v4l2_flash,
        struct v4l2_ctrl_config *ctrl_cfg;
        int i, ret, num_ctrls = 0;
 
-       v4l2_flash->ctrls = devm_kzalloc(v4l2_flash->sd.dev,
-                                       sizeof(*v4l2_flash->ctrls) *
-                                       (STROBE_SOURCE + 1), GFP_KERNEL);
+       v4l2_flash->ctrls = devm_kcalloc(v4l2_flash->sd.dev,
+                                       STROBE_SOURCE + 1,
+                                       sizeof(*v4l2_flash->ctrls),
+                                       GFP_KERNEL);
        if (!v4l2_flash->ctrls)
                return -ENOMEM;
 
index 568f05ed961a8764a23c0a909d68c384c5afc127..2f5ed7366eec73e16d61e14dd9e2bff502980148 100644 (file)
@@ -126,8 +126,8 @@ const struct lpddr2_timings *of_get_ddr_timings(struct device_node *np_ddr,
                        arr_sz++;
 
        if (arr_sz)
-               timings = devm_kzalloc(dev, sizeof(*timings) * arr_sz,
-                       GFP_KERNEL);
+               timings = devm_kcalloc(dev, arr_sz, sizeof(*timings),
+                                      GFP_KERNEL);
 
        if (!timings)
                goto default_timings;
index 831a1ceb2ed24e1d8c42c0f3545603dea2c0dc55..8d652b2f9d14f084e22b0db984236f8407f27254 100644 (file)
@@ -2659,18 +2659,18 @@ static int ab8500_debug_probe(struct platform_device *plf)
        ab8500 = dev_get_drvdata(plf->dev.parent);
        num_irqs = ab8500->mask_size;
 
-       irq_count = devm_kzalloc(&plf->dev,
-                                sizeof(*irq_count)*num_irqs, GFP_KERNEL);
+       irq_count = devm_kcalloc(&plf->dev,
+                                num_irqs, sizeof(*irq_count), GFP_KERNEL);
        if (!irq_count)
                return -ENOMEM;
 
-       dev_attr = devm_kzalloc(&plf->dev,
-                               sizeof(*dev_attr)*num_irqs, GFP_KERNEL);
+       dev_attr = devm_kcalloc(&plf->dev,
+                               num_irqs, sizeof(*dev_attr), GFP_KERNEL);
        if (!dev_attr)
                return -ENOMEM;
 
-       event_name = devm_kzalloc(&plf->dev,
-                                 sizeof(*event_name)*num_irqs, GFP_KERNEL);
+       event_name = devm_kcalloc(&plf->dev,
+                                 num_irqs, sizeof(*event_name), GFP_KERNEL);
        if (!event_name)
                return -ENOMEM;
 
index 4bf8b7781c77eee3f30826f5503cd36524ddc2cc..01572b5e79e8f2f96b6a2b9206ccf260eaaea1d9 100644 (file)
@@ -477,7 +477,9 @@ static int htcpld_setup_chips(struct platform_device *pdev)
 
        /* Setup each chip's output GPIOs */
        htcpld->nchips = pdata->num_chip;
-       htcpld->chip = devm_kzalloc(dev, sizeof(struct htcpld_chip) * htcpld->nchips,
+       htcpld->chip = devm_kcalloc(dev,
+                                   htcpld->nchips,
+                                   sizeof(struct htcpld_chip),
                                    GFP_KERNEL);
        if (!htcpld->chip)
                return -ENOMEM;
index d2cc1eabac05b26faaf76d21d6a18cce8ceccd68..5276911caaec27f23e477850d38a324624f80f35 100644 (file)
@@ -173,9 +173,9 @@ static int cpcap_init_irq(struct cpcap_ddata *cpcap)
        int ret;
 
        cpcap->irqs = devm_kzalloc(&cpcap->spi->dev,
-                                  sizeof(*cpcap->irqs) *
-                                  CPCAP_NR_IRQ_REG_BANKS *
-                                  cpcap->regmap_conf->val_bits,
+                                  array3_size(sizeof(*cpcap->irqs),
+                                              CPCAP_NR_IRQ_REG_BANKS,
+                                              cpcap->regmap_conf->val_bits),
                                   GFP_KERNEL);
        if (!cpcap->irqs)
                return -ENOMEM;
index 3460ef07623cec27d5c1e26870862de319c7ed3a..69df27769c2136e817d3baf575269c59902752ac 100644 (file)
@@ -199,8 +199,9 @@ static int sprd_pmic_probe(struct spi_device *spi)
        ddata->irq_chip.num_irqs = pdata->num_irqs;
        ddata->irq_chip.mask_invert = true;
 
-       ddata->irqs = devm_kzalloc(&spi->dev, sizeof(struct regmap_irq) *
-                                  pdata->num_irqs, GFP_KERNEL);
+       ddata->irqs = devm_kcalloc(&spi->dev,
+                                  pdata->num_irqs, sizeof(struct regmap_irq),
+                                  GFP_KERNEL);
        if (!ddata->irqs)
                return -ENOMEM;
 
index c649344fd7f25543a676a89455f61a68893a289e..4be3d239da9ec8a2db40eea62f608f6559cff5a3 100644 (file)
@@ -1139,8 +1139,9 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
        }
 
        num_slaves = twl_get_num_slaves();
-       twl_priv->twl_modules = devm_kzalloc(&client->dev,
-                                        sizeof(struct twl_client) * num_slaves,
+       twl_priv->twl_modules = devm_kcalloc(&client->dev,
+                                        num_slaves,
+                                        sizeof(struct twl_client),
                                         GFP_KERNEL);
        if (!twl_priv->twl_modules) {
                status = -ENOMEM;
index 953d0790ffd566e967058f7eeb640ff51377cf45..5d5888ee2966818e5b8e266ac41680344011b42b 100644 (file)
@@ -368,9 +368,10 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq)
                goto err;
        }
 
-       wm8994->supplies = devm_kzalloc(wm8994->dev,
-                                       sizeof(struct regulator_bulk_data) *
-                                       wm8994->num_supplies, GFP_KERNEL);
+       wm8994->supplies = devm_kcalloc(wm8994->dev,
+                                       wm8994->num_supplies,
+                                       sizeof(struct regulator_bulk_data),
+                                       GFP_KERNEL);
        if (!wm8994->supplies) {
                ret = -ENOMEM;
                goto err;
index e2e31b65bc5ab0256c9deab9498cbebd53981df2..c5dc6095686a28490e06f97e659e44d8a04971aa 100644 (file)
@@ -264,8 +264,8 @@ static int sram_reserve_regions(struct sram_dev *sram, struct resource *res)
        list_sort(NULL, &reserve_list, sram_reserve_cmp);
 
        if (exports) {
-               sram->partition = devm_kzalloc(sram->dev,
-                                      exports * sizeof(*sram->partition),
+               sram->partition = devm_kcalloc(sram->dev,
+                                      exports, sizeof(*sram->partition),
                                       GFP_KERNEL);
                if (!sram->partition) {
                        ret = -ENOMEM;
index f3a7c8ece4bef74c0cd29ea28361157d44ed418e..88347ce78f23feee0b1b2f1f191c0891ce563358 100644 (file)
@@ -797,8 +797,10 @@ static int sdhci_omap_config_iodelay_pinctrl_state(struct sdhci_omap_host
        if (!(omap_host->flags & SDHCI_OMAP_REQUIRE_IODELAY))
                return 0;
 
-       pinctrl_state = devm_kzalloc(dev, sizeof(*pinctrl_state) *
-                                    (MMC_TIMING_MMC_HS200 + 1), GFP_KERNEL);
+       pinctrl_state = devm_kcalloc(dev,
+                                    MMC_TIMING_MMC_HS200 + 1,
+                                    sizeof(*pinctrl_state),
+                                    GFP_KERNEL);
        if (!pinctrl_state)
                return -ENOMEM;
 
index a0d485f52cbe563aaa323f55ff732bee0fca8576..512bd4c2eec0b3a31f8dcd5d1a201c780a6fafcf 100644 (file)
@@ -1993,7 +1993,7 @@ static int __init docg3_probe(struct platform_device *pdev)
        base = devm_ioremap(dev, ress->start, DOC_IOSPACE_SIZE);
 
        ret = -ENOMEM;
-       cascade = devm_kzalloc(dev, sizeof(*cascade) * DOC_MAX_NBFLOORS,
+       cascade = devm_kcalloc(dev, DOC_MAX_NBFLOORS, sizeof(*cascade),
                               GFP_KERNEL);
        if (!cascade)
                return ret;
index b554fb6e609c39ec7530a133b793f8eaec66ff41..6a5519f0ff2587d580acd09019a6ecfa8d6a9b21 100644 (file)
@@ -2510,8 +2510,8 @@ static int qcom_nandc_alloc(struct qcom_nand_controller *nandc)
        if (!nandc->regs)
                return -ENOMEM;
 
-       nandc->reg_read_buf = devm_kzalloc(nandc->dev,
-                               MAX_REG_RD * sizeof(*nandc->reg_read_buf),
+       nandc->reg_read_buf = devm_kcalloc(nandc->dev,
+                               MAX_REG_RD, sizeof(*nandc->reg_read_buf),
                                GFP_KERNEL);
        if (!nandc->reg_read_buf)
                return -ENOMEM;
index 1bc0458063d8e300388d7ebf38ff6ea3c7067012..19661c5d3220a4533794a1906388dc38a8a919ca 100644 (file)
@@ -1038,7 +1038,7 @@ static int s3c24xx_nand_probe_dt(struct platform_device *pdev)
        if (!pdata->nr_sets)
                return 0;
 
-       sets = devm_kzalloc(&pdev->dev, sizeof(*sets) * pdata->nr_sets,
+       sets = devm_kcalloc(&pdev->dev, pdata->nr_sets, sizeof(*sets),
                            GFP_KERNEL);
        if (!sets)
                return -ENOMEM;
index 5e010b1592f7a6b18c9aa4dcc42de24d27e12c4d..d93c790bfbe8d5c37de8183f3527962e72e6e175 100644 (file)
@@ -2044,14 +2044,14 @@ static int b53_switch_init(struct b53_device *dev)
                }
        }
 
-       dev->ports = devm_kzalloc(dev->dev,
-                                 sizeof(struct b53_port) * dev->num_ports,
+       dev->ports = devm_kcalloc(dev->dev,
+                                 dev->num_ports, sizeof(struct b53_port),
                                  GFP_KERNEL);
        if (!dev->ports)
                return -ENOMEM;
 
-       dev->vlans = devm_kzalloc(dev->dev,
-                                 sizeof(struct b53_vlan) * dev->num_vlans,
+       dev->vlans = devm_kcalloc(dev->dev,
+                                 dev->num_vlans, sizeof(struct b53_vlan),
                                  GFP_KERNEL);
        if (!dev->vlans)
                return -ENOMEM;
index 060cb18fa65963d15ae56cc41164b78d8f0180ed..521607bc43937f0954fb20414c5b1002123c244d 100644 (file)
@@ -838,8 +838,8 @@ static void ena_dump_stats_ex(struct ena_adapter *adapter, u8 *buf)
                return;
        }
 
-       strings_buf = devm_kzalloc(&adapter->pdev->dev,
-                                  strings_num * ETH_GSTRING_LEN,
+       strings_buf = devm_kcalloc(&adapter->pdev->dev,
+                                  ETH_GSTRING_LEN, strings_num,
                                   GFP_ATOMIC);
        if (!strings_buf) {
                netif_err(adapter, drv, netdev,
@@ -847,8 +847,8 @@ static void ena_dump_stats_ex(struct ena_adapter *adapter, u8 *buf)
                return;
        }
 
-       data_buf = devm_kzalloc(&adapter->pdev->dev,
-                               strings_num * sizeof(u64),
+       data_buf = devm_kcalloc(&adapter->pdev->dev,
+                               strings_num, sizeof(u64),
                                GFP_ATOMIC);
        if (!data_buf) {
                netif_err(adapter, drv, netdev,
index 00a57273b753660f07abff48b6fc49e775710b07..60da0499ad66c4db3b6b830259c3d9dbdecc7884 100644 (file)
@@ -1141,7 +1141,8 @@ static int ethoc_probe(struct platform_device *pdev)
        dev_dbg(&pdev->dev, "ethoc: num_tx: %d num_rx: %d\n",
                priv->num_tx, priv->num_rx);
 
-       priv->vma = devm_kzalloc(&pdev->dev, num_bd*sizeof(void *), GFP_KERNEL);
+       priv->vma = devm_kcalloc(&pdev->dev, num_bd, sizeof(void *),
+                                GFP_KERNEL);
        if (!priv->vma) {
                ret = -ENOMEM;
                goto free;
index fd43f98ddbe74bedec6c53c3467e622b7480acc8..5f4e1ffa7b95fe4f8d2bb6447764951c51fffc67 100644 (file)
@@ -664,7 +664,7 @@ static struct dpaa_fq *dpaa_fq_alloc(struct device *dev,
        struct dpaa_fq *dpaa_fq;
        int i;
 
-       dpaa_fq = devm_kzalloc(dev, sizeof(*dpaa_fq) * count,
+       dpaa_fq = devm_kcalloc(dev, count, sizeof(*dpaa_fq),
                               GFP_KERNEL);
        if (!dpaa_fq)
                return NULL;
index f2b31d278bc9b9bb45080e6a044d304472f86e81..25a73bb2e642dde42ae59f10369e7d3fefcb53f7 100644 (file)
@@ -2846,8 +2846,10 @@ static int hns3_get_ring_config(struct hns3_nic_priv *priv)
        struct pci_dev *pdev = h->pdev;
        int i, ret;
 
-       priv->ring_data =  devm_kzalloc(&pdev->dev, h->kinfo.num_tqps *
-                                       sizeof(*priv->ring_data) * 2,
+       priv->ring_data =  devm_kzalloc(&pdev->dev,
+                                       array3_size(h->kinfo.num_tqps,
+                                                   sizeof(*priv->ring_data),
+                                                   2),
                                        GFP_KERNEL);
        if (!priv->ring_data)
                return -ENOMEM;
index b092894dd1287bc7fe00a438ecdd7041f2bed2fe..09f674ec0f9e061930d96d1c772641e89ad3c651 100644 (file)
@@ -247,9 +247,8 @@ static int nixge_hw_dma_bd_init(struct net_device *ndev)
        if (!priv->tx_bd_v)
                goto out;
 
-       priv->tx_skb = devm_kzalloc(ndev->dev.parent,
-                                   sizeof(*priv->tx_skb) *
-                                   TX_BD_NUM,
+       priv->tx_skb = devm_kcalloc(ndev->dev.parent,
+                                   TX_BD_NUM, sizeof(*priv->tx_skb),
                                    GFP_KERNEL);
        if (!priv->tx_skb)
                goto out;
index 881c94b73e2ff387a3f7ce5e5c3aebf3006ac102..2258cd8cc84413f22c19a9339a3b6193427c464e 100644 (file)
@@ -277,8 +277,8 @@ static int tc_init(struct stmmac_priv *priv)
 
        /* Reserve one last filter which lets all pass */
        priv->tc_entries_max = count;
-       priv->tc_entries = devm_kzalloc(priv->device,
-                       sizeof(*priv->tc_entries) * count, GFP_KERNEL);
+       priv->tc_entries = devm_kcalloc(priv->device,
+                       count, sizeof(*priv->tc_entries), GFP_KERNEL);
        if (!priv->tc_entries)
                return -ENOMEM;
 
index 534596ce00d3ee9f63e08c38c27ae5e52357e679..358edab9e72eeee18b9c17d74e66f2de92d5cc87 100644 (file)
@@ -2740,8 +2740,9 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
        }
        data->active_slave = prop;
 
-       data->slave_data = devm_kzalloc(&pdev->dev, data->slaves
-                                       * sizeof(struct cpsw_slave_data),
+       data->slave_data = devm_kcalloc(&pdev->dev,
+                                       data->slaves,
+                                       sizeof(struct cpsw_slave_data),
                                        GFP_KERNEL);
        if (!data->slave_data)
                return -ENOMEM;
@@ -3045,8 +3046,8 @@ static int cpsw_probe(struct platform_device *pdev)
 
        memcpy(ndev->dev_addr, priv->mac_addr, ETH_ALEN);
 
-       cpsw->slaves = devm_kzalloc(&pdev->dev,
-                                   sizeof(struct cpsw_slave) * data->slaves,
+       cpsw->slaves = devm_kcalloc(&pdev->dev,
+                                   data->slaves, sizeof(struct cpsw_slave),
                                    GFP_KERNEL);
        if (!cpsw->slaves) {
                ret = -ENOMEM;
index 6e455a27a8de4021b9daf6549bb0222dbb17cfb4..72b98e27c9920b3c4342e0e8a5f3eef8476439f4 100644 (file)
@@ -3285,8 +3285,8 @@ static int set_xgbe_ethss10_priv(struct gbe_priv *gbe_dev,
        gbe_dev->et_stats = xgbe10_et_stats;
        gbe_dev->num_et_stats = ARRAY_SIZE(xgbe10_et_stats);
 
-       gbe_dev->hw_stats = devm_kzalloc(gbe_dev->dev,
-                                        gbe_dev->num_et_stats * sizeof(u64),
+       gbe_dev->hw_stats = devm_kcalloc(gbe_dev->dev,
+                                        gbe_dev->num_et_stats, sizeof(u64),
                                         GFP_KERNEL);
        if (!gbe_dev->hw_stats) {
                dev_err(gbe_dev->dev, "hw_stats memory allocation failed\n");
@@ -3294,8 +3294,8 @@ static int set_xgbe_ethss10_priv(struct gbe_priv *gbe_dev,
        }
 
        gbe_dev->hw_stats_prev =
-               devm_kzalloc(gbe_dev->dev,
-                            gbe_dev->num_et_stats * sizeof(u32),
+               devm_kcalloc(gbe_dev->dev,
+                            gbe_dev->num_et_stats, sizeof(u32),
                             GFP_KERNEL);
        if (!gbe_dev->hw_stats_prev) {
                dev_err(gbe_dev->dev,
@@ -3405,8 +3405,8 @@ static int set_gbe_ethss14_priv(struct gbe_priv *gbe_dev,
        gbe_dev->et_stats = gbe13_et_stats;
        gbe_dev->num_et_stats = ARRAY_SIZE(gbe13_et_stats);
 
-       gbe_dev->hw_stats = devm_kzalloc(gbe_dev->dev,
-                                        gbe_dev->num_et_stats * sizeof(u64),
+       gbe_dev->hw_stats = devm_kcalloc(gbe_dev->dev,
+                                        gbe_dev->num_et_stats, sizeof(u64),
                                         GFP_KERNEL);
        if (!gbe_dev->hw_stats) {
                dev_err(gbe_dev->dev, "hw_stats memory allocation failed\n");
@@ -3414,8 +3414,8 @@ static int set_gbe_ethss14_priv(struct gbe_priv *gbe_dev,
        }
 
        gbe_dev->hw_stats_prev =
-               devm_kzalloc(gbe_dev->dev,
-                            gbe_dev->num_et_stats * sizeof(u32),
+               devm_kcalloc(gbe_dev->dev,
+                            gbe_dev->num_et_stats, sizeof(u32),
                             GFP_KERNEL);
        if (!gbe_dev->hw_stats_prev) {
                dev_err(gbe_dev->dev,
@@ -3477,8 +3477,8 @@ static int set_gbenu_ethss_priv(struct gbe_priv *gbe_dev,
                gbe_dev->num_et_stats = GBENU_ET_STATS_HOST_SIZE +
                                        GBENU_ET_STATS_PORT_SIZE;
 
-       gbe_dev->hw_stats = devm_kzalloc(gbe_dev->dev,
-                                        gbe_dev->num_et_stats * sizeof(u64),
+       gbe_dev->hw_stats = devm_kcalloc(gbe_dev->dev,
+                                        gbe_dev->num_et_stats, sizeof(u64),
                                         GFP_KERNEL);
        if (!gbe_dev->hw_stats) {
                dev_err(gbe_dev->dev, "hw_stats memory allocation failed\n");
@@ -3486,8 +3486,8 @@ static int set_gbenu_ethss_priv(struct gbe_priv *gbe_dev,
        }
 
        gbe_dev->hw_stats_prev =
-               devm_kzalloc(gbe_dev->dev,
-                            gbe_dev->num_et_stats * sizeof(u32),
+               devm_kcalloc(gbe_dev->dev,
+                            gbe_dev->num_et_stats, sizeof(u32),
                             GFP_KERNEL);
        if (!gbe_dev->hw_stats_prev) {
                dev_err(gbe_dev->dev,
index 39ecad25b20128bbcebf69d5baa7b37223ba3432..491efc1bf5c4894a3c3a8b8d67d236f68205efa4 100644 (file)
@@ -128,9 +128,9 @@ int phy_led_triggers_register(struct phy_device *phy)
        if (err)
                goto out_free_link;
 
-       phy->phy_led_triggers = devm_kzalloc(&phy->mdio.dev,
-                                           sizeof(struct phy_led_trigger) *
-                                                  phy->phy_num_led_triggers,
+       phy->phy_led_triggers = devm_kcalloc(&phy->mdio.dev,
+                                           phy->phy_num_led_triggers,
+                                           sizeof(struct phy_led_trigger),
                                            GFP_KERNEL);
        if (!phy->phy_led_triggers) {
                err = -ENOMEM;
index fcd079a967823928533452249249de7e0e7e6f91..d62e34e7eadfe9dfce468dad87bf630c4d82c3f3 100644 (file)
@@ -181,7 +181,7 @@ mt76_init_sband(struct mt76_dev *dev, struct mt76_sband *msband,
        if (!chanlist)
                return -ENOMEM;
 
-       msband->chan = devm_kzalloc(dev->dev, n_chan * sizeof(*msband->chan),
+       msband->chan = devm_kcalloc(dev->dev, n_chan, sizeof(*msband->chan),
                                    GFP_KERNEL);
        if (!msband->chan)
                return -ENOMEM;
index 3d8283e450a910e6e3fa0d3612c98b7f1529abd7..e3fe4124e3afd427a674cddd3f2f3e0b3cf96c3f 100644 (file)
@@ -467,7 +467,8 @@ static int cdns_pcie_ep_probe(struct platform_device *pdev)
                dev_err(dev, "missing \"cdns,max-outbound-regions\"\n");
                return ret;
        }
-       ep->ob_addr = devm_kzalloc(dev, ep->max_regions * sizeof(*ep->ob_addr),
+       ep->ob_addr = devm_kcalloc(dev,
+                                  ep->max_regions, sizeof(*ep->ob_addr),
                                   GFP_KERNEL);
        if (!ep->ob_addr)
                return -ENOMEM;
index f688204e50c5f5e7862e75b9e264a650856eb483..2810c6ab619977fb4579ec7d654fa096ac3f6a7d 100644 (file)
@@ -639,11 +639,11 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev)
                return phy_count;
        }
 
-       phy = devm_kzalloc(dev, sizeof(*phy) * phy_count, GFP_KERNEL);
+       phy = devm_kcalloc(dev, phy_count, sizeof(*phy), GFP_KERNEL);
        if (!phy)
                return -ENOMEM;
 
-       link = devm_kzalloc(dev, sizeof(*link) * phy_count, GFP_KERNEL);
+       link = devm_kcalloc(dev, phy_count, sizeof(*link), GFP_KERNEL);
        if (!link)
                return -ENOMEM;
 
index 1eec4415a77f05fe1ebfd7593815fee553d85ae6..8650416f6f9e46df6c722be7ae780da0916218d5 100644 (file)
@@ -366,19 +366,21 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep)
                return -EINVAL;
        }
 
-       ep->ib_window_map = devm_kzalloc(dev, sizeof(long) *
+       ep->ib_window_map = devm_kcalloc(dev,
                                         BITS_TO_LONGS(ep->num_ib_windows),
+                                        sizeof(long),
                                         GFP_KERNEL);
        if (!ep->ib_window_map)
                return -ENOMEM;
 
-       ep->ob_window_map = devm_kzalloc(dev, sizeof(long) *
+       ep->ob_window_map = devm_kcalloc(dev,
                                         BITS_TO_LONGS(ep->num_ob_windows),
+                                        sizeof(long),
                                         GFP_KERNEL);
        if (!ep->ob_window_map)
                return -ENOMEM;
 
-       addr = devm_kzalloc(dev, sizeof(phys_addr_t) * ep->num_ob_windows,
+       addr = devm_kcalloc(dev, ep->num_ob_windows, sizeof(phys_addr_t),
                            GFP_KERNEL);
        if (!addr)
                return -ENOMEM;
index fc267a49a932e4c5e935b549552a4c1400032194..6beba8ed7b84b2f4d450a0f0cee19abb88f9c83b 100644 (file)
@@ -593,7 +593,7 @@ static int rockchip_pcie_ep_probe(struct platform_device *pdev)
                            PCIE_CLIENT_CONFIG);
 
        max_regions = ep->max_regions;
-       ep->ob_addr = devm_kzalloc(dev, max_regions * sizeof(*ep->ob_addr),
+       ep->ob_addr = devm_kcalloc(dev, max_regions, sizeof(*ep->ob_addr),
                                   GFP_KERNEL);
 
        if (!ep->ob_addr) {
index a620a8e8fa7877a62d7a258eb2732d9dbcf56266..d6d183e9db17c7cce99f1fae4a5f3f330620d012 100644 (file)
@@ -216,8 +216,9 @@ static int berlin_pinctrl_build_state(struct platform_device *pdev)
        }
 
        /* we will reallocate later */
-       pctrl->functions = devm_kzalloc(&pdev->dev,
-                                       max_functions * sizeof(*pctrl->functions),
+       pctrl->functions = devm_kcalloc(&pdev->dev,
+                                       max_functions,
+                                       sizeof(*pctrl->functions),
                                        GFP_KERNEL);
        if (!pctrl->functions)
                return -ENOMEM;
@@ -261,8 +262,9 @@ static int berlin_pinctrl_build_state(struct platform_device *pdev)
 
                        if (!function->groups) {
                                function->groups =
-                                       devm_kzalloc(&pdev->dev,
-                                                    function->ngroups * sizeof(char *),
+                                       devm_kcalloc(&pdev->dev,
+                                                    function->ngroups,
+                                                    sizeof(char *),
                                                     GFP_KERNEL);
 
                                if (!function->groups)
index 28e5b7f620443dd8d55aa04b90c535bee6f7aa14..1c6bb15579e1e5d82a715cb9edea2aeea21384be 100644 (file)
@@ -477,10 +477,12 @@ static int imx_pinctrl_parse_groups(struct device_node *np,
        config = imx_pinconf_parse_generic_config(np, ipctl);
 
        grp->num_pins = size / pin_size;
-       grp->data = devm_kzalloc(ipctl->dev, grp->num_pins *
-                                sizeof(struct imx_pin), GFP_KERNEL);
-       grp->pins = devm_kzalloc(ipctl->dev, grp->num_pins *
-                                sizeof(unsigned int), GFP_KERNEL);
+       grp->data = devm_kcalloc(ipctl->dev,
+                                grp->num_pins, sizeof(struct imx_pin),
+                                GFP_KERNEL);
+       grp->pins = devm_kcalloc(ipctl->dev,
+                                grp->num_pins, sizeof(unsigned int),
+                                GFP_KERNEL);
        if (!grp->pins || !grp->data)
                return -ENOMEM;
 
index e7169ac7799f48ebfe3c39927041bb783d7e0b6b..c3bdd90b14223d0b17c39a9c821c85bdc8db5378 100644 (file)
@@ -483,10 +483,10 @@ static int imx1_pinctrl_parse_groups(struct device_node *np,
        }
 
        grp->npins = size / 12;
-       grp->pins = devm_kzalloc(info->dev,
-                       grp->npins * sizeof(struct imx1_pin), GFP_KERNEL);
-       grp->pin_ids = devm_kzalloc(info->dev,
-                       grp->npins * sizeof(unsigned int), GFP_KERNEL);
+       grp->pins = devm_kcalloc(info->dev,
+                       grp->npins, sizeof(struct imx1_pin), GFP_KERNEL);
+       grp->pin_ids = devm_kcalloc(info->dev,
+                       grp->npins, sizeof(unsigned int), GFP_KERNEL);
 
        if (!grp->pins || !grp->pin_ids)
                return -ENOMEM;
@@ -523,8 +523,8 @@ static int imx1_pinctrl_parse_functions(struct device_node *np,
        if (func->num_groups == 0)
                return -EINVAL;
 
-       func->groups = devm_kzalloc(info->dev,
-                       func->num_groups * sizeof(char *), GFP_KERNEL);
+       func->groups = devm_kcalloc(info->dev,
+                       func->num_groups, sizeof(char *), GFP_KERNEL);
 
        if (!func->groups)
                return -ENOMEM;
@@ -566,12 +566,12 @@ static int imx1_pinctrl_parse_dt(struct platform_device *pdev,
        }
 
        info->nfunctions = nfuncs;
-       info->functions = devm_kzalloc(&pdev->dev,
-                       nfuncs * sizeof(struct imx1_pmx_func), GFP_KERNEL);
+       info->functions = devm_kcalloc(&pdev->dev,
+                       nfuncs, sizeof(struct imx1_pmx_func), GFP_KERNEL);
 
        info->ngroups = ngroups;
-       info->groups = devm_kzalloc(&pdev->dev,
-                       ngroups * sizeof(struct imx1_pin_group), GFP_KERNEL);
+       info->groups = devm_kcalloc(&pdev->dev,
+                       ngroups, sizeof(struct imx1_pin_group), GFP_KERNEL);
 
 
        if (!info->functions || !info->groups)
index 3a17846aa31f512b140d322f3b1d10952405e413..a612e46ca51c07d6e07399d0217a8ae3395c90f1 100644 (file)
@@ -370,12 +370,12 @@ static int mxs_pinctrl_parse_group(struct platform_device *pdev,
                return -EINVAL;
        g->npins = length / sizeof(u32);
 
-       g->pins = devm_kzalloc(&pdev->dev, g->npins * sizeof(*g->pins),
+       g->pins = devm_kcalloc(&pdev->dev, g->npins, sizeof(*g->pins),
                               GFP_KERNEL);
        if (!g->pins)
                return -ENOMEM;
 
-       g->muxsel = devm_kzalloc(&pdev->dev, g->npins * sizeof(*g->muxsel),
+       g->muxsel = devm_kcalloc(&pdev->dev, g->npins, sizeof(*g->muxsel),
                                 GFP_KERNEL);
        if (!g->muxsel)
                return -ENOMEM;
@@ -426,13 +426,16 @@ static int mxs_pinctrl_probe_dt(struct platform_device *pdev,
                }
        }
 
-       soc->functions = devm_kzalloc(&pdev->dev, soc->nfunctions *
-                                     sizeof(*soc->functions), GFP_KERNEL);
+       soc->functions = devm_kcalloc(&pdev->dev,
+                                     soc->nfunctions,
+                                     sizeof(*soc->functions),
+                                     GFP_KERNEL);
        if (!soc->functions)
                return -ENOMEM;
 
-       soc->groups = devm_kzalloc(&pdev->dev, soc->ngroups *
-                                  sizeof(*soc->groups), GFP_KERNEL);
+       soc->groups = devm_kcalloc(&pdev->dev,
+                                  soc->ngroups, sizeof(*soc->groups),
+                                  GFP_KERNEL);
        if (!soc->groups)
                return -ENOMEM;
 
@@ -492,7 +495,8 @@ static int mxs_pinctrl_probe_dt(struct platform_device *pdev,
 
                if (strcmp(fn, child->name)) {
                        f = &soc->functions[idxf++];
-                       f->groups = devm_kzalloc(&pdev->dev, f->ngroups *
+                       f->groups = devm_kcalloc(&pdev->dev,
+                                                f->ngroups,
                                                 sizeof(*f->groups),
                                                 GFP_KERNEL);
                        if (!f->groups)
index 674ffdf8103c3f3a875621f55f192576cc72ccfa..53cf800688e947ff4720273e64dad39b3d6b8133 100644 (file)
@@ -856,9 +856,10 @@ static int armada_37xx_fill_group(struct armada_37xx_pinctrl *info)
                struct armada_37xx_pin_group *grp = &info->groups[n];
                int i, j, f;
 
-               grp->pins = devm_kzalloc(info->dev,
-                                        (grp->npins + grp->extra_npins) *
-                                        sizeof(*grp->pins), GFP_KERNEL);
+               grp->pins = devm_kcalloc(info->dev,
+                                        grp->npins + grp->extra_npins,
+                                        sizeof(*grp->pins),
+                                        GFP_KERNEL);
                if (!grp->pins)
                        return -ENOMEM;
 
@@ -908,7 +909,8 @@ static int armada_37xx_fill_func(struct armada_37xx_pinctrl *info)
                const char **groups;
                int g;
 
-               funcs[n].groups = devm_kzalloc(info->dev, funcs[n].ngroups *
+               funcs[n].groups = devm_kcalloc(info->dev,
+                                              funcs[n].ngroups,
                                               sizeof(*(funcs[n].groups)),
                                               GFP_KERNEL);
                if (!funcs[n].groups)
@@ -948,8 +950,9 @@ static int armada_37xx_pinctrl_register(struct platform_device *pdev,
        ctrldesc->pmxops = &armada_37xx_pmx_ops;
        ctrldesc->confops = &armada_37xx_pinconf_ops;
 
-       pindesc = devm_kzalloc(&pdev->dev, sizeof(*pindesc) *
-                              pin_data->nr_pins, GFP_KERNEL);
+       pindesc = devm_kcalloc(&pdev->dev,
+                              pin_data->nr_pins, sizeof(*pindesc),
+                              GFP_KERNEL);
        if (!pindesc)
                return -ENOMEM;
 
@@ -968,8 +971,10 @@ static int armada_37xx_pinctrl_register(struct platform_device *pdev,
         * we allocate functions for number of pins and hope there are
         * fewer unique functions than pins available
         */
-       info->funcs = devm_kzalloc(&pdev->dev, pin_data->nr_pins *
-                          sizeof(struct armada_37xx_pmx_func), GFP_KERNEL);
+       info->funcs = devm_kcalloc(&pdev->dev,
+                                  pin_data->nr_pins,
+                                  sizeof(struct armada_37xx_pmx_func),
+                                  GFP_KERNEL);
        if (!info->funcs)
                return -ENOMEM;
 
index 9e05cfaf75f020d60595bf8ee0172170bd81bf56..d7ec7119701b4e220f42681b3fdb5df5122ef59f 100644 (file)
@@ -501,8 +501,9 @@ static int mvebu_pinctrl_build_functions(struct platform_device *pdev,
 
        /* we allocate functions for number of pins and hope
         * there are fewer unique functions than pins available */
-       funcs = devm_kzalloc(&pdev->dev, funcsize *
-                            sizeof(struct mvebu_pinctrl_function), GFP_KERNEL);
+       funcs = devm_kcalloc(&pdev->dev,
+                            funcsize, sizeof(struct mvebu_pinctrl_function),
+                            GFP_KERNEL);
        if (!funcs)
                return -ENOMEM;
 
@@ -549,8 +550,9 @@ static int mvebu_pinctrl_build_functions(struct platform_device *pdev,
 
                        /* allocate group name array if not done already */
                        if (!f->groups) {
-                               f->groups = devm_kzalloc(&pdev->dev,
-                                                f->num_groups * sizeof(char *),
+                               f->groups = devm_kcalloc(&pdev->dev,
+                                                f->num_groups,
+                                                sizeof(char *),
                                                 GFP_KERNEL);
                                if (!f->groups)
                                        return -ENOMEM;
@@ -622,8 +624,10 @@ int mvebu_pinctrl_probe(struct platform_device *pdev)
                }
        }
 
-       pdesc = devm_kzalloc(&pdev->dev, pctl->desc.npins *
-                            sizeof(struct pinctrl_pin_desc), GFP_KERNEL);
+       pdesc = devm_kcalloc(&pdev->dev,
+                            pctl->desc.npins,
+                            sizeof(struct pinctrl_pin_desc),
+                            GFP_KERNEL);
        if (!pdesc)
                return -ENOMEM;
 
index bafb3d40545e4fd5ddf26d8010601e916603097c..67e4d9ffa6b1f4e4825d59ea81e736fb59af6192 100644 (file)
@@ -945,27 +945,30 @@ static int atmel_pinctrl_probe(struct platform_device *pdev)
                return PTR_ERR(atmel_pioctrl->clk);
        }
 
-       atmel_pioctrl->pins = devm_kzalloc(dev, sizeof(*atmel_pioctrl->pins)
-                       * atmel_pioctrl->npins, GFP_KERNEL);
+       atmel_pioctrl->pins = devm_kcalloc(dev,
+                                          atmel_pioctrl->npins,
+                                          sizeof(*atmel_pioctrl->pins),
+                                          GFP_KERNEL);
        if (!atmel_pioctrl->pins)
                return -ENOMEM;
 
-       pin_desc = devm_kzalloc(dev, sizeof(*pin_desc)
-                       * atmel_pioctrl->npins, GFP_KERNEL);
+       pin_desc = devm_kcalloc(dev, atmel_pioctrl->npins, sizeof(*pin_desc),
+                               GFP_KERNEL);
        if (!pin_desc)
                return -ENOMEM;
        atmel_pinctrl_desc.pins = pin_desc;
        atmel_pinctrl_desc.npins = atmel_pioctrl->npins;
 
        /* One pin is one group since a pin can achieve all functions. */
-       group_names = devm_kzalloc(dev, sizeof(*group_names)
-                       * atmel_pioctrl->npins, GFP_KERNEL);
+       group_names = devm_kcalloc(dev,
+                                  atmel_pioctrl->npins, sizeof(*group_names),
+                                  GFP_KERNEL);
        if (!group_names)
                return -ENOMEM;
        atmel_pioctrl->group_names = group_names;
 
-       atmel_pioctrl->groups = devm_kzalloc(&pdev->dev,
-                       sizeof(*atmel_pioctrl->groups) * atmel_pioctrl->npins,
+       atmel_pioctrl->groups = devm_kcalloc(&pdev->dev,
+                       atmel_pioctrl->npins, sizeof(*atmel_pioctrl->groups),
                        GFP_KERNEL);
        if (!atmel_pioctrl->groups)
                return -ENOMEM;
@@ -1001,20 +1004,24 @@ static int atmel_pinctrl_probe(struct platform_device *pdev)
        atmel_pioctrl->gpio_chip->parent = dev;
        atmel_pioctrl->gpio_chip->names = atmel_pioctrl->group_names;
 
-       atmel_pioctrl->pm_wakeup_sources = devm_kzalloc(dev,
-                       sizeof(*atmel_pioctrl->pm_wakeup_sources)
-                       * atmel_pioctrl->nbanks, GFP_KERNEL);
+       atmel_pioctrl->pm_wakeup_sources = devm_kcalloc(dev,
+                       atmel_pioctrl->nbanks,
+                       sizeof(*atmel_pioctrl->pm_wakeup_sources),
+                       GFP_KERNEL);
        if (!atmel_pioctrl->pm_wakeup_sources)
                return -ENOMEM;
 
-       atmel_pioctrl->pm_suspend_backup = devm_kzalloc(dev,
-                       sizeof(*atmel_pioctrl->pm_suspend_backup)
-                       * atmel_pioctrl->nbanks, GFP_KERNEL);
+       atmel_pioctrl->pm_suspend_backup = devm_kcalloc(dev,
+                       atmel_pioctrl->nbanks,
+                       sizeof(*atmel_pioctrl->pm_suspend_backup),
+                       GFP_KERNEL);
        if (!atmel_pioctrl->pm_suspend_backup)
                return -ENOMEM;
 
-       atmel_pioctrl->irqs = devm_kzalloc(dev, sizeof(*atmel_pioctrl->irqs)
-                       * atmel_pioctrl->nbanks, GFP_KERNEL);
+       atmel_pioctrl->irqs = devm_kcalloc(dev,
+                                          atmel_pioctrl->nbanks,
+                                          sizeof(*atmel_pioctrl->irqs),
+                                          GFP_KERNEL);
        if (!atmel_pioctrl->irqs)
                return -ENOMEM;
 
index 297f1d161211cc0bfce732fdf4aa87c5ada21a1c..50f0ec42c63723528576b4498df84fa147428250 100644 (file)
@@ -269,7 +269,8 @@ static int at91_dt_node_to_map(struct pinctrl_dev *pctldev,
        }
 
        map_num += grp->npins;
-       new_map = devm_kzalloc(pctldev->dev, sizeof(*new_map) * map_num, GFP_KERNEL);
+       new_map = devm_kcalloc(pctldev->dev, map_num, sizeof(*new_map),
+                              GFP_KERNEL);
        if (!new_map)
                return -ENOMEM;
 
@@ -1049,7 +1050,8 @@ static int at91_pinctrl_mux_mask(struct at91_pinctrl *info,
        }
        info->nmux = size / gpio_banks;
 
-       info->mux_mask = devm_kzalloc(info->dev, sizeof(u32) * size, GFP_KERNEL);
+       info->mux_mask = devm_kcalloc(info->dev, size, sizeof(u32),
+                                     GFP_KERNEL);
        if (!info->mux_mask)
                return -ENOMEM;
 
@@ -1087,10 +1089,12 @@ static int at91_pinctrl_parse_groups(struct device_node *np,
        }
 
        grp->npins = size / 4;
-       pin = grp->pins_conf = devm_kzalloc(info->dev, grp->npins * sizeof(struct at91_pmx_pin),
-                               GFP_KERNEL);
-       grp->pins = devm_kzalloc(info->dev, grp->npins * sizeof(unsigned int),
-                               GFP_KERNEL);
+       pin = grp->pins_conf = devm_kcalloc(info->dev,
+                                           grp->npins,
+                                           sizeof(struct at91_pmx_pin),
+                                           GFP_KERNEL);
+       grp->pins = devm_kcalloc(info->dev, grp->npins, sizeof(unsigned int),
+                                GFP_KERNEL);
        if (!grp->pins_conf || !grp->pins)
                return -ENOMEM;
 
@@ -1129,8 +1133,8 @@ static int at91_pinctrl_parse_functions(struct device_node *np,
                dev_err(info->dev, "no groups defined\n");
                return -EINVAL;
        }
-       func->groups = devm_kzalloc(info->dev,
-                       func->ngroups * sizeof(char *), GFP_KERNEL);
+       func->groups = devm_kcalloc(info->dev,
+                       func->ngroups, sizeof(char *), GFP_KERNEL);
        if (!func->groups)
                return -ENOMEM;
 
@@ -1192,12 +1196,16 @@ static int at91_pinctrl_probe_dt(struct platform_device *pdev,
 
        dev_dbg(&pdev->dev, "nfunctions = %d\n", info->nfunctions);
        dev_dbg(&pdev->dev, "ngroups = %d\n", info->ngroups);
-       info->functions = devm_kzalloc(&pdev->dev, info->nfunctions * sizeof(struct at91_pmx_func),
+       info->functions = devm_kcalloc(&pdev->dev,
+                                       info->nfunctions,
+                                       sizeof(struct at91_pmx_func),
                                        GFP_KERNEL);
        if (!info->functions)
                return -ENOMEM;
 
-       info->groups = devm_kzalloc(&pdev->dev, info->ngroups * sizeof(struct at91_pin_group),
+       info->groups = devm_kcalloc(&pdev->dev,
+                                       info->ngroups,
+                                       sizeof(struct at91_pin_group),
                                        GFP_KERNEL);
        if (!info->groups)
                return -ENOMEM;
@@ -1256,7 +1264,9 @@ static int at91_pinctrl_probe(struct platform_device *pdev)
        at91_pinctrl_desc.name = dev_name(&pdev->dev);
        at91_pinctrl_desc.npins = gpio_banks * MAX_NB_GPIO_PER_BANK;
        at91_pinctrl_desc.pins = pdesc =
-               devm_kzalloc(&pdev->dev, sizeof(*pdesc) * at91_pinctrl_desc.npins, GFP_KERNEL);
+               devm_kcalloc(&pdev->dev,
+                            at91_pinctrl_desc.npins, sizeof(*pdesc),
+                            GFP_KERNEL);
 
        if (!at91_pinctrl_desc.pins)
                return -ENOMEM;
@@ -1763,7 +1773,7 @@ static int at91_gpio_probe(struct platform_device *pdev)
                        chip->ngpio = ngpio;
        }
 
-       names = devm_kzalloc(&pdev->dev, sizeof(char *) * chip->ngpio,
+       names = devm_kcalloc(&pdev->dev, chip->ngpio, sizeof(char *),
                             GFP_KERNEL);
 
        if (!names) {
index 1231bbbfa74472d8c18de5bc310016ad64de0afe..a52779f33ad4a466978132bb0e6906188cc4b8bd 100644 (file)
@@ -328,7 +328,8 @@ static void axp20x_funcs_groups_from_mask(struct device *dev, unsigned int mask,
 
        func->ngroups = ngroups;
        if (func->ngroups > 0) {
-               func->groups = devm_kzalloc(dev, ngroups * sizeof(const char *),
+               func->groups = devm_kcalloc(dev,
+                                           ngroups, sizeof(const char *),
                                            GFP_KERNEL);
                group = func->groups;
                for_each_set_bit(bit, &mask_cpy, mask_len) {
@@ -358,8 +359,8 @@ static void axp20x_build_funcs_groups(struct platform_device *pdev)
        /* Every pin supports GPIO_OUT and GPIO_IN functions */
        for (i = 0; i <= AXP20X_FUNC_GPIO_IN; i++) {
                pctl->funcs[i].ngroups = npins;
-               pctl->funcs[i].groups = devm_kzalloc(&pdev->dev,
-                                                    npins * sizeof(char *),
+               pctl->funcs[i].groups = devm_kcalloc(&pdev->dev,
+                                                    npins, sizeof(char *),
                                                     GFP_KERNEL);
                for (pin = 0; pin < npins; pin++)
                        pctl->funcs[i].groups[pin] = pctl->desc->pins[pin].name;
index ce269ced4d49b489e767a4c6562bc193b651f86a..5353b23f775c9885709fe1faeeff47e210cb215a 100644 (file)
@@ -291,10 +291,11 @@ static int dc_pinctrl_probe(struct platform_device *pdev)
        if (IS_ERR(pmap->regs))
                return PTR_ERR(pmap->regs);
 
-       pins = devm_kzalloc(&pdev->dev, sizeof(*pins)*PINS_COUNT, GFP_KERNEL);
+       pins = devm_kcalloc(&pdev->dev, PINS_COUNT, sizeof(*pins),
+                           GFP_KERNEL);
        if (!pins)
                return -ENOMEM;
-       pin_names = devm_kzalloc(&pdev->dev, name_len * PINS_COUNT,
+       pin_names = devm_kcalloc(&pdev->dev, PINS_COUNT, name_len,
                                 GFP_KERNEL);
        if (!pin_names)
                return -ENOMEM;
index ac38a3f9f86bf6aab07cfb66d4f5a1f4e65b4b1f..a1d7156d0a43ad49ac6312ab67b67a7312ad9e10 100644 (file)
@@ -770,8 +770,8 @@ static int ingenic_pinctrl_probe(struct platform_device *pdev)
        pctl_desc->pmxops = &ingenic_pmxops;
        pctl_desc->confops = &ingenic_confops;
        pctl_desc->npins = chip_info->num_chips * PINS_PER_GPIO_CHIP;
-       pctl_desc->pins = jzpc->pdesc = devm_kzalloc(&pdev->dev,
-                       sizeof(*jzpc->pdesc) * pctl_desc->npins, GFP_KERNEL);
+       pctl_desc->pins = jzpc->pdesc = devm_kcalloc(&pdev->dev,
+                       pctl_desc->npins, sizeof(*jzpc->pdesc), GFP_KERNEL);
        if (!jzpc->pdesc)
                return -ENOMEM;
 
index d090f37ca4a114683d69e203532b20dc653c1d35..190f17e4bbdafd287b9dd8d9cdeee4011f80c6c5 100644 (file)
@@ -1308,8 +1308,9 @@ static int lpc18xx_create_group_func_map(struct device *dev,
                }
 
                scu->func[func].ngroups = ngroups;
-               scu->func[func].groups = devm_kzalloc(dev, ngroups *
-                                                     sizeof(char *), GFP_KERNEL);
+               scu->func[func].groups = devm_kcalloc(dev,
+                                                     ngroups, sizeof(char *),
+                                                     GFP_KERNEL);
                if (!scu->func[func].groups)
                        return -ENOMEM;
 
index b5b3547fdcb2bcf33c50cf3ebcb634de48994bb3..15bb1cb8729b936eb73f519286f7d5a88f0e0a3f 100644 (file)
@@ -330,7 +330,8 @@ static int ocelot_create_group_func_map(struct device *dev,
                }
 
                info->func[f].ngroups = npins;
-               info->func[f].groups = devm_kzalloc(dev, npins *
+               info->func[f].groups = devm_kcalloc(dev,
+                                                        npins,
                                                         sizeof(char *),
                                                         GFP_KERNEL);
                if (!info->func[f].groups)
index 1882713e68f932c7074d9d06a2eeaa91c7ad108f..f4a61429e06e7bd28c20a9ff0e54cfbf41cee4fe 100644 (file)
@@ -507,7 +507,7 @@ static int rockchip_dt_node_to_map(struct pinctrl_dev *pctldev,
        }
 
        map_num += grp->npins;
-       new_map = devm_kzalloc(pctldev->dev, sizeof(*new_map) * map_num,
+       new_map = devm_kcalloc(pctldev->dev, map_num, sizeof(*new_map),
                                                                GFP_KERNEL);
        if (!new_map)
                return -ENOMEM;
@@ -2473,10 +2473,11 @@ static int rockchip_pinctrl_parse_groups(struct device_node *np,
 
        grp->npins = size / 4;
 
-       grp->pins = devm_kzalloc(info->dev, grp->npins * sizeof(unsigned int),
+       grp->pins = devm_kcalloc(info->dev, grp->npins, sizeof(unsigned int),
                                                GFP_KERNEL);
-       grp->data = devm_kzalloc(info->dev, grp->npins *
-                                         sizeof(struct rockchip_pin_config),
+       grp->data = devm_kcalloc(info->dev,
+                                       grp->npins,
+                                       sizeof(struct rockchip_pin_config),
                                        GFP_KERNEL);
        if (!grp->pins || !grp->data)
                return -ENOMEM;
@@ -2528,8 +2529,8 @@ static int rockchip_pinctrl_parse_functions(struct device_node *np,
        if (func->ngroups <= 0)
                return 0;
 
-       func->groups = devm_kzalloc(info->dev,
-                       func->ngroups * sizeof(char *), GFP_KERNEL);
+       func->groups = devm_kcalloc(info->dev,
+                       func->ngroups, sizeof(char *), GFP_KERNEL);
        if (!func->groups)
                return -ENOMEM;
 
@@ -2560,13 +2561,15 @@ static int rockchip_pinctrl_parse_dt(struct platform_device *pdev,
        dev_dbg(&pdev->dev, "nfunctions = %d\n", info->nfunctions);
        dev_dbg(&pdev->dev, "ngroups = %d\n", info->ngroups);
 
-       info->functions = devm_kzalloc(dev, info->nfunctions *
+       info->functions = devm_kcalloc(dev,
+                                             info->nfunctions,
                                              sizeof(struct rockchip_pmx_func),
                                              GFP_KERNEL);
        if (!info->functions)
                return -EINVAL;
 
-       info->groups = devm_kzalloc(dev, info->ngroups *
+       info->groups = devm_kcalloc(dev,
+                                           info->ngroups,
                                            sizeof(struct rockchip_pin_group),
                                            GFP_KERNEL);
        if (!info->groups)
@@ -2604,8 +2607,9 @@ static int rockchip_pinctrl_register(struct platform_device *pdev,
        ctrldesc->pmxops = &rockchip_pmx_ops;
        ctrldesc->confops = &rockchip_pinconf_ops;
 
-       pindesc = devm_kzalloc(&pdev->dev, sizeof(*pindesc) *
-                       info->ctrl->nr_pins, GFP_KERNEL);
+       pindesc = devm_kcalloc(&pdev->dev,
+                              info->ctrl->nr_pins, sizeof(*pindesc),
+                              GFP_KERNEL);
        if (!pindesc)
                return -ENOMEM;
 
index 9c3c00515aa0fe20619fa7d2832d28ccee62c0db..b3153c095199d3bed84d7b846432fa3e783c08f0 100644 (file)
@@ -712,8 +712,8 @@ static int pcs_allocate_pin_table(struct pcs_device *pcs)
        }
 
        dev_dbg(pcs->dev, "allocating %i pins\n", nr_pins);
-       pcs->pins.pa = devm_kzalloc(pcs->dev,
-                               sizeof(*pcs->pins.pa) * nr_pins,
+       pcs->pins.pa = devm_kcalloc(pcs->dev,
+                               nr_pins, sizeof(*pcs->pins.pa),
                                GFP_KERNEL);
        if (!pcs->pins.pa)
                return -ENOMEM;
@@ -924,15 +924,15 @@ static int pcs_parse_pinconf(struct pcs_device *pcs, struct device_node *np,
        if (!nconfs)
                return 0;
 
-       func->conf = devm_kzalloc(pcs->dev,
-                                 sizeof(struct pcs_conf_vals) * nconfs,
+       func->conf = devm_kcalloc(pcs->dev,
+                                 nconfs, sizeof(struct pcs_conf_vals),
                                  GFP_KERNEL);
        if (!func->conf)
                return -ENOMEM;
        func->nconfs = nconfs;
        conf = &(func->conf[0]);
        m++;
-       settings = devm_kzalloc(pcs->dev, sizeof(unsigned long) * nconfs,
+       settings = devm_kcalloc(pcs->dev, nconfs, sizeof(unsigned long),
                                GFP_KERNEL);
        if (!settings)
                return -ENOMEM;
@@ -988,11 +988,11 @@ static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs,
                return -EINVAL;
        }
 
-       vals = devm_kzalloc(pcs->dev, sizeof(*vals) * rows, GFP_KERNEL);
+       vals = devm_kcalloc(pcs->dev, rows, sizeof(*vals), GFP_KERNEL);
        if (!vals)
                return -ENOMEM;
 
-       pins = devm_kzalloc(pcs->dev, sizeof(*pins) * rows, GFP_KERNEL);
+       pins = devm_kcalloc(pcs->dev, rows, sizeof(*pins), GFP_KERNEL);
        if (!pins)
                goto free_vals;
 
@@ -1089,13 +1089,15 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs,
 
        npins_in_row = pcs->width / pcs->bits_per_pin;
 
-       vals = devm_kzalloc(pcs->dev, sizeof(*vals) * rows * npins_in_row,
-                       GFP_KERNEL);
+       vals = devm_kzalloc(pcs->dev,
+                           array3_size(rows, npins_in_row, sizeof(*vals)),
+                           GFP_KERNEL);
        if (!vals)
                return -ENOMEM;
 
-       pins = devm_kzalloc(pcs->dev, sizeof(*pins) * rows * npins_in_row,
-                       GFP_KERNEL);
+       pins = devm_kzalloc(pcs->dev,
+                           array3_size(rows, npins_in_row, sizeof(*pins)),
+                           GFP_KERNEL);
        if (!pins)
                goto free_vals;
 
@@ -1217,7 +1219,7 @@ static int pcs_dt_node_to_map(struct pinctrl_dev *pctldev,
        pcs = pinctrl_dev_get_drvdata(pctldev);
 
        /* create 2 maps. One is for pinmux, and the other is for pinconf. */
-       *map = devm_kzalloc(pcs->dev, sizeof(**map) * 2, GFP_KERNEL);
+       *map = devm_kcalloc(pcs->dev, 2, sizeof(**map), GFP_KERNEL);
        if (!*map)
                return -ENOMEM;
 
index 2081c67667a88b3a7927e4c3e4bc7a753787f043..0966bb0bf71fb6dc6618340d51286d914a82a7e4 100644 (file)
@@ -823,8 +823,8 @@ static int st_pctl_dt_node_to_map(struct pinctrl_dev *pctldev,
        }
 
        map_num = grp->npins + 1;
-       new_map = devm_kzalloc(pctldev->dev,
-                               sizeof(*new_map) * map_num, GFP_KERNEL);
+       new_map = devm_kcalloc(pctldev->dev,
+                               map_num, sizeof(*new_map), GFP_KERNEL);
        if (!new_map)
                return -ENOMEM;
 
@@ -1191,9 +1191,9 @@ static int st_pctl_dt_parse_groups(struct device_node *np,
 
        grp->npins = npins;
        grp->name = np->name;
-       grp->pins = devm_kzalloc(info->dev, npins * sizeof(u32), GFP_KERNEL);
-       grp->pin_conf = devm_kzalloc(info->dev,
-                                       npins * sizeof(*conf), GFP_KERNEL);
+       grp->pins = devm_kcalloc(info->dev, npins, sizeof(u32), GFP_KERNEL);
+       grp->pin_conf = devm_kcalloc(info->dev,
+                                       npins, sizeof(*conf), GFP_KERNEL);
 
        if (!grp->pins || !grp->pin_conf)
                return -ENOMEM;
@@ -1249,8 +1249,8 @@ static int st_pctl_parse_functions(struct device_node *np,
                dev_err(info->dev, "No groups defined\n");
                return -EINVAL;
        }
-       func->groups = devm_kzalloc(info->dev,
-                       func->ngroups * sizeof(char *), GFP_KERNEL);
+       func->groups = devm_kcalloc(info->dev,
+                       func->ngroups, sizeof(char *), GFP_KERNEL);
        if (!func->groups)
                return -ENOMEM;
 
@@ -1573,14 +1573,15 @@ static int st_pctl_probe_dt(struct platform_device *pdev,
        dev_info(&pdev->dev, "nfunctions = %d\n", info->nfunctions);
        dev_info(&pdev->dev, "ngroups = %d\n", info->ngroups);
 
-       info->functions = devm_kzalloc(&pdev->dev,
-               info->nfunctions * sizeof(*info->functions), GFP_KERNEL);
+       info->functions = devm_kcalloc(&pdev->dev,
+               info->nfunctions, sizeof(*info->functions), GFP_KERNEL);
 
-       info->groups = devm_kzalloc(&pdev->dev,
-                       info->ngroups * sizeof(*info->groups) , GFP_KERNEL);
+       info->groups = devm_kcalloc(&pdev->dev,
+                       info->ngroups, sizeof(*info->groups),
+                       GFP_KERNEL);
 
-       info->banks = devm_kzalloc(&pdev->dev,
-                       info->nbanks * sizeof(*info->banks), GFP_KERNEL);
+       info->banks = devm_kcalloc(&pdev->dev,
+                       info->nbanks, sizeof(*info->banks), GFP_KERNEL);
 
        if (!info->functions || !info->groups || !info->banks)
                return -ENOMEM;
@@ -1608,8 +1609,8 @@ static int st_pctl_probe_dt(struct platform_device *pdev,
        }
 
        pctl_desc->npins = info->nbanks * ST_GPIO_PINS_PER_BANK;
-       pdesc = devm_kzalloc(&pdev->dev,
-                       sizeof(*pdesc) * pctl_desc->npins, GFP_KERNEL);
+       pdesc = devm_kcalloc(&pdev->dev,
+                       pctl_desc->npins, sizeof(*pdesc), GFP_KERNEL);
        if (!pdesc)
                return -ENOMEM;
 
index cd0f402c116460f8e7edf1d20815f764ce31abab..93f8bd04e7fe69ab92bb48c2715aa24371d315c3 100644 (file)
@@ -1727,8 +1727,8 @@ static int pinmux_xway_probe(struct platform_device *pdev)
        xway_chip.ngpio = xway_soc->pin_count;
 
        /* load our pad descriptors */
-       xway_info.pads = devm_kzalloc(&pdev->dev,
-                       sizeof(struct pinctrl_pin_desc) * xway_chip.ngpio,
+       xway_info.pads = devm_kcalloc(&pdev->dev,
+                       xway_chip.ngpio, sizeof(struct pinctrl_pin_desc),
                        GFP_KERNEL);
        if (!xway_info.pads)
                return -ENOMEM;
index 0a625a64ff5de87baa110a4d7acc3c8e9a5c860d..a263ddd94945d1cc377c5c264390f45494cbfd87 100644 (file)
@@ -491,8 +491,9 @@ int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)
                        continue;
                }
 
-               weint_data = devm_kzalloc(dev, bank->nr_pins
-                                       * sizeof(*weint_data), GFP_KERNEL);
+               weint_data = devm_kcalloc(dev,
+                                         bank->nr_pins, sizeof(*weint_data),
+                                         GFP_KERNEL);
                if (!weint_data)
                        return -ENOMEM;
 
index 618945a0fd3807dee68486f9d8c206c03c068ab2..698c7d8c9a0864e2ad820b5422516a3a5c968462 100644 (file)
@@ -674,7 +674,7 @@ static struct samsung_pin_group *samsung_pinctrl_create_groups(
        const struct pinctrl_pin_desc *pdesc;
        int i;
 
-       groups = devm_kzalloc(dev, ctrldesc->npins * sizeof(*groups),
+       groups = devm_kcalloc(dev, ctrldesc->npins, sizeof(*groups),
                                GFP_KERNEL);
        if (!groups)
                return ERR_PTR(-EINVAL);
@@ -711,7 +711,7 @@ static int samsung_pinctrl_create_function(struct device *dev,
 
        func->name = func_np->full_name;
 
-       func->groups = devm_kzalloc(dev, npins * sizeof(char *), GFP_KERNEL);
+       func->groups = devm_kcalloc(dev, npins, sizeof(char *), GFP_KERNEL);
        if (!func->groups)
                return -ENOMEM;
 
@@ -768,7 +768,7 @@ static struct samsung_pmx_func *samsung_pinctrl_create_functions(
                }
        }
 
-       functions = devm_kzalloc(dev, func_cnt * sizeof(*functions),
+       functions = devm_kcalloc(dev, func_cnt, sizeof(*functions),
                                        GFP_KERNEL);
        if (!functions)
                return ERR_PTR(-ENOMEM);
@@ -860,8 +860,9 @@ static int samsung_pinctrl_register(struct platform_device *pdev,
        ctrldesc->pmxops = &samsung_pinmux_ops;
        ctrldesc->confops = &samsung_pinconf_ops;
 
-       pindesc = devm_kzalloc(&pdev->dev, sizeof(*pindesc) *
-                       drvdata->nr_pins, GFP_KERNEL);
+       pindesc = devm_kcalloc(&pdev->dev,
+                              drvdata->nr_pins, sizeof(*pindesc),
+                              GFP_KERNEL);
        if (!pindesc)
                return -ENOMEM;
        ctrldesc->pins = pindesc;
@@ -875,8 +876,10 @@ static int samsung_pinctrl_register(struct platform_device *pdev,
         * allocate space for storing the dynamically generated names for all
         * the pins which belong to this pin-controller.
         */
-       pin_names = devm_kzalloc(&pdev->dev, sizeof(char) * PIN_NAME_LENGTH *
-                                       drvdata->nr_pins, GFP_KERNEL);
+       pin_names = devm_kzalloc(&pdev->dev,
+                                array3_size(sizeof(char), PIN_NAME_LENGTH,
+                                            drvdata->nr_pins),
+                                GFP_KERNEL);
        if (!pin_names)
                return -ENOMEM;
 
index eb06981538b427d5747c79588228b799b09d7562..c671c3c4aca6c04f907eee096789b44a0a3e3aed 100644 (file)
@@ -57,7 +57,7 @@ static int sh_pfc_map_resources(struct sh_pfc *pfc,
                return -EINVAL;
 
        /* Allocate memory windows and IRQs arrays. */
-       windows = devm_kzalloc(pfc->dev, num_windows * sizeof(*windows),
+       windows = devm_kcalloc(pfc->dev, num_windows, sizeof(*windows),
                               GFP_KERNEL);
        if (windows == NULL)
                return -ENOMEM;
@@ -66,7 +66,7 @@ static int sh_pfc_map_resources(struct sh_pfc *pfc,
        pfc->windows = windows;
 
        if (num_irqs) {
-               irqs = devm_kzalloc(pfc->dev, num_irqs * sizeof(*irqs),
+               irqs = devm_kcalloc(pfc->dev, num_irqs, sizeof(*irqs),
                                    GFP_KERNEL);
                if (irqs == NULL)
                        return -ENOMEM;
@@ -444,7 +444,7 @@ static int sh_pfc_init_ranges(struct sh_pfc *pfc)
        }
 
        pfc->nr_ranges = nr_ranges;
-       pfc->ranges = devm_kzalloc(pfc->dev, sizeof(*pfc->ranges) * nr_ranges,
+       pfc->ranges = devm_kcalloc(pfc->dev, nr_ranges, sizeof(*pfc->ranges),
                                   GFP_KERNEL);
        if (pfc->ranges == NULL)
                return -ENOMEM;
index 946d9be50b62cb329250762780c809805ed79735..6ffdc6beb203c83dbbe0828c3357bfb50db80996 100644 (file)
@@ -107,7 +107,7 @@ static int gpio_setup_data_regs(struct sh_pfc_chip *chip)
        for (i = 0; pfc->info->data_regs[i].reg_width; ++i)
                ;
 
-       chip->regs = devm_kzalloc(pfc->dev, i * sizeof(*chip->regs),
+       chip->regs = devm_kcalloc(pfc->dev, i, sizeof(*chip->regs),
                                  GFP_KERNEL);
        if (chip->regs == NULL)
                return -ENOMEM;
@@ -224,8 +224,9 @@ static int gpio_pin_setup(struct sh_pfc_chip *chip)
        struct gpio_chip *gc = &chip->gpio_chip;
        int ret;
 
-       chip->pins = devm_kzalloc(pfc->dev, pfc->info->nr_pins *
-                                 sizeof(*chip->pins), GFP_KERNEL);
+       chip->pins = devm_kcalloc(pfc->dev,
+                                 pfc->info->nr_pins, sizeof(*chip->pins),
+                                 GFP_KERNEL);
        if (chip->pins == NULL)
                return -ENOMEM;
 
index 70db21638901914ff53da83f1eb90dac222a3c9a..654dc20e171b9363e3e8227a7df55ef775866848 100644 (file)
@@ -770,14 +770,14 @@ static int sh_pfc_map_pins(struct sh_pfc *pfc, struct sh_pfc_pinctrl *pmx)
        unsigned int i;
 
        /* Allocate and initialize the pins and configs arrays. */
-       pmx->pins = devm_kzalloc(pfc->dev,
-                                sizeof(*pmx->pins) * pfc->info->nr_pins,
+       pmx->pins = devm_kcalloc(pfc->dev,
+                                pfc->info->nr_pins, sizeof(*pmx->pins),
                                 GFP_KERNEL);
        if (unlikely(!pmx->pins))
                return -ENOMEM;
 
-       pmx->configs = devm_kzalloc(pfc->dev,
-                                   sizeof(*pmx->configs) * pfc->info->nr_pins,
+       pmx->configs = devm_kcalloc(pfc->dev,
+                                   pfc->info->nr_pins, sizeof(*pmx->configs),
                                    GFP_KERNEL);
        if (unlikely(!pmx->configs))
                return -ENOMEM;
index d2123e396b29c8e7bd8557dc623a496f19faa3d7..9d906474f3e448b30f948c77d91de5e83f48ab3d 100644 (file)
@@ -538,9 +538,9 @@ static int plgpio_probe(struct platform_device *pdev)
                dev_warn(&pdev->dev, "clk_get() failed, work without it\n");
 
 #ifdef CONFIG_PM_SLEEP
-       plgpio->csave_regs = devm_kzalloc(&pdev->dev,
-                       sizeof(*plgpio->csave_regs) *
+       plgpio->csave_regs = devm_kcalloc(&pdev->dev,
                        DIV_ROUND_UP(plgpio->chip.ngpio, MAX_GPIO_PER_REG),
+                       sizeof(*plgpio->csave_regs),
                        GFP_KERNEL);
        if (!plgpio->csave_regs)
                return -ENOMEM;
index ba1c2ca406e42450d6c1fe04fe5922fca4bae29b..78c2f548b25f1ef5dc3cbe702f2ef8db10416523 100644 (file)
@@ -879,8 +879,9 @@ static int sprd_pinctrl_parse_groups(struct device_node *np,
 
        grp->name = np->name;
        grp->npins = ret;
-       grp->pins = devm_kzalloc(sprd_pctl->dev, grp->npins *
-                                sizeof(unsigned int), GFP_KERNEL);
+       grp->pins = devm_kcalloc(sprd_pctl->dev,
+                                grp->npins, sizeof(unsigned int),
+                                GFP_KERNEL);
        if (!grp->pins)
                return -ENOMEM;
 
@@ -931,14 +932,15 @@ static int sprd_pinctrl_parse_dt(struct sprd_pinctrl *sprd_pctl)
        if (!info->ngroups)
                return 0;
 
-       info->groups = devm_kzalloc(sprd_pctl->dev, info->ngroups *
+       info->groups = devm_kcalloc(sprd_pctl->dev,
+                                   info->ngroups,
                                    sizeof(struct sprd_pin_group),
                                    GFP_KERNEL);
        if (!info->groups)
                return -ENOMEM;
 
-       info->grp_names = devm_kzalloc(sprd_pctl->dev,
-                                      info->ngroups * sizeof(char *),
+       info->grp_names = devm_kcalloc(sprd_pctl->dev,
+                                      info->ngroups, sizeof(char *),
                                       GFP_KERNEL);
        if (!info->grp_names)
                return -ENOMEM;
@@ -980,8 +982,8 @@ static int sprd_pinctrl_add_pins(struct sprd_pinctrl *sprd_pctl,
        int i;
 
        info->npins = pins_cnt;
-       info->pins = devm_kzalloc(sprd_pctl->dev,
-                                 info->npins * sizeof(struct sprd_pin),
+       info->pins = devm_kcalloc(sprd_pctl->dev,
+                                 info->npins, sizeof(struct sprd_pin),
                                  GFP_KERNEL);
        if (!info->pins)
                return -ENOMEM;
@@ -1057,7 +1059,8 @@ int sprd_pinctrl_core_probe(struct platform_device *pdev,
                return ret;
        }
 
-       pin_desc = devm_kzalloc(&pdev->dev, pinctrl_info->npins *
+       pin_desc = devm_kcalloc(&pdev->dev,
+                               pinctrl_info->npins,
                                sizeof(struct pinctrl_pin_desc),
                                GFP_KERNEL);
        if (!pin_desc)
index eaace8ec6afc4873242a76956a059f03a865e886..4d9bf9b3e9f3e45d8e7d1eeeeedf4cb88181b46f 100644 (file)
@@ -1055,8 +1055,8 @@ static int sunxi_pinctrl_build_state(struct platform_device *pdev)
         * this means that the number of pins is the maximum group
         * number we will ever see.
         */
-       pctl->groups = devm_kzalloc(&pdev->dev,
-                                   pctl->desc->npins * sizeof(*pctl->groups),
+       pctl->groups = devm_kcalloc(&pdev->dev,
+                                   pctl->desc->npins, sizeof(*pctl->groups),
                                    GFP_KERNEL);
        if (!pctl->groups)
                return -ENOMEM;
@@ -1079,8 +1079,9 @@ static int sunxi_pinctrl_build_state(struct platform_device *pdev)
         * We suppose that we won't have any more functions than pins,
         * we'll reallocate that later anyway
         */
-       pctl->functions = devm_kzalloc(&pdev->dev,
-                                      pctl->ngroups * sizeof(*pctl->functions),
+       pctl->functions = devm_kcalloc(&pdev->dev,
+                                      pctl->ngroups,
+                                      sizeof(*pctl->functions),
                                       GFP_KERNEL);
        if (!pctl->functions)
                return -ENOMEM;
@@ -1137,8 +1138,9 @@ static int sunxi_pinctrl_build_state(struct platform_device *pdev)
 
                        if (!func_item->groups) {
                                func_item->groups =
-                                       devm_kzalloc(&pdev->dev,
-                                                    func_item->ngroups * sizeof(*func_item->groups),
+                                       devm_kcalloc(&pdev->dev,
+                                                    func_item->ngroups,
+                                                    sizeof(*func_item->groups),
                                                     GFP_KERNEL);
                                if (!func_item->groups)
                                        return -ENOMEM;
@@ -1281,8 +1283,8 @@ int sunxi_pinctrl_init_with_variant(struct platform_device *pdev,
                return ret;
        }
 
-       pins = devm_kzalloc(&pdev->dev,
-                           pctl->desc->npins * sizeof(*pins),
+       pins = devm_kcalloc(&pdev->dev,
+                           pctl->desc->npins, sizeof(*pins),
                            GFP_KERNEL);
        if (!pins)
                return -ENOMEM;
index 49c7c1499bc3cddee80102f0fd83d5f4ab551569..f974eee29a1988c4a6f152c7246ccec3c4d490f9 100644 (file)
@@ -665,8 +665,8 @@ int tegra_pinctrl_probe(struct platform_device *pdev,
         * Each mux group will appear in 4 functions' list of groups.
         * This over-allocates slightly, since not all groups are mux groups.
         */
-       pmx->group_pins = devm_kzalloc(&pdev->dev,
-               soc_data->ngroups * 4 * sizeof(*pmx->group_pins),
+       pmx->group_pins = devm_kcalloc(&pdev->dev,
+               soc_data->ngroups * 4, sizeof(*pmx->group_pins),
                GFP_KERNEL);
        if (!pmx->group_pins)
                return -ENOMEM;
@@ -708,7 +708,7 @@ int tegra_pinctrl_probe(struct platform_device *pdev,
        }
        pmx->nbanks = i;
 
-       pmx->regs = devm_kzalloc(&pdev->dev, pmx->nbanks * sizeof(*pmx->regs),
+       pmx->regs = devm_kcalloc(&pdev->dev, pmx->nbanks, sizeof(*pmx->regs),
                                 GFP_KERNEL);
        if (!pmx->regs)
                return -ENOMEM;
index a8a6510183b692e95972206a9b4618547e9f1b6e..8782c348ebe9443d8e0ec2df3298d8100a38cb00 100644 (file)
@@ -510,11 +510,11 @@ static int ti_iodelay_dt_node_to_map(struct pinctrl_dev *pctldev,
                goto free_map;
        }
 
-       pins = devm_kzalloc(iod->dev, sizeof(*pins) * rows, GFP_KERNEL);
+       pins = devm_kcalloc(iod->dev, rows, sizeof(*pins), GFP_KERNEL);
        if (!pins)
                goto free_group;
 
-       cfg = devm_kzalloc(iod->dev, sizeof(*cfg) * rows, GFP_KERNEL);
+       cfg = devm_kcalloc(iod->dev, rows, sizeof(*cfg), GFP_KERNEL);
        if (!cfg) {
                error = -ENOMEM;
                goto free_pins;
@@ -749,7 +749,7 @@ static int ti_iodelay_alloc_pins(struct device *dev,
        nr_pins = ti_iodelay_offset_to_pin(iod, r->regmap_config->max_register);
        dev_dbg(dev, "Allocating %i pins\n", nr_pins);
 
-       iod->pa = devm_kzalloc(dev, sizeof(*iod->pa) * nr_pins, GFP_KERNEL);
+       iod->pa = devm_kcalloc(dev, nr_pins, sizeof(*iod->pa), GFP_KERNEL);
        if (!iod->pa)
                return -ENOMEM;
 
index ded366bb6564d8bda1ff37a65845ed72ea265970..caa44dd2880a824c03c1366742287d1398b10f54 100644 (file)
@@ -277,7 +277,7 @@ static int zx_pinctrl_build_state(struct platform_device *pdev)
 
        /* Every single pin composes a group */
        ngroups = info->npins;
-       groups = devm_kzalloc(&pdev->dev, ngroups * sizeof(*groups),
+       groups = devm_kcalloc(&pdev->dev, ngroups, sizeof(*groups),
                              GFP_KERNEL);
        if (!groups)
                return -ENOMEM;
@@ -362,8 +362,8 @@ static int zx_pinctrl_build_state(struct platform_device *pdev)
 
                        func = functions + j;
                        if (!func->group_names) {
-                               func->group_names = devm_kzalloc(&pdev->dev,
-                                               func->num_group_names *
+                               func->group_names = devm_kcalloc(&pdev->dev,
+                                               func->num_group_names,
                                                sizeof(*func->group_names),
                                                GFP_KERNEL);
                                if (!func->group_names) {
index ea9e7f4479cad668dc261ee4386dee272f729888..36a41ff506f0368be1a33710b6dcef098b16d7f0 100644 (file)
@@ -217,7 +217,8 @@ static int mlxreg_hotplug_attr_init(struct mlxreg_hotplug_priv_data *priv)
                }
        }
 
-       priv->group.attrs = devm_kzalloc(&priv->pdev->dev, num_attrs *
+       priv->group.attrs = devm_kcalloc(&priv->pdev->dev,
+                                        num_attrs,
                                         sizeof(struct attribute *),
                                         GFP_KERNEL);
        if (!priv->group.attrs)
index 2a50b465479303b0d2f4dda72625e6a35017be48..faa1a67cf3d2c704bce6ceaea6c9e555b84d8ddb 100644 (file)
@@ -1380,7 +1380,7 @@ static int charger_manager_register_sysfs(struct charger_manager *cm)
 
                snprintf(buf, 10, "charger.%d", i);
                str = devm_kzalloc(cm->dev,
-                               sizeof(char) * (strlen(buf) + 1), GFP_KERNEL);
+                               strlen(buf) + 1, GFP_KERNEL);
                if (!str)
                        return -ENOMEM;
 
@@ -1522,8 +1522,10 @@ static struct charger_desc *of_cm_parse_desc(struct device *dev)
        of_property_read_u32(np, "cm-num-chargers", &num_chgs);
        if (num_chgs) {
                /* Allocate empty bin at the tail of array */
-               desc->psy_charger_stat = devm_kzalloc(dev, sizeof(char *)
-                                               * (num_chgs + 1), GFP_KERNEL);
+               desc->psy_charger_stat = devm_kcalloc(dev,
+                                                     num_chgs + 1,
+                                                     sizeof(char *),
+                                                     GFP_KERNEL);
                if (desc->psy_charger_stat) {
                        int i;
                        for (i = 0; i < num_chgs; i++)
@@ -1555,8 +1557,9 @@ static struct charger_desc *of_cm_parse_desc(struct device *dev)
                struct charger_regulator *chg_regs;
                struct device_node *child;
 
-               chg_regs = devm_kzalloc(dev, sizeof(*chg_regs)
-                                       * desc->num_charger_regulators,
+               chg_regs = devm_kcalloc(dev,
+                                       desc->num_charger_regulators,
+                                       sizeof(*chg_regs),
                                        GFP_KERNEL);
                if (!chg_regs)
                        return ERR_PTR(-ENOMEM);
@@ -1573,9 +1576,10 @@ static struct charger_desc *of_cm_parse_desc(struct device *dev)
                        /* charger cables */
                        chg_regs->num_cables = of_get_child_count(child);
                        if (chg_regs->num_cables) {
-                               cables = devm_kzalloc(dev, sizeof(*cables)
-                                               * chg_regs->num_cables,
-                                               GFP_KERNEL);
+                               cables = devm_kcalloc(dev,
+                                                     chg_regs->num_cables,
+                                                     sizeof(*cables),
+                                                     GFP_KERNEL);
                                if (!cables) {
                                        of_node_put(child);
                                        return ERR_PTR(-ENOMEM);
@@ -1725,10 +1729,11 @@ static int charger_manager_probe(struct platform_device *pdev)
        cm->charger_psy_desc.name = cm->psy_name_buf;
 
        /* Allocate for psy properties because they may vary */
-       cm->charger_psy_desc.properties = devm_kzalloc(&pdev->dev,
-                               sizeof(enum power_supply_property)
-                               * (ARRAY_SIZE(default_charger_props) +
-                               NUM_CHARGER_PSY_OPTIONAL), GFP_KERNEL);
+       cm->charger_psy_desc.properties =
+               devm_kcalloc(&pdev->dev,
+                            ARRAY_SIZE(default_charger_props) +
+                               NUM_CHARGER_PSY_OPTIONAL,
+                            sizeof(enum power_supply_property), GFP_KERNEL);
        if (!cm->charger_psy_desc.properties)
                return -ENOMEM;
 
index f57ab0a27301d067094487d32ea79677f1f7cad8..d21f478741c17e786d534476a0288cf544c19b2e 100644 (file)
@@ -263,8 +263,8 @@ static int power_supply_check_supplies(struct power_supply *psy)
        if (!psy->supplied_from)
                return -ENOMEM;
 
-       *psy->supplied_from = devm_kzalloc(&psy->dev,
-                                          sizeof(char *) * (cnt - 1),
+       *psy->supplied_from = devm_kcalloc(&psy->dev,
+                                          cnt - 1, sizeof(char *),
                                           GFP_KERNEL);
        if (!*psy->supplied_from)
                return -ENOMEM;
index 52584e9962edd43adf83d9da04fc2e16672fcc87..15b40a8bc4fbbb456ab8aff72f1a7c44062966ca 100644 (file)
@@ -225,7 +225,7 @@ static int lp3943_pwm_parse_dt(struct device *dev,
                if (num_outputs == 0)
                        continue;
 
-               output = devm_kzalloc(dev, sizeof(*output) * num_outputs,
+               output = devm_kcalloc(dev, num_outputs, sizeof(*output),
                                      GFP_KERNEL);
                if (!output)
                        return -ENOMEM;
index 7652477e6a9df95cb4b43c0ef7753886250371fd..21e20483bd918b83e91cf5d8d14e73b4c208b99a 100644 (file)
@@ -424,9 +424,10 @@ static int act8865_pdata_from_dt(struct device *dev,
        if (matched <= 0)
                return matched;
 
-       pdata->regulators = devm_kzalloc(dev,
-                                        sizeof(struct act8865_regulator_data) *
-                                        num_matches, GFP_KERNEL);
+       pdata->regulators = devm_kcalloc(dev,
+                                        num_matches,
+                                        sizeof(struct act8865_regulator_data),
+                                        GFP_KERNEL);
        if (!pdata->regulators)
                return -ENOMEM;
 
index 874d415d6b4f9a5878fab8394bd043de0fdfeab1..565a71343a8e6014fa61ace5fb3a1b6b490f34b5 100644 (file)
@@ -239,8 +239,10 @@ static int as3711_regulator_probe(struct platform_device *pdev)
                }
        }
 
-       regs = devm_kzalloc(&pdev->dev, AS3711_REGULATOR_NUM *
-                       sizeof(struct as3711_regulator), GFP_KERNEL);
+       regs = devm_kcalloc(&pdev->dev,
+                           AS3711_REGULATOR_NUM,
+                           sizeof(struct as3711_regulator),
+                           GFP_KERNEL);
        if (!regs)
                return -ENOMEM;
 
index 9dd715407b39471e29309a924393ef8b2ba6ee50..92d6d7b10cf7fdc506edefb0130178b4a5186902 100644 (file)
@@ -383,8 +383,10 @@ static int bcm590xx_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, pmu);
 
-       pmu->desc = devm_kzalloc(&pdev->dev, BCM590XX_NUM_REGS *
-                       sizeof(struct regulator_desc), GFP_KERNEL);
+       pmu->desc = devm_kcalloc(&pdev->dev,
+                                BCM590XX_NUM_REGS,
+                                sizeof(struct regulator_desc),
+                                GFP_KERNEL);
        if (!pmu->desc)
                return -ENOMEM;
 
index 6a8f9cd69f520f8ff188c267a774b7c8af7ea64a..2df26f36c687681b51b2c648303a00f57034cd98 100644 (file)
@@ -681,8 +681,8 @@ static struct da9063_regulators_pdata *da9063_parse_regulators_dt(
        if (!pdata)
                return ERR_PTR(-ENOMEM);
 
-       pdata->regulator_data = devm_kzalloc(&pdev->dev,
-                                       num * sizeof(*pdata->regulator_data),
+       pdata->regulator_data = devm_kcalloc(&pdev->dev,
+                                       num, sizeof(*pdata->regulator_data),
                                        GFP_KERNEL);
        if (!pdata->regulator_data)
                return ERR_PTR(-ENOMEM);
index a86b8997bb54cc3be5bc01354b4949e1cd9e38a7..b2f5ec4f658ab6eeb1801185fb478b4f31748305 100644 (file)
@@ -172,8 +172,8 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np,
 
        if (ret > 0) {
                config->nr_gpios = ret;
-               config->gpios = devm_kzalloc(dev,
-                                       sizeof(struct gpio) * config->nr_gpios,
+               config->gpios = devm_kcalloc(dev,
+                                       config->nr_gpios, sizeof(struct gpio),
                                        GFP_KERNEL);
                if (!config->gpios)
                        return ERR_PTR(-ENOMEM);
@@ -214,9 +214,9 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np,
                return ERR_PTR(-EINVAL);
        }
 
-       config->states = devm_kzalloc(dev,
-                               sizeof(struct gpio_regulator_state)
-                               * (proplen / 2),
+       config->states = devm_kcalloc(dev,
+                               proplen / 2,
+                               sizeof(struct gpio_regulator_state),
                                GFP_KERNEL);
        if (!config->states)
                return ERR_PTR(-ENOMEM);
index 66bbaa9994333dc383ea6b51aa14e823d43ada62..cc52779b53f709717438f562b2a53153ecb1557a 100644 (file)
@@ -194,8 +194,10 @@ static int of_get_max1586_platform_data(struct device *dev,
        if (matched <= 0)
                return matched;
 
-       pdata->subdevs = devm_kzalloc(dev, sizeof(struct max1586_subdev_data) *
-                                               matched, GFP_KERNEL);
+       pdata->subdevs = devm_kcalloc(dev,
+                                     matched,
+                                     sizeof(struct max1586_subdev_data),
+                                     GFP_KERNEL);
        if (!pdata->subdevs)
                return -ENOMEM;
 
index a6183425f27d19084c7eb261a127d678c88eab0b..4cf6897a401f62004fd3eee979de9c59e73cb6ae 100644 (file)
@@ -351,8 +351,10 @@ static int max8660_pdata_from_dt(struct device *dev,
        if (matched <= 0)
                return matched;
 
-       pdata->subdevs = devm_kzalloc(dev, sizeof(struct max8660_subdev_data) *
-                                               matched, GFP_KERNEL);
+       pdata->subdevs = devm_kcalloc(dev,
+                                     matched,
+                                     sizeof(struct max8660_subdev_data),
+                                     GFP_KERNEL);
        if (!pdata->subdevs)
                return -ENOMEM;
 
index 559b9ac454043e06ce49b83db459ca8f64ecdd27..a8ea30ee18a6be50722c51a0b045fd93c5b2e2be 100644 (file)
@@ -929,8 +929,9 @@ static int max8997_pmic_dt_parse_pdata(struct platform_device *pdev,
        /* count the number of regulators to be supported in pmic */
        pdata->num_regulators = of_get_child_count(regulators_np);
 
-       rdata = devm_kzalloc(&pdev->dev, sizeof(*rdata) *
-                               pdata->num_regulators, GFP_KERNEL);
+       rdata = devm_kcalloc(&pdev->dev,
+                            pdata->num_regulators, sizeof(*rdata),
+                            GFP_KERNEL);
        if (!rdata) {
                of_node_put(regulators_np);
                return -ENOMEM;
index 6a2b61c012b50157773d533ea904fd8d59da9298..6b9f262ebbb09034d8822da5bfed683dbff09e2e 100644 (file)
@@ -670,8 +670,9 @@ static int max8998_pmic_dt_parse_pdata(struct max8998_dev *iodev,
        /* count the number of regulators to be supported in pmic */
        pdata->num_regulators = of_get_child_count(regulators_np);
 
-       rdata = devm_kzalloc(iodev->dev, sizeof(*rdata) *
-                               pdata->num_regulators, GFP_KERNEL);
+       rdata = devm_kcalloc(iodev->dev,
+                            pdata->num_regulators, sizeof(*rdata),
+                            GFP_KERNEL);
        if (!rdata) {
                of_node_put(regulators_np);
                return -ENOMEM;
index 41271aeea63e3ab36a2359e1857efdc1435f491d..da4fb98247578546f2babe0f790d47ac71656237 100644 (file)
@@ -171,7 +171,7 @@ struct mc13xxx_regulator_init_data *mc13xxx_parse_regulators_dt(
        if (!parent)
                return NULL;
 
-       data = devm_kzalloc(&pdev->dev, sizeof(*data) * priv->num_regulators,
+       data = devm_kcalloc(&pdev->dev, priv->num_regulators, sizeof(*data),
                            GFP_KERNEL);
        if (!data) {
                of_node_put(parent);
index 8f782d22fdbef61d4566c9bc63bc6120be461cbe..92b41a6a4dc201101e491830dcaa3fe4b8ddd7b9 100644 (file)
@@ -173,8 +173,9 @@ static int pbias_regulator_probe(struct platform_device *pdev)
        if (count < 0)
                return count;
 
-       drvdata = devm_kzalloc(&pdev->dev, sizeof(struct pbias_regulator_data)
-                              * count, GFP_KERNEL);
+       drvdata = devm_kcalloc(&pdev->dev,
+                              count, sizeof(struct pbias_regulator_data),
+                              GFP_KERNEL);
        if (!drvdata)
                return -ENOMEM;
 
index d0f1340168b18080875e08e8b0b1f578cc5c3091..2ec51af4367365bcb119be2956dd78d5fb4979b5 100644 (file)
@@ -132,8 +132,10 @@ static int rc5t583_regulator_probe(struct platform_device *pdev)
                return -ENODEV;
        }
 
-       regs = devm_kzalloc(&pdev->dev, RC5T583_REGULATOR_MAX *
-                       sizeof(struct rc5t583_regulator), GFP_KERNEL);
+       regs = devm_kcalloc(&pdev->dev,
+                           RC5T583_REGULATOR_MAX,
+                           sizeof(struct rc5t583_regulator),
+                           GFP_KERNEL);
        if (!regs)
                return -ENOMEM;
 
index b8443a360646b7998f2a41e6435be6643c69f63c..0cbc980753c2f0fcb6151a67d60457e2daeadb93 100644 (file)
@@ -553,13 +553,15 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev,
        /* count the number of regulators to be supported in pmic */
        pdata->num_regulators = of_get_child_count(regulators_np);
 
-       rdata = devm_kzalloc(&pdev->dev, sizeof(*rdata) *
-                               pdata->num_regulators, GFP_KERNEL);
+       rdata = devm_kcalloc(&pdev->dev,
+                            pdata->num_regulators, sizeof(*rdata),
+                            GFP_KERNEL);
        if (!rdata)
                return -ENOMEM;
 
-       rmode = devm_kzalloc(&pdev->dev, sizeof(*rmode) *
-                               pdata->num_regulators, GFP_KERNEL);
+       rmode = devm_kcalloc(&pdev->dev,
+                            pdata->num_regulators, sizeof(*rmode),
+                            GFP_KERNEL);
        if (!rmode)
                return -ENOMEM;
 
index d2f9942987535586dc69da863fbaa6b4ab16bdf4..cced1ffb896c1169dba81bde5c9b83a63890ceab 100644 (file)
@@ -532,13 +532,13 @@ static int ti_abb_init_table(struct device *dev, struct ti_abb *abb,
        }
        num_entries /= num_values;
 
-       info = devm_kzalloc(dev, sizeof(*info) * num_entries, GFP_KERNEL);
+       info = devm_kcalloc(dev, num_entries, sizeof(*info), GFP_KERNEL);
        if (!info)
                return -ENOMEM;
 
        abb->info = info;
 
-       volt_table = devm_kzalloc(dev, sizeof(unsigned int) * num_entries,
+       volt_table = devm_kcalloc(dev, num_entries, sizeof(unsigned int),
                                  GFP_KERNEL);
        if (!volt_table)
                return -ENOMEM;
index 2d398fa3b720d633f20283ba69836175d689a8e0..edaef9e4dc74ea7e1994343a2e2eb6a4e7bf02ef 100644 (file)
@@ -331,8 +331,9 @@ static struct tps65090_platform_data *tps65090_parse_dt_reg_data(
        if (!tps65090_pdata)
                return ERR_PTR(-ENOMEM);
 
-       reg_pdata = devm_kzalloc(&pdev->dev, TPS65090_REGULATOR_MAX *
-                               sizeof(*reg_pdata), GFP_KERNEL);
+       reg_pdata = devm_kcalloc(&pdev->dev,
+                                TPS65090_REGULATOR_MAX, sizeof(*reg_pdata),
+                                GFP_KERNEL);
        if (!reg_pdata)
                return ERR_PTR(-ENOMEM);
 
@@ -429,8 +430,9 @@ static int tps65090_regulator_probe(struct platform_device *pdev)
                return tps65090_pdata ? PTR_ERR(tps65090_pdata) : -EINVAL;
        }
 
-       pmic = devm_kzalloc(&pdev->dev, TPS65090_REGULATOR_MAX * sizeof(*pmic),
-                       GFP_KERNEL);
+       pmic = devm_kcalloc(&pdev->dev,
+                           TPS65090_REGULATOR_MAX, sizeof(*pmic),
+                           GFP_KERNEL);
        if (!pmic)
                return -ENOMEM;
 
index 7b12e880d1eae0d4f332119d82e510a643dc89e5..fc12badf38059f96b4bea38a6ffaed8bd9a71dbc 100644 (file)
@@ -229,8 +229,9 @@ static int tps65217_regulator_probe(struct platform_device *pdev)
        unsigned int val;
 
        /* Allocate memory for strobes */
-       tps->strobes = devm_kzalloc(&pdev->dev, sizeof(u8) *
-                                   TPS65217_NUM_REGULATOR, GFP_KERNEL);
+       tps->strobes = devm_kcalloc(&pdev->dev,
+                                   TPS65217_NUM_REGULATOR, sizeof(u8),
+                                   GFP_KERNEL);
 
        platform_set_drvdata(pdev, tps);
 
index 1827185beacc4e7f9079ae68a170f9c39003560c..6209beee10188d6c17e0d9f395367909a4e3aacd 100644 (file)
@@ -324,8 +324,9 @@ static int tps65218_regulator_probe(struct platform_device *pdev)
        config.regmap = tps->regmap;
 
        /* Allocate memory for strobes */
-       tps->strobes = devm_kzalloc(&pdev->dev, sizeof(u8) *
-                                   TPS65218_NUM_REGULATOR, GFP_KERNEL);
+       tps->strobes = devm_kcalloc(&pdev->dev,
+                                   TPS65218_NUM_REGULATOR, sizeof(u8),
+                                   GFP_KERNEL);
        if (!tps->strobes)
                return -ENOMEM;
 
index 81672a58fcc234f381a40c3b43eda132a6dd96a5..02ccdaa226a73f97a5fc812f5173c2bef44d25f4 100644 (file)
@@ -1131,18 +1131,24 @@ static int tps65910_probe(struct platform_device *pdev)
                return -ENODEV;
        }
 
-       pmic->desc = devm_kzalloc(&pdev->dev, pmic->num_regulators *
-                       sizeof(struct regulator_desc), GFP_KERNEL);
+       pmic->desc = devm_kcalloc(&pdev->dev,
+                                 pmic->num_regulators,
+                                 sizeof(struct regulator_desc),
+                                 GFP_KERNEL);
        if (!pmic->desc)
                return -ENOMEM;
 
-       pmic->info = devm_kzalloc(&pdev->dev, pmic->num_regulators *
-                       sizeof(struct tps_info *), GFP_KERNEL);
+       pmic->info = devm_kcalloc(&pdev->dev,
+                                 pmic->num_regulators,
+                                 sizeof(struct tps_info *),
+                                 GFP_KERNEL);
        if (!pmic->info)
                return -ENOMEM;
 
-       pmic->rdev = devm_kzalloc(&pdev->dev, pmic->num_regulators *
-                       sizeof(struct regulator_dev *), GFP_KERNEL);
+       pmic->rdev = devm_kcalloc(&pdev->dev,
+                                 pmic->num_regulators,
+                                 sizeof(struct regulator_dev *),
+                                 GFP_KERNEL);
        if (!pmic->rdev)
                return -ENOMEM;
 
index d4cc60ad18ae4b39cc2c484e971b0075e51231ef..1001147404c38ecbc091e618111bb06f9352ba29 100644 (file)
@@ -691,8 +691,8 @@ static int tps80031_regulator_probe(struct platform_device *pdev)
                return -EINVAL;
        }
 
-       pmic = devm_kzalloc(&pdev->dev,
-                       TPS80031_REGULATOR_MAX * sizeof(*pmic), GFP_KERNEL);
+       pmic = devm_kcalloc(&pdev->dev,
+                       TPS80031_REGULATOR_MAX, sizeof(*pmic), GFP_KERNEL);
        if (!pmic)
                return -ENOMEM;
 
index 99520b0a1329b4d35d66b4b288b5ad63d1a8eacf..a2635c21db7f8eccc77965ed7975f9e34a9e28fd 100644 (file)
@@ -189,7 +189,8 @@ static int ti_syscon_reset_probe(struct platform_device *pdev)
        }
 
        nr_controls = (size / sizeof(*list)) / 7;
-       controls = devm_kzalloc(dev, nr_controls * sizeof(*controls), GFP_KERNEL);
+       controls = devm_kcalloc(dev, nr_controls, sizeof(*controls),
+                               GFP_KERNEL);
        if (!controls)
                return -ENOMEM;
 
index 05cf4daf87886b70aeab68ea3687e2378a8d5513..08c7b1e25fe481503ae5d4fd48324f703b40addf 100644 (file)
@@ -232,14 +232,14 @@ static int isci_register_sas_ha(struct isci_host *isci_host)
        struct asd_sas_phy **sas_phys;
        struct asd_sas_port **sas_ports;
 
-       sas_phys = devm_kzalloc(&isci_host->pdev->dev,
-                               SCI_MAX_PHYS * sizeof(void *),
+       sas_phys = devm_kcalloc(&isci_host->pdev->dev,
+                               SCI_MAX_PHYS, sizeof(void *),
                                GFP_KERNEL);
        if (!sas_phys)
                return -ENOMEM;
 
-       sas_ports = devm_kzalloc(&isci_host->pdev->dev,
-                                SCI_MAX_PORTS * sizeof(void *),
+       sas_ports = devm_kcalloc(&isci_host->pdev->dev,
+                                SCI_MAX_PORTS, sizeof(void *),
                                 GFP_KERNEL);
        if (!sas_ports)
                return -ENOMEM;
index e82bde0772963cbbde59a52712984f56921d39d9..895a9b5ac98993ecac1c7c3ff2621548b3dd6cea 100644 (file)
@@ -86,8 +86,8 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba)
                goto out;
        }
 
-       clkfreq = devm_kzalloc(dev, sz * sizeof(*clkfreq),
-                       GFP_KERNEL);
+       clkfreq = devm_kcalloc(dev, sz, sizeof(*clkfreq),
+                              GFP_KERNEL);
        if (!clkfreq) {
                ret = -ENOMEM;
                goto out;
index 3a811c5f70bace97e5c2973864dac08d5dfbf216..397081d320b1952c2677b8bceefc6c69fb402f39 100644 (file)
@@ -3357,8 +3357,8 @@ static int ufshcd_memory_alloc(struct ufs_hba *hba)
        }
 
        /* Allocate memory for local reference block */
-       hba->lrb = devm_kzalloc(hba->dev,
-                               hba->nutrs * sizeof(struct ufshcd_lrb),
+       hba->lrb = devm_kcalloc(hba->dev,
+                               hba->nutrs, sizeof(struct ufshcd_lrb),
                                GFP_KERNEL);
        if (!hba->lrb) {
                dev_err(hba->dev, "LRB Memory allocation failed\n");
index f7ed1187518b9d2b47bedd29ae6b5a1e3ab566fd..a78dfe0a2b503c3a98e09f48c606f45ea184a513 100644 (file)
@@ -165,8 +165,10 @@ static int rpi_power_probe(struct platform_device *pdev)
                return -ENOMEM;
 
        rpi_domains->xlate.domains =
-               devm_kzalloc(dev, sizeof(*rpi_domains->xlate.domains) *
-                            RPI_POWER_DOMAIN_COUNT, GFP_KERNEL);
+               devm_kcalloc(dev,
+                            RPI_POWER_DOMAIN_COUNT,
+                            sizeof(*rpi_domains->xlate.domains),
+                            GFP_KERNEL);
        if (!rpi_domains->xlate.domains)
                return -ENOMEM;
 
index d762a46d434fc8c99be832d6938dbb8d9bf55768..d041d9852b23e4903d91cf604e77e5809c896656 100644 (file)
@@ -407,15 +407,15 @@ static struct scp *init_scp(struct platform_device *pdev,
        if (IS_ERR(scp->base))
                return ERR_CAST(scp->base);
 
-       scp->domains = devm_kzalloc(&pdev->dev,
-                               sizeof(*scp->domains) * num, GFP_KERNEL);
+       scp->domains = devm_kcalloc(&pdev->dev,
+                               num, sizeof(*scp->domains), GFP_KERNEL);
        if (!scp->domains)
                return ERR_PTR(-ENOMEM);
 
        pd_data = &scp->pd_data;
 
-       pd_data->domains = devm_kzalloc(&pdev->dev,
-                       sizeof(*pd_data->domains) * num, GFP_KERNEL);
+       pd_data->domains = devm_kcalloc(&pdev->dev,
+                       num, sizeof(*pd_data->domains), GFP_KERNEL);
        if (!pd_data->domains)
                return ERR_PTR(-ENOMEM);
 
index 3d7225f4e77fe511bc84f80f818db639fae0de2c..316e82e46f6cbff0500ba8409529dffc3d0eddbe 100644 (file)
@@ -405,8 +405,8 @@ static int knav_acc_init_queue(struct knav_range_info *range,
 {
        unsigned id = kq->id - range->queue_base;
 
-       kq->descs = devm_kzalloc(range->kdev->dev,
-                                ACC_DESCS_MAX * sizeof(u32), GFP_KERNEL);
+       kq->descs = devm_kcalloc(range->kdev->dev,
+                                ACC_DESCS_MAX, sizeof(u32), GFP_KERNEL);
        if (!kq->descs)
                return -ENOMEM;
 
@@ -552,7 +552,7 @@ int knav_init_acc_range(struct knav_device *kdev,
        info->list_size = list_size;
        mem_size   = PAGE_ALIGN(list_size * 2);
        info->mem_size  = mem_size;
-       range->acc = devm_kzalloc(kdev->dev, channels * sizeof(*range->acc),
+       range->acc = devm_kcalloc(kdev->dev, channels, sizeof(*range->acc),
                                  GFP_KERNEL);
        if (!range->acc)
                return -ENOMEM;
index 60d59b003aa4339752c97e5c27ba11d15f4d4390..577084bb911bad7292f0ea4bcbbf7d0b1b9e35ba 100644 (file)
@@ -923,9 +923,10 @@ static int davinci_spi_probe(struct platform_device *pdev)
        /* pdata in dspi is now updated and point pdata to that */
        pdata = &dspi->pdata;
 
-       dspi->bytes_per_word = devm_kzalloc(&pdev->dev,
-                                           sizeof(*dspi->bytes_per_word) *
-                                           pdata->num_chipselect, GFP_KERNEL);
+       dspi->bytes_per_word = devm_kcalloc(&pdev->dev,
+                                           pdata->num_chipselect,
+                                           sizeof(*dspi->bytes_per_word),
+                                           GFP_KERNEL);
        if (dspi->bytes_per_word == NULL) {
                ret = -ENOMEM;
                goto free_master;
index e5cc07357746afd20c55c75ae3a407d35c2d14d0..f1526757aaf6da88d7be55aaa7ae70c6c3579c2d 100644 (file)
@@ -671,8 +671,8 @@ static int ep93xx_spi_probe(struct platform_device *pdev)
        master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 16);
 
        master->num_chipselect = info->num_chipselect;
-       master->cs_gpios = devm_kzalloc(&master->dev,
-                                       sizeof(int) * master->num_chipselect,
+       master->cs_gpios = devm_kcalloc(&master->dev,
+                                       master->num_chipselect, sizeof(int),
                                        GFP_KERNEL);
        if (!master->cs_gpios) {
                error = -ENOMEM;
index b85a93cad44a1ecb117a4c9bcae161bc109a23c6..6ae92d4dca19d6201c5f2ddd4e552f4d639bbce2 100644 (file)
@@ -373,8 +373,9 @@ static int spi_gpio_probe(struct platform_device *pdev)
 
        spi_gpio = spi_master_get_devdata(master);
 
-       spi_gpio->cs_gpios = devm_kzalloc(&pdev->dev,
-                               pdata->num_chipselect * sizeof(*spi_gpio->cs_gpios),
+       spi_gpio->cs_gpios = devm_kcalloc(&pdev->dev,
+                               pdata->num_chipselect,
+                               sizeof(*spi_gpio->cs_gpios),
                                GFP_KERNEL);
        if (!spi_gpio->cs_gpios)
                return -ENOMEM;
index 866246f2104102ff82e01eab3caaacf13ced4ffc..d3b21faf6b1f812c1f089cf9f8964f732385c69c 100644 (file)
@@ -1511,8 +1511,9 @@ static int spi_imx_probe(struct platform_device *pdev)
        if (mxc_platform_info) {
                master->num_chipselect = mxc_platform_info->num_chipselect;
                if (mxc_platform_info->chipselect) {
-                       master->cs_gpios = devm_kzalloc(&master->dev,
-                               sizeof(int) * master->num_chipselect, GFP_KERNEL);
+                       master->cs_gpios = devm_kcalloc(&master->dev,
+                               master->num_chipselect, sizeof(int),
+                               GFP_KERNEL);
                        if (!master->cs_gpios)
                                return -ENOMEM;
 
index b5911282a61116c47b0237071df40261831f94ab..085f580be7ec4d151a846618da4d9d472803fc54 100644 (file)
@@ -213,8 +213,8 @@ static int tiny_spi_of_probe(struct platform_device *pdev)
                return 0;
        hw->gpio_cs_count = of_gpio_count(np);
        if (hw->gpio_cs_count > 0) {
-               hw->gpio_cs = devm_kzalloc(&pdev->dev,
-                               hw->gpio_cs_count * sizeof(unsigned int),
+               hw->gpio_cs = devm_kcalloc(&pdev->dev,
+                               hw->gpio_cs_count, sizeof(unsigned int),
                                GFP_KERNEL);
                if (!hw->gpio_cs)
                        return -ENOMEM;
index 4797c57f426303b87d351d9b28a1dcb41fa12df1..1af8c96b940e203dfabf0b270ad46267b4308e12 100644 (file)
@@ -2135,7 +2135,7 @@ static int pl022_probe(struct amba_device *adev, const struct amba_id *id)
        pl022->master_info = platform_info;
        pl022->adev = adev;
        pl022->vendor = id->data;
-       pl022->chipselects = devm_kzalloc(dev, num_cs * sizeof(int),
+       pl022->chipselects = devm_kcalloc(dev, num_cs, sizeof(int),
                                          GFP_KERNEL);
        if (!pl022->chipselects) {
                status = -ENOMEM;
index efc624f9e490e64e9ea1645e87327010a9324f0d..ec395a6baf9cacbae1830cf062fb40ae7e778f62 100644 (file)
@@ -2049,7 +2049,7 @@ static int of_spi_register_master(struct spi_controller *ctlr)
        else if (nb < 0)
                return nb;
 
-       cs = devm_kzalloc(&ctlr->dev, sizeof(int) * ctlr->num_chipselect,
+       cs = devm_kcalloc(&ctlr->dev, ctlr->num_chipselect, sizeof(int),
                          GFP_KERNEL);
        ctlr->cs_gpios = cs;
 
index 15e57f7016302bbdb001baa65c702cd110b6b3c2..b71078339e860d8d6713f28ec20f2a31588d18a4 100644 (file)
@@ -144,7 +144,7 @@ static const char **gb_generate_enum_strings(struct gbaudio_module_info *gb,
        __u8 *data;
 
        items = le32_to_cpu(gbenum->items);
-       strings = devm_kzalloc(gb->dev, sizeof(char *) * items, GFP_KERNEL);
+       strings = devm_kcalloc(gb->dev, items, sizeof(char *), GFP_KERNEL);
        data = gbenum->names;
 
        for (i = 0; i < items; i++) {
index 289d775c482028f0e4289b9a5a981cf780fa0b08..b0be80f05767869b9947a64dabd657ea18a129c4 100644 (file)
@@ -303,9 +303,9 @@ static int imx_media_alloc_pad_vdev_lists(struct imx_media_dev *imxmd)
 
        list_for_each_entry(sd, &imxmd->v4l2_dev.subdevs, list) {
                entity = &sd->entity;
-               vdev_lists = devm_kzalloc(
+               vdev_lists = devm_kcalloc(
                        imxmd->md.dev,
-                       entity->num_pads * sizeof(*vdev_lists),
+                       entity->num_pads, sizeof(*vdev_lists),
                        GFP_KERNEL);
                if (!vdev_lists)
                        return -ENOMEM;
@@ -544,7 +544,7 @@ static int imx_media_probe(struct platform_device *pdev)
                goto unreg_dev;
        }
 
-       subdevs = devm_kzalloc(imxmd->md.dev, sizeof(*subdevs) * num_subdevs,
+       subdevs = devm_kcalloc(imxmd->md.dev, num_subdevs, sizeof(*subdevs),
                               GFP_KERNEL);
        if (!subdevs) {
                ret = -ENOMEM;
index 04b1a095038761f2c6adcb8a08dad0b5501ff085..0c3e498ae99cde7ff67818a96e84a37410d206e6 100644 (file)
@@ -287,7 +287,8 @@ static int rt2880_pinmux_index(struct rt2880_priv *p)
        }
 
        /* allocate the group names array needed by the gpio function */
-       p->group_names = devm_kzalloc(p->dev, sizeof(char *) * p->group_count, GFP_KERNEL);
+       p->group_names = devm_kcalloc(p->dev, p->group_count, sizeof(char *),
+                                     GFP_KERNEL);
        if (!p->group_names)
                return -1;
 
@@ -300,8 +301,12 @@ static int rt2880_pinmux_index(struct rt2880_priv *p)
        p->func_count++;
 
        /* allocate our function and group mapping index buffers */
-       f = p->func = devm_kzalloc(p->dev, sizeof(struct rt2880_pmx_func) * p->func_count, GFP_KERNEL);
-       gpio_func.groups = devm_kzalloc(p->dev, sizeof(int) * p->group_count, GFP_KERNEL);
+       f = p->func = devm_kcalloc(p->dev,
+                                  p->func_count,
+                                  sizeof(struct rt2880_pmx_func),
+                                  GFP_KERNEL);
+       gpio_func.groups = devm_kcalloc(p->dev, p->group_count, sizeof(int),
+                                       GFP_KERNEL);
        if (!f || !gpio_func.groups)
                return -1;
 
@@ -337,7 +342,10 @@ static int rt2880_pinmux_pins(struct rt2880_priv *p)
                if (!p->func[i]->pin_count)
                        continue;
 
-               p->func[i]->pins = devm_kzalloc(p->dev, sizeof(int) * p->func[i]->pin_count, GFP_KERNEL);
+               p->func[i]->pins = devm_kcalloc(p->dev,
+                                               p->func[i]->pin_count,
+                                               sizeof(int),
+                                               GFP_KERNEL);
                for (j = 0; j < p->func[i]->pin_count; j++)
                        p->func[i]->pins[j] = p->func[i]->pin_first + j;
 
@@ -347,11 +355,11 @@ static int rt2880_pinmux_pins(struct rt2880_priv *p)
        }
 
        /* the buffer that tells us which pins are gpio */
-       p->gpio = devm_kzalloc(p->dev,sizeof(uint8_t) * p->max_pins,
-               GFP_KERNEL);
+       p->gpio = devm_kcalloc(p->dev,p->max_pins, sizeof(uint8_t),
+                              GFP_KERNEL);
        /* the pads needed to tell pinctrl about our pins */
-       p->pads = devm_kzalloc(p->dev,
-               sizeof(struct pinctrl_pin_desc) * p->max_pins,
+       p->pads = devm_kcalloc(p->dev,
+               p->max_pins, sizeof(struct pinctrl_pin_desc),
                GFP_KERNEL);
        if (!p->pads || !p->gpio ) {
                dev_err(p->dev, "Failed to allocate gpio data\n");
index 455b58ce26527368e06567d86d7982dfa99dcbcd..e1fc2b06f3432379fcedcfe8f07b17718597a506 100644 (file)
@@ -1343,8 +1343,8 @@ static int tegra_soctherm_probe(struct platform_device *pdev)
                return PTR_ERR(tegra->clock_soctherm);
        }
 
-       tegra->calib = devm_kzalloc(&pdev->dev,
-                                   sizeof(u32) * soc->num_tsensors,
+       tegra->calib = devm_kcalloc(&pdev->dev,
+                                   soc->num_tsensors, sizeof(u32),
                                    GFP_KERNEL);
        if (!tegra->calib)
                return -ENOMEM;
@@ -1363,8 +1363,8 @@ static int tegra_soctherm_probe(struct platform_device *pdev)
                        return err;
        }
 
-       tegra->thermctl_tzs = devm_kzalloc(&pdev->dev,
-                                          sizeof(*z) * soc->num_ttgs,
+       tegra->thermctl_tzs = devm_kcalloc(&pdev->dev,
+                                          soc->num_ttgs, sizeof(*z),
                                           GFP_KERNEL);
        if (!tegra->thermctl_tzs)
                return -ENOMEM;
index 46d3005335c7485077dbf31951ba67273e3ef6e3..bf1c628d4a7ad3f78454946b736c4bacd7d3dcfb 100644 (file)
@@ -87,8 +87,9 @@ static int gadc_thermal_read_linear_lookup_table(struct device *dev,
                return -EINVAL;
        }
 
-       gti->lookup_table = devm_kzalloc(dev, sizeof(*gti->lookup_table) *
-                                        ntable, GFP_KERNEL);
+       gti->lookup_table = devm_kcalloc(dev,
+                                        ntable, sizeof(*gti->lookup_table),
+                                        GFP_KERNEL);
        if (!gti->lookup_table)
                return -ENOMEM;
 
index 520b43b235430af110086e673aa304419a810551..5690c09cc0417f3a34d005b804b08e6808ff1d28 100644 (file)
@@ -774,7 +774,7 @@ static int rp2_probe(struct pci_dev *pdev,
 
        rp2_init_card(card);
 
-       ports = devm_kzalloc(&pdev->dev, sizeof(*ports) * card->n_ports,
+       ports = devm_kcalloc(&pdev->dev, card->n_ports, sizeof(*ports),
                             GFP_KERNEL);
        if (!ports)
                return -ENOMEM;
index a4d99bf50f2f866d3ad1a2019dbfe0dce92f0d35..17147b8c771ef04024c2f203ee3636f9620d6f73 100644 (file)
@@ -2036,7 +2036,7 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev,
                udc->num_ep = usba_config_fifo_table(udc);
        }
 
-       eps = devm_kzalloc(&pdev->dev, sizeof(struct usba_ep) * udc->num_ep,
+       eps = devm_kcalloc(&pdev->dev, udc->num_ep, sizeof(struct usba_ep),
                           GFP_KERNEL);
        if (!eps)
                return ERR_PTR(-ENOMEM);
index 977ea1a02cf992a0abaa4af6b51c806a3aa2f2fa..7cf98c793e044724b2b9713866929367fce6f06b 100644 (file)
@@ -2427,7 +2427,8 @@ static int renesas_usb3_init_ep(struct renesas_usb3 *usb3, struct device *dev,
        if (usb3->num_usb3_eps > USB3_MAX_NUM_PIPES)
                usb3->num_usb3_eps = USB3_MAX_NUM_PIPES;
 
-       usb3->usb3_ep = devm_kzalloc(dev, sizeof(*usb3_ep) * usb3->num_usb3_eps,
+       usb3->usb3_ep = devm_kcalloc(dev,
+                                    usb3->num_usb3_eps, sizeof(*usb3_ep),
                                     GFP_KERNEL);
        if (!usb3->usb3_ep)
                return -ENOMEM;
index e7315bf14d60159c3cb3d0915797e8838cd7bc73..16119bde975000118ddc0b36854101c72f1636c6 100644 (file)
@@ -223,7 +223,7 @@ static int adp8860_led_probe(struct i2c_client *client)
        struct led_info *cur_led;
        int ret, i;
 
-       led = devm_kzalloc(&client->dev, sizeof(*led) * pdata->num_leds,
+       led = devm_kcalloc(&client->dev, pdata->num_leds, sizeof(*led),
                                GFP_KERNEL);
        if (led == NULL)
                return -ENOMEM;
index 058d1def2d1f4ba6caa6d2e6a720fb41e206b715..4fec9aa92d9be688d379838c436c83a5db27912f 100644 (file)
@@ -246,7 +246,7 @@ static int adp8870_led_probe(struct i2c_client *client)
        struct led_info *cur_led;
        int ret, i;
 
-       led = devm_kzalloc(&client->dev, pdata->num_leds * sizeof(*led),
+       led = devm_kcalloc(&client->dev, pdata->num_leds, sizeof(*led),
                                GFP_KERNEL);
        if (led == NULL)
                return -ENOMEM;
index 939f057836e1981223ee1ab0dbaa62288fe7b976..73612485ed07e4af457b0a46c73ab516f4fea5f5 100644 (file)
@@ -374,7 +374,7 @@ static int lp855x_parse_dt(struct lp855x *lp)
                struct device_node *child;
                int i = 0;
 
-               rom = devm_kzalloc(dev, sizeof(*rom) * rom_length, GFP_KERNEL);
+               rom = devm_kcalloc(dev, rom_length, sizeof(*rom), GFP_KERNEL);
                if (!rom)
                        return -ENOMEM;
 
index 7c9a672e9811758f378a328790d5aeae3faf383b..d555a78df5c62292f5ccce4a6039d483fdb2016c 100644 (file)
@@ -501,7 +501,7 @@ static int au1100fb_drv_probe(struct platform_device *dev)
        fbdev->info.fix = au1100fb_fix;
 
        fbdev->info.pseudo_palette =
-               devm_kzalloc(&dev->dev, sizeof(u32) * 16, GFP_KERNEL);
+               devm_kcalloc(&dev->dev, 16, sizeof(u32), GFP_KERNEL);
        if (!fbdev->info.pseudo_palette)
                return -ENOMEM;
 
index 246bea3a7d9bc40aea75a94dff7274f70cc65833..12c8bd1d24d5321af7106c3738eeffbee056b25d 100644 (file)
@@ -931,7 +931,7 @@ static int mxsfb_probe(struct platform_device *pdev)
        if (IS_ERR(host->reg_lcd))
                host->reg_lcd = NULL;
 
-       fb_info->pseudo_palette = devm_kzalloc(&pdev->dev, sizeof(u32) * 16,
+       fb_info->pseudo_palette = devm_kcalloc(&pdev->dev, 16, sizeof(u32),
                                               GFP_KERNEL);
        if (!fb_info->pseudo_palette) {
                ret = -ENOMEM;
index f346b02eee1d84c2d8da77b15e3d64c72aa4fa17..f355ecfac3b1877e607237c22f79d3a60b335ddf 100644 (file)
@@ -359,8 +359,8 @@ static int __init vrfb_probe(struct platform_device *pdev)
 
        num_ctxs = pdev->num_resources - 1;
 
-       ctxs = devm_kzalloc(&pdev->dev,
-                       sizeof(struct vrfb_ctx) * num_ctxs,
+       ctxs = devm_kcalloc(&pdev->dev,
+                       num_ctxs, sizeof(struct vrfb_ctx),
                        GFP_KERNEL);
 
        if (!ctxs)
index fb650659c3a3ef229ca03b9b51744834b8a34500..a906560d0cddfad320aa75b56f719d94d01acef4 100644 (file)
@@ -339,8 +339,8 @@ static int au1xpsc_pcm_drvprobe(struct platform_device *pdev)
 {
        struct au1xpsc_audio_dmadata *dmadata;
 
-       dmadata = devm_kzalloc(&pdev->dev,
-                              2 * sizeof(struct au1xpsc_audio_dmadata),
+       dmadata = devm_kcalloc(&pdev->dev,
+                              2, sizeof(struct au1xpsc_audio_dmadata),
                               GFP_KERNEL);
        if (!dmadata)
                return -ENOMEM;
index 6fa11888672d4ca0c60096205c45e52f647f9ab8..38e4a8515709743c75befa77addca1b491c7979b 100644 (file)
@@ -771,7 +771,7 @@ static int hdmi_codec_probe(struct platform_device *pdev)
        hcp->hcd = *hcd;
        mutex_init(&hcp->current_stream_lock);
 
-       hcp->daidrv = devm_kzalloc(dev, dai_count * sizeof(*hcp->daidrv),
+       hcp->daidrv = devm_kcalloc(dev, dai_count, sizeof(*hcp->daidrv),
                                   GFP_KERNEL);
        if (!hcp->daidrv)
                return -ENOMEM;
index 712384581ebf3d2f5307936bf0ebf3a6ef3f1210..1dc70f452c1b9505d8e0e2952f46fcf2982195c4 100644 (file)
@@ -3449,8 +3449,9 @@ static int rt5645_probe(struct snd_soc_component *component)
        if (rt5645->pdata.long_name)
                component->card->long_name = rt5645->pdata.long_name;
 
-       rt5645->eq_param = devm_kzalloc(component->dev,
-               RT5645_HWEQ_NUM * sizeof(struct rt5645_eq_param_s), GFP_KERNEL);
+       rt5645->eq_param = devm_kcalloc(component->dev,
+               RT5645_HWEQ_NUM, sizeof(struct rt5645_eq_param_s),
+               GFP_KERNEL);
 
        return 0;
 }
index 6e9e32a072598ac670c6a532f645f042c9bb71e1..7fdfdf3f6e67e5c045d6b80b0ac516dac3697dea 100644 (file)
@@ -3298,8 +3298,8 @@ static void wm8994_handle_pdata(struct wm8994_priv *wm8994)
                };
 
                /* We need an array of texts for the enum API */
-               wm8994->drc_texts = devm_kzalloc(wm8994->hubs.component->dev,
-                           sizeof(char *) * pdata->num_drc_cfgs, GFP_KERNEL);
+               wm8994->drc_texts = devm_kcalloc(wm8994->hubs.component->dev,
+                           pdata->num_drc_cfgs, sizeof(char *), GFP_KERNEL);
                if (!wm8994->drc_texts)
                        return;
 
index 1f96c9dbe9c49c1422561b7bd8b6dbd3c45bc68d..47c0c821d325f4b14b50b16b8fb9043c06670861 100644 (file)
@@ -1868,8 +1868,8 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
 
        mcasp->num_serializer = pdata->num_serializer;
 #ifdef CONFIG_PM_SLEEP
-       mcasp->context.xrsr_regs = devm_kzalloc(&pdev->dev,
-                                       sizeof(u32) * mcasp->num_serializer,
+       mcasp->context.xrsr_regs = devm_kcalloc(&pdev->dev,
+                                       mcasp->num_serializer, sizeof(u32),
                                        GFP_KERNEL);
        if (!mcasp->context.xrsr_regs) {
                ret = -ENOMEM;
@@ -2004,13 +2004,15 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
         * bytes.
         */
        mcasp->chconstr[SNDRV_PCM_STREAM_PLAYBACK].list =
-               devm_kzalloc(mcasp->dev, sizeof(unsigned int) *
-                            (32 + mcasp->num_serializer - 1),
+               devm_kcalloc(mcasp->dev,
+                            32 + mcasp->num_serializer - 1,
+                            sizeof(unsigned int),
                             GFP_KERNEL);
 
        mcasp->chconstr[SNDRV_PCM_STREAM_CAPTURE].list =
-               devm_kzalloc(mcasp->dev, sizeof(unsigned int) *
-                            (32 + mcasp->num_serializer - 1),
+               devm_kcalloc(mcasp->dev,
+                            32 + mcasp->num_serializer - 1,
+                            sizeof(unsigned int),
                             GFP_KERNEL);
 
        if (!mcasp->chconstr[SNDRV_PCM_STREAM_PLAYBACK].list ||
index 1b6164249341138ec70ae38e57d48957c69c7ba1..d93bacacbd5b4d018b0633b24f71cee60bf756e3 100644 (file)
@@ -296,8 +296,8 @@ static int asoc_graph_card_probe(struct platform_device *pdev)
        if (num == 0)
                return -EINVAL;
 
-       dai_props = devm_kzalloc(dev, sizeof(*dai_props) * num, GFP_KERNEL);
-       dai_link  = devm_kzalloc(dev, sizeof(*dai_link)  * num, GFP_KERNEL);
+       dai_props = devm_kcalloc(dev, num, sizeof(*dai_props), GFP_KERNEL);
+       dai_link  = devm_kcalloc(dev, num, sizeof(*dai_link), GFP_KERNEL);
        if (!dai_props || !dai_link)
                return -ENOMEM;
 
index a967aa143d51864cb03e3c9f8fcb9c7ea72c8a51..095ef6426d4217ec91e001aee1f8b6997a821651 100644 (file)
@@ -348,8 +348,8 @@ static int asoc_graph_card_probe(struct platform_device *pdev)
        if (num == 0)
                return -EINVAL;
 
-       dai_props = devm_kzalloc(dev, sizeof(*dai_props) * num, GFP_KERNEL);
-       dai_link  = devm_kzalloc(dev, sizeof(*dai_link)  * num, GFP_KERNEL);
+       dai_props = devm_kcalloc(dev, num, sizeof(*dai_props), GFP_KERNEL);
+       dai_link  = devm_kcalloc(dev, num, sizeof(*dai_link), GFP_KERNEL);
        if (!dai_props || !dai_link)
                return -ENOMEM;
 
index 4a516c428b3df239b7af267f978af87619f5827c..8b374af86a6e26e7b0af5efa4e45d0fa84c14983 100644 (file)
@@ -340,8 +340,8 @@ static int asoc_simple_card_parse_aux_devs(struct device_node *node,
        if (n <= 0)
                return -EINVAL;
 
-       card->aux_dev = devm_kzalloc(dev,
-                       n * sizeof(*card->aux_dev), GFP_KERNEL);
+       card->aux_dev = devm_kcalloc(dev,
+                       n, sizeof(*card->aux_dev), GFP_KERNEL);
        if (!card->aux_dev)
                return -ENOMEM;
 
@@ -435,8 +435,8 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
        if (!priv)
                return -ENOMEM;
 
-       dai_props = devm_kzalloc(dev, sizeof(*dai_props) * num, GFP_KERNEL);
-       dai_link  = devm_kzalloc(dev, sizeof(*dai_link)  * num, GFP_KERNEL);
+       dai_props = devm_kcalloc(dev, num, sizeof(*dai_props), GFP_KERNEL);
+       dai_link  = devm_kcalloc(dev, num, sizeof(*dai_link), GFP_KERNEL);
        if (!dai_props || !dai_link)
                return -ENOMEM;
 
index 48606c63562a7694a83fe7b4d38210908d38ad4e..487716559deb6c58762f8c1441264366102387ae 100644 (file)
@@ -246,8 +246,8 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 
        num = of_get_child_count(np);
 
-       dai_props = devm_kzalloc(dev, sizeof(*dai_props) * num, GFP_KERNEL);
-       dai_link  = devm_kzalloc(dev, sizeof(*dai_link)  * num, GFP_KERNEL);
+       dai_props = devm_kcalloc(dev, num, sizeof(*dai_props), GFP_KERNEL);
+       dai_link  = devm_kcalloc(dev, num, sizeof(*dai_link), GFP_KERNEL);
        if (!dai_props || !dai_link)
                return -ENOMEM;
 
index d7fbb0a0a28b02f16d12ef89fef24f98b8dac6da..388cefd7340ab3a8932fe93b31c2cc60069326b7 100644 (file)
@@ -509,8 +509,8 @@ static int img_i2s_in_probe(struct platform_device *pdev)
 
        pm_runtime_put(&pdev->dev);
 
-       i2s->suspend_ch_ctl = devm_kzalloc(dev,
-               sizeof(*i2s->suspend_ch_ctl) * i2s->max_i2s_chan, GFP_KERNEL);
+       i2s->suspend_ch_ctl = devm_kcalloc(dev,
+               i2s->max_i2s_chan, sizeof(*i2s->suspend_ch_ctl), GFP_KERNEL);
        if (!i2s->suspend_ch_ctl) {
                ret = -ENOMEM;
                goto err_suspend;
index 30a95bcef2db97ebd9c2904c1caf697109309d30..fc2d1dac63339e84385ad3ffa8228e8259ad4817 100644 (file)
@@ -479,8 +479,8 @@ static int img_i2s_out_probe(struct platform_device *pdev)
                return PTR_ERR(i2s->clk_ref);
        }
 
-       i2s->suspend_ch_ctl = devm_kzalloc(dev,
-               sizeof(*i2s->suspend_ch_ctl) * i2s->max_i2s_chan, GFP_KERNEL);
+       i2s->suspend_ch_ctl = devm_kcalloc(dev,
+               i2s->max_i2s_chan, sizeof(*i2s->suspend_ch_ctl), GFP_KERNEL);
        if (!i2s->suspend_ch_ctl)
                return -ENOMEM;
 
index 2c5129782959730e471eae741528b9814f7e2068..fcdc716754b6349b4ec304c31a535748842b2dc9 100644 (file)
@@ -2428,8 +2428,10 @@ static int skl_tplg_get_token(struct device *dev,
 
        case SKL_TKN_U8_DYN_IN_PIN:
                if (!mconfig->m_in_pin)
-                       mconfig->m_in_pin = devm_kzalloc(dev, MAX_IN_QUEUE *
-                                       sizeof(*mconfig->m_in_pin), GFP_KERNEL);
+                       mconfig->m_in_pin =
+                               devm_kcalloc(dev, MAX_IN_QUEUE,
+                                            sizeof(*mconfig->m_in_pin),
+                                            GFP_KERNEL);
                if (!mconfig->m_in_pin)
                        return -ENOMEM;
 
@@ -2439,8 +2441,10 @@ static int skl_tplg_get_token(struct device *dev,
 
        case SKL_TKN_U8_DYN_OUT_PIN:
                if (!mconfig->m_out_pin)
-                       mconfig->m_out_pin = devm_kzalloc(dev, MAX_IN_QUEUE *
-                                       sizeof(*mconfig->m_in_pin), GFP_KERNEL);
+                       mconfig->m_out_pin =
+                               devm_kcalloc(dev, MAX_IN_QUEUE,
+                                            sizeof(*mconfig->m_in_pin),
+                                            GFP_KERNEL);
                if (!mconfig->m_out_pin)
                        return -ENOMEM;
 
@@ -2852,14 +2856,14 @@ static int skl_tplg_get_pvt_data_v4(struct snd_soc_tplg_dapm_widget *tplg_w,
        mconfig->time_slot = dfw->time_slot;
        mconfig->formats_config.caps_size = dfw->caps.caps_size;
 
-       mconfig->m_in_pin = devm_kzalloc(dev,
-                               MAX_IN_QUEUE * sizeof(*mconfig->m_in_pin),
+       mconfig->m_in_pin = devm_kcalloc(dev,
+                               MAX_IN_QUEUE, sizeof(*mconfig->m_in_pin),
                                GFP_KERNEL);
        if (!mconfig->m_in_pin)
                return -ENOMEM;
 
-       mconfig->m_out_pin = devm_kzalloc(dev,
-                               MAX_OUT_QUEUE * sizeof(*mconfig->m_out_pin),
+       mconfig->m_out_pin = devm_kcalloc(dev,
+                               MAX_OUT_QUEUE, sizeof(*mconfig->m_out_pin),
                                GFP_KERNEL);
        if (!mconfig->m_out_pin)
                return -ENOMEM;
index 828d11c30c6a20f39acda7db3406611a5f747665..968fba4d75339922c398f0fb4d56556e0b9a8e5f 100644 (file)
@@ -1347,7 +1347,8 @@ static int mt2701_afe_pcm_dev_probe(struct platform_device *pdev)
        afe->dev = &pdev->dev;
        dev = afe->dev;
 
-       afe_priv->i2s_path = devm_kzalloc(dev, afe_priv->soc->i2s_num *
+       afe_priv->i2s_path = devm_kcalloc(dev,
+                                         afe_priv->soc->i2s_num,
                                          sizeof(struct mt2701_i2s_path),
                                          GFP_KERNEL);
        if (!afe_priv->i2s_path)
index 7c998ea4ebee02bdd27354d034f90b22d596c035..12d4513ebe8af17ba22614053a27b2ad2dbe23ee 100644 (file)
@@ -425,8 +425,8 @@ static int asoc_mmp_sspa_probe(struct platform_device *pdev)
        if (priv->sspa == NULL)
                return -ENOMEM;
 
-       priv->dma_params = devm_kzalloc(&pdev->dev,
-                       2 * sizeof(struct snd_dmaengine_dai_dma_data),
+       priv->dma_params = devm_kcalloc(&pdev->dev,
+                       2, sizeof(struct snd_dmaengine_dai_dma_data),
                        GFP_KERNEL);
        if (priv->dma_params == NULL)
                return -ENOMEM;
index f184168f9a416191368ae19a3279826fb6831c7d..f2a51ae2b674d5a3107ab568bdc1842d6e746145 100644 (file)
@@ -462,7 +462,7 @@ static int rockchip_sound_of_parse_dais(struct device *dev,
        num_routes = 0;
        for (i = 0; i < ARRAY_SIZE(rockchip_routes); i++)
                num_routes += rockchip_routes[i].num_routes;
-       routes = devm_kzalloc(dev, num_routes * sizeof(*routes),
+       routes = devm_kcalloc(dev, num_routes, sizeof(*routes),
                              GFP_KERNEL);
        if (!routes)
                return -ENOMEM;
index 4221937ae79bab7b90d229afd15e77fe05eb7afe..5900fb535a2bf9f4f91d82e16a7a516b1d9506f5 100644 (file)
@@ -155,7 +155,7 @@ int rsnd_cmd_probe(struct rsnd_priv *priv)
        if (!nr)
                return 0;
 
-       cmd = devm_kzalloc(dev, sizeof(*cmd) * nr, GFP_KERNEL);
+       cmd = devm_kcalloc(dev, nr, sizeof(*cmd), GFP_KERNEL);
        if (!cmd)
                return -ENOMEM;
 
index af04d41a4274c85d79ba6ba64edb09b437235c56..f237002180c0c95dbd954cf408f8de56fb2555db 100644 (file)
@@ -1110,8 +1110,8 @@ static int rsnd_dai_probe(struct rsnd_priv *priv)
        if (!nr)
                return -EINVAL;
 
-       rdrv = devm_kzalloc(dev, sizeof(*rdrv) * nr, GFP_KERNEL);
-       rdai = devm_kzalloc(dev, sizeof(*rdai) * nr, GFP_KERNEL);
+       rdrv = devm_kcalloc(dev, nr, sizeof(*rdrv), GFP_KERNEL);
+       rdai = devm_kcalloc(dev, nr, sizeof(*rdai), GFP_KERNEL);
        if (!rdrv || !rdai)
                return -ENOMEM;
 
index d201d551866db10e3f6523d1bb30caa045df0e8a..83be7d3ae0a8390ad7eab05c4dd666708bf62b16 100644 (file)
@@ -378,7 +378,7 @@ int rsnd_ctu_probe(struct rsnd_priv *priv)
                goto rsnd_ctu_probe_done;
        }
 
-       ctu = devm_kzalloc(dev, sizeof(*ctu) * nr, GFP_KERNEL);
+       ctu = devm_kcalloc(dev, nr, sizeof(*ctu), GFP_KERNEL);
        if (!ctu) {
                ret = -ENOMEM;
                goto rsnd_ctu_probe_done;
index dbe54f024d68824fa0b3bd81122891989adb9faf..ca1780e0b8304afc0567585d002b965fc978682b 100644 (file)
@@ -344,7 +344,7 @@ int rsnd_dvc_probe(struct rsnd_priv *priv)
                goto rsnd_dvc_probe_done;
        }
 
-       dvc     = devm_kzalloc(dev, sizeof(*dvc) * nr, GFP_KERNEL);
+       dvc     = devm_kcalloc(dev, nr, sizeof(*dvc), GFP_KERNEL);
        if (!dvc) {
                ret = -ENOMEM;
                goto rsnd_dvc_probe_done;
index 7998380766f6f210accaa91bc50f3b3aaeea0bd0..1881b2de9126e3b6cc3218a5a067f32aa5b56868 100644 (file)
@@ -294,7 +294,7 @@ int rsnd_mix_probe(struct rsnd_priv *priv)
                goto rsnd_mix_probe_done;
        }
 
-       mix     = devm_kzalloc(dev, sizeof(*mix) * nr, GFP_KERNEL);
+       mix     = devm_kcalloc(dev, nr, sizeof(*mix), GFP_KERNEL);
        if (!mix) {
                ret = -ENOMEM;
                goto rsnd_mix_probe_done;
index a727e71587b6e305ff89011b1bce8dc2f5789bc8..6c72d1a81cf5e56237c9e3b4f34128316afdfd36 100644 (file)
@@ -575,7 +575,7 @@ int rsnd_src_probe(struct rsnd_priv *priv)
                goto rsnd_src_probe_done;
        }
 
-       src     = devm_kzalloc(dev, sizeof(*src) * nr, GFP_KERNEL);
+       src     = devm_kcalloc(dev, nr, sizeof(*src), GFP_KERNEL);
        if (!src) {
                ret = -ENOMEM;
                goto rsnd_src_probe_done;
index 9538f76f8e2067dd42f1507515388593462c43ad..6e1166ec24a0acbabd9dec1c08b6687261d7a3c7 100644 (file)
@@ -1116,7 +1116,7 @@ int rsnd_ssi_probe(struct rsnd_priv *priv)
                goto rsnd_ssi_probe_done;
        }
 
-       ssi     = devm_kzalloc(dev, sizeof(*ssi) * nr, GFP_KERNEL);
+       ssi     = devm_kcalloc(dev, nr, sizeof(*ssi), GFP_KERNEL);
        if (!ssi) {
                ret = -ENOMEM;
                goto rsnd_ssi_probe_done;
index 6ff8a36c2c82224da8ae88c94b317092ea87f88f..47bdba9fc58228878289f0f5b3b2245785812c6b 100644 (file)
@@ -258,7 +258,7 @@ int rsnd_ssiu_probe(struct rsnd_priv *priv)
 
        /* same number to SSI */
        nr      = priv->ssi_nr;
-       ssiu    = devm_kzalloc(dev, sizeof(*ssiu) * nr, GFP_KERNEL);
+       ssiu    = devm_kcalloc(dev, nr, sizeof(*ssiu), GFP_KERNEL);
        if (!ssiu)
                return -ENOMEM;
 
index 61542847cb3b7bbdfedb9abb39f75f6de79ccb1c..4663de3cf495278f42b2950a3474ee4afb293674 100644 (file)
@@ -3354,7 +3354,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
                return -EINVAL;
        }
 
-       routes = devm_kzalloc(card->dev, num_routes * sizeof(*routes),
+       routes = devm_kcalloc(card->dev, num_routes, sizeof(*routes),
                              GFP_KERNEL);
        if (!routes) {
                dev_err(card->dev,
@@ -3678,8 +3678,8 @@ int snd_soc_of_get_dai_link_codecs(struct device *dev,
                        dev_err(dev, "Bad phandle in 'sound-dai'\n");
                return num_codecs;
        }
-       component = devm_kzalloc(dev,
-                                sizeof *component * num_codecs,
+       component = devm_kcalloc(dev,
+                                num_codecs, sizeof(*component),
                                 GFP_KERNEL);
        if (!component)
                return -ENOMEM;
index 80daec17be258ac3d8e616c321dd91c36f3ababe..2d9b7dde2ffa1dbc4750eda9d2dc5557753bfdc4 100644 (file)
@@ -624,15 +624,17 @@ int uniphier_aio_probe(struct platform_device *pdev)
                return PTR_ERR(chip->rst);
 
        chip->num_aios = chip->chip_spec->num_dais;
-       chip->aios = devm_kzalloc(dev,
-                                 sizeof(struct uniphier_aio) * chip->num_aios,
+       chip->aios = devm_kcalloc(dev,
+                                 chip->num_aios, sizeof(struct uniphier_aio),
                                  GFP_KERNEL);
        if (!chip->aios)
                return -ENOMEM;
 
        chip->num_plls = chip->chip_spec->num_plls;
-       chip->plls = devm_kzalloc(dev, sizeof(struct uniphier_aio_pll) *
-                                 chip->num_plls, GFP_KERNEL);
+       chip->plls = devm_kcalloc(dev,
+                                 chip->num_plls,
+                                 sizeof(struct uniphier_aio_pll),
+                                 GFP_KERNEL);
        if (!chip->plls)
                return -ENOMEM;
        memcpy(chip->plls, chip->chip_spec->plls,