summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorKees Cook <kees@kernel.org>2026-02-20 23:49:23 -0800
committerKees Cook <kees@kernel.org>2026-02-21 01:02:28 -0800
commit69050f8d6d075dc01af7a5f2f550a8067510366f (patch)
treebb265f94d9dfa7876c06a5d9f88673d496a15341 /drivers/usb
parentd39a1d7486d98668dd34aaa6732aad7977c45f5a (diff)
downloadlwn-69050f8d6d075dc01af7a5f2f550a8067510366f.tar.gz
lwn-69050f8d6d075dc01af7a5f2f550a8067510366f.zip
treewide: Replace kmalloc with kmalloc_obj for non-scalar types
This is the result of running the Coccinelle script from scripts/coccinelle/api/kmalloc_objs.cocci. The script is designed to avoid scalar types (which need careful case-by-case checking), and instead replace kmalloc-family calls that allocate struct or union object instances: Single allocations: kmalloc(sizeof(TYPE), ...) are replaced with: kmalloc_obj(TYPE, ...) Array allocations: kmalloc_array(COUNT, sizeof(TYPE), ...) are replaced with: kmalloc_objs(TYPE, COUNT, ...) Flex array allocations: kmalloc(struct_size(PTR, FAM, COUNT), ...) are replaced with: kmalloc_flex(*PTR, FAM, COUNT, ...) (where TYPE may also be *VAR) The resulting allocations no longer return "void *", instead returning "TYPE *". Signed-off-by: Kees Cook <kees@kernel.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/atm/cxacru.c2
-rw-r--r--drivers/usb/atm/speedtch.c2
-rw-r--r--drivers/usb/atm/ueagle-atm.c2
-rw-r--r--drivers/usb/atm/usbatm.c2
-rw-r--r--drivers/usb/c67x00/c67x00-drv.c2
-rw-r--r--drivers/usb/c67x00/c67x00-sched.c6
-rw-r--r--drivers/usb/cdns3/cdns3-gadget.c6
-rw-r--r--drivers/usb/cdns3/cdns3-pci-wrap.c2
-rw-r--r--drivers/usb/cdns3/cdnsp-gadget.c4
-rw-r--r--drivers/usb/cdns3/cdnsp-mem.c9
-rw-r--r--drivers/usb/cdns3/cdnsp-pci.c2
-rw-r--r--drivers/usb/chipidea/udc.c6
-rw-r--r--drivers/usb/class/cdc-acm.c2
-rw-r--r--drivers/usb/class/cdc-wdm.c6
-rw-r--r--drivers/usb/class/usblp.c2
-rw-r--r--drivers/usb/class/usbtmc.c4
-rw-r--r--drivers/usb/common/ulpi.c2
-rw-r--r--drivers/usb/core/config.c6
-rw-r--r--drivers/usb/core/devio.c17
-rw-r--r--drivers/usb/core/driver.c2
-rw-r--r--drivers/usb/core/endpoint.c2
-rw-r--r--drivers/usb/core/hcd.c10
-rw-r--r--drivers/usb/core/hub.c16
-rw-r--r--drivers/usb/core/ledtrig-usbport.c4
-rw-r--r--drivers/usb/core/message.c16
-rw-r--r--drivers/usb/core/port.c4
-rw-r--r--drivers/usb/core/quirks.c3
-rw-r--r--drivers/usb/core/urb.c3
-rw-r--r--drivers/usb/core/usb.c2
-rw-r--r--drivers/usb/dwc2/gadget.c2
-rw-r--r--drivers/usb/dwc2/hcd.c6
-rw-r--r--drivers/usb/dwc2/hcd_queue.c2
-rw-r--r--drivers/usb/dwc3/debugfs.c2
-rw-r--r--drivers/usb/dwc3/gadget.c6
-rw-r--r--drivers/usb/fotg210/fotg210-hcd.c10
-rw-r--r--drivers/usb/fotg210/fotg210-udc.c6
-rw-r--r--drivers/usb/gadget/composite.c2
-rw-r--r--drivers/usb/gadget/configfs.c16
-rw-r--r--drivers/usb/gadget/function/f_acm.c4
-rw-r--r--drivers/usb/gadget/function/f_ecm.c4
-rw-r--r--drivers/usb/gadget/function/f_eem.c6
-rw-r--r--drivers/usb/gadget/function/f_fs.c24
-rw-r--r--drivers/usb/gadget/function/f_hid.c8
-rw-r--r--drivers/usb/gadget/function/f_loopback.c4
-rw-r--r--drivers/usb/gadget/function/f_mass_storage.c12
-rw-r--r--drivers/usb/gadget/function/f_midi.c9
-rw-r--r--drivers/usb/gadget/function/f_midi2.c16
-rw-r--r--drivers/usb/gadget/function/f_ncm.c2
-rw-r--r--drivers/usb/gadget/function/f_obex.c4
-rw-r--r--drivers/usb/gadget/function/f_phonet.c4
-rw-r--r--drivers/usb/gadget/function/f_printer.c4
-rw-r--r--drivers/usb/gadget/function/f_rndis.c6
-rw-r--r--drivers/usb/gadget/function/f_serial.c4
-rw-r--r--drivers/usb/gadget/function/f_sourcesink.c4
-rw-r--r--drivers/usb/gadget/function/f_subset.c4
-rw-r--r--drivers/usb/gadget/function/f_tcm.c12
-rw-r--r--drivers/usb/gadget/function/f_uac1.c6
-rw-r--r--drivers/usb/gadget/function/f_uac1_legacy.c6
-rw-r--r--drivers/usb/gadget/function/f_uac2.c6
-rw-r--r--drivers/usb/gadget/function/f_uvc.c4
-rw-r--r--drivers/usb/gadget/function/rndis.c2
-rw-r--r--drivers/usb/gadget/function/u_audio.c12
-rw-r--r--drivers/usb/gadget/function/u_serial.c4
-rw-r--r--drivers/usb/gadget/function/u_uac1_legacy.c2
-rw-r--r--drivers/usb/gadget/function/uvc_configfs.c28
-rw-r--r--drivers/usb/gadget/function/uvc_v4l2.c2
-rw-r--r--drivers/usb/gadget/function/uvc_video.c2
-rw-r--r--drivers/usb/gadget/legacy/dbgp.c2
-rw-r--r--drivers/usb/gadget/legacy/g_ffs.c4
-rw-r--r--drivers/usb/gadget/legacy/hid.c2
-rw-r--r--drivers/usb/gadget/legacy/inode.c8
-rw-r--r--drivers/usb/gadget/legacy/raw_gadget.c4
-rw-r--r--drivers/usb/gadget/udc/amd5536udc_pci.c2
-rw-r--r--drivers/usb/gadget/udc/aspeed-vhub/core.c2
-rw-r--r--drivers/usb/gadget/udc/aspeed-vhub/dev.c4
-rw-r--r--drivers/usb/gadget/udc/aspeed_udc.c2
-rw-r--r--drivers/usb/gadget/udc/at91_udc.c2
-rw-r--r--drivers/usb/gadget/udc/atmel_usba_udc.c4
-rw-r--r--drivers/usb/gadget/udc/bcm63xx_udc.c2
-rw-r--r--drivers/usb/gadget/udc/bdc/bdc_core.c4
-rw-r--r--drivers/usb/gadget/udc/bdc/bdc_ep.c11
-rw-r--r--drivers/usb/gadget/udc/cdns2/cdns2-gadget.c2
-rw-r--r--drivers/usb/gadget/udc/core.c2
-rw-r--r--drivers/usb/gadget/udc/dummy_hcd.c6
-rw-r--r--drivers/usb/gadget/udc/fsl_qe_udc.c8
-rw-r--r--drivers/usb/gadget/udc/fsl_udc_core.c6
-rw-r--r--drivers/usb/gadget/udc/goku_udc.c4
-rw-r--r--drivers/usb/gadget/udc/gr_udc.c2
-rw-r--r--drivers/usb/gadget/udc/lpc32xx_udc.c2
-rw-r--r--drivers/usb/gadget/udc/m66592-udc.c4
-rw-r--r--drivers/usb/gadget/udc/max3420_udc.c2
-rw-r--r--drivers/usb/gadget/udc/net2280.c4
-rw-r--r--drivers/usb/gadget/udc/omap_udc.c4
-rw-r--r--drivers/usb/gadget/udc/pch_udc.c2
-rw-r--r--drivers/usb/gadget/udc/pxa25x_udc.c2
-rw-r--r--drivers/usb/gadget/udc/pxa27x_udc.c2
-rw-r--r--drivers/usb/gadget/udc/r8a66597-udc.c2
-rw-r--r--drivers/usb/gadget/udc/renesas_usb3.c2
-rw-r--r--drivers/usb/gadget/udc/renesas_usbf.c2
-rw-r--r--drivers/usb/gadget/udc/snps_udc_core.c2
-rw-r--r--drivers/usb/gadget/udc/tegra-xudc.c2
-rw-r--r--drivers/usb/gadget/udc/udc-xilinx.c2
-rw-r--r--drivers/usb/host/ehci-dbg.c4
-rw-r--r--drivers/usb/host/ehci-mem.c2
-rw-r--r--drivers/usb/host/ehci-sched.c11
-rw-r--r--drivers/usb/host/fhci-hcd.c16
-rw-r--r--drivers/usb/host/fhci-mem.c4
-rw-r--r--drivers/usb/host/fhci-tds.c4
-rw-r--r--drivers/usb/host/isp116x-hcd.c2
-rw-r--r--drivers/usb/host/max3421-hcd.c6
-rw-r--r--drivers/usb/host/octeon-hcd.c9
-rw-r--r--drivers/usb/host/ohci-dbg.c4
-rw-r--r--drivers/usb/host/ohci-hcd.c2
-rw-r--r--drivers/usb/host/oxu210hp-hcd.c2
-rw-r--r--drivers/usb/host/r8a66597-hcd.c7
-rw-r--r--drivers/usb/host/sl811-hcd.c2
-rw-r--r--drivers/usb/host/sl811_cs.c2
-rw-r--r--drivers/usb/host/uhci-debug.c2
-rw-r--r--drivers/usb/host/uhci-hcd.c4
-rw-r--r--drivers/usb/host/xhci-dbgcap.c10
-rw-r--r--drivers/usb/host/xhci-dbgtty.c2
-rw-r--r--drivers/usb/host/xhci-debugfs.c6
-rw-r--r--drivers/usb/host/xhci-mem.c2
-rw-r--r--drivers/usb/host/xhci-mtk-sch.c10
-rw-r--r--drivers/usb/host/xhci-sideband.c4
-rw-r--r--drivers/usb/host/xhci.c2
-rw-r--r--drivers/usb/image/mdc800.c2
-rw-r--r--drivers/usb/image/microtek.c2
-rw-r--r--drivers/usb/isp1760/isp1760-hcd.c8
-rw-r--r--drivers/usb/isp1760/isp1760-udc.c2
-rw-r--r--drivers/usb/misc/adutux.c2
-rw-r--r--drivers/usb/misc/apple-mfi-fastcharge.c2
-rw-r--r--drivers/usb/misc/appledisplay.c2
-rw-r--r--drivers/usb/misc/chaoskey.c2
-rw-r--r--drivers/usb/misc/cypress_cy7c63.c2
-rw-r--r--drivers/usb/misc/cytherm.c2
-rw-r--r--drivers/usb/misc/idmouse.c2
-rw-r--r--drivers/usb/misc/iowarrior.c2
-rw-r--r--drivers/usb/misc/ldusb.c2
-rw-r--r--drivers/usb/misc/legousbtower.c2
-rw-r--r--drivers/usb/misc/lvstest.c2
-rw-r--r--drivers/usb/misc/onboard_usb_dev.c2
-rw-r--r--drivers/usb/misc/onboard_usb_dev_pdevs.c2
-rw-r--r--drivers/usb/misc/sisusbvga/sisusbvga.c2
-rw-r--r--drivers/usb/misc/trancevibrator.c2
-rw-r--r--drivers/usb/misc/usb-ljca.c8
-rw-r--r--drivers/usb/misc/usbio.c2
-rw-r--r--drivers/usb/misc/usblcd.c2
-rw-r--r--drivers/usb/misc/usbsevseg.c2
-rw-r--r--drivers/usb/misc/usbtest.c12
-rw-r--r--drivers/usb/misc/uss720.c6
-rw-r--r--drivers/usb/misc/yurex.c2
-rw-r--r--drivers/usb/mon/mon_bin.c6
-rw-r--r--drivers/usb/mon/mon_main.c2
-rw-r--r--drivers/usb/mon/mon_stat.c2
-rw-r--r--drivers/usb/mon/mon_text.c2
-rw-r--r--drivers/usb/mtu3/mtu3_core.c2
-rw-r--r--drivers/usb/mtu3/mtu3_gadget.c2
-rw-r--r--drivers/usb/musb/musb_cppi41.c2
-rw-r--r--drivers/usb/musb/musb_gadget.c2
-rw-r--r--drivers/usb/musb/musb_host.c2
-rw-r--r--drivers/usb/musb/musbhsdma.c2
-rw-r--r--drivers/usb/musb/tusb6010_omap.c6
-rw-r--r--drivers/usb/musb/ux500_dma.c2
-rw-r--r--drivers/usb/phy/phy-fsl-usb.c4
-rw-r--r--drivers/usb/phy/phy-fsl-usb.h2
-rw-r--r--drivers/usb/renesas_usbhs/mod_gadget.c8
-rw-r--r--drivers/usb/renesas_usbhs/mod_host.c4
-rw-r--r--drivers/usb/renesas_usbhs/pipe.c3
-rw-r--r--drivers/usb/roles/class.c2
-rw-r--r--drivers/usb/serial/ark3116.c2
-rw-r--r--drivers/usb/serial/belkin_sa.c2
-rw-r--r--drivers/usb/serial/ch341.c2
-rw-r--r--drivers/usb/serial/console.c2
-rw-r--r--drivers/usb/serial/cp210x.c4
-rw-r--r--drivers/usb/serial/cyberjack.c2
-rw-r--r--drivers/usb/serial/cypress_m8.c2
-rw-r--r--drivers/usb/serial/digi_acceleport.c4
-rw-r--r--drivers/usb/serial/ftdi_sio.c2
-rw-r--r--drivers/usb/serial/garmin_gps.c4
-rw-r--r--drivers/usb/serial/io_edgeport.c6
-rw-r--r--drivers/usb/serial/io_ti.c23
-rw-r--r--drivers/usb/serial/ipw.c2
-rw-r--r--drivers/usb/serial/ir-usb.c2
-rw-r--r--drivers/usb/serial/iuu_phoenix.c2
-rw-r--r--drivers/usb/serial/keyspan.c4
-rw-r--r--drivers/usb/serial/keyspan_pda.c2
-rw-r--r--drivers/usb/serial/kl5kusb105.c4
-rw-r--r--drivers/usb/serial/kobil_sct.c2
-rw-r--r--drivers/usb/serial/mct_u232.c2
-rw-r--r--drivers/usb/serial/metro-usb.c2
-rw-r--r--drivers/usb/serial/mos7720.c4
-rw-r--r--drivers/usb/serial/mos7840.c6
-rw-r--r--drivers/usb/serial/omninet.c2
-rw-r--r--drivers/usb/serial/opticon.c4
-rw-r--r--drivers/usb/serial/option.c2
-rw-r--r--drivers/usb/serial/oti6858.c2
-rw-r--r--drivers/usb/serial/pl2303.c4
-rw-r--r--drivers/usb/serial/qcserial.c2
-rw-r--r--drivers/usb/serial/quatech2.c4
-rw-r--r--drivers/usb/serial/sierra.c4
-rw-r--r--drivers/usb/serial/spcp8x5.c2
-rw-r--r--drivers/usb/serial/ssu100.c2
-rw-r--r--drivers/usb/serial/symbolserial.c2
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c6
-rw-r--r--drivers/usb/serial/upd78f0730.c2
-rw-r--r--drivers/usb/serial/usb-serial.c8
-rw-r--r--drivers/usb/serial/usb_wwan.c2
-rw-r--r--drivers/usb/serial/whiteheat.c5
-rw-r--r--drivers/usb/serial/xr_serial.c4
-rw-r--r--drivers/usb/storage/alauda.c2
-rw-r--r--drivers/usb/storage/datafab.c2
-rw-r--r--drivers/usb/storage/ene_ub6250.c8
-rw-r--r--drivers/usb/storage/isd200.c2
-rw-r--r--drivers/usb/storage/jumpshot.c2
-rw-r--r--drivers/usb/storage/karma.c2
-rw-r--r--drivers/usb/storage/onetouch.c2
-rw-r--r--drivers/usb/storage/realtek_cr.c2
-rw-r--r--drivers/usb/storage/sddr09.c6
-rw-r--r--drivers/usb/storage/sddr55.c7
-rw-r--r--drivers/usb/storage/shuttle_usbat.c2
-rw-r--r--drivers/usb/storage/sierra_ms.c5
-rw-r--r--drivers/usb/storage/uas.c2
-rw-r--r--drivers/usb/storage/usb.c2
-rw-r--r--drivers/usb/typec/class.c10
-rw-r--r--drivers/usb/typec/mode_selection.c4
-rw-r--r--drivers/usb/typec/mux.c8
-rw-r--r--drivers/usb/typec/pd.c6
-rw-r--r--drivers/usb/typec/retimer.c2
-rw-r--r--drivers/usb/typec/tcpm/tcpm.c4
-rw-r--r--drivers/usb/typec/ucsi/debugfs.c2
-rw-r--r--drivers/usb/typec/ucsi/ucsi.c7
-rw-r--r--drivers/usb/usb-skeleton.c2
-rw-r--r--drivers/usb/usbip/stub_dev.c2
-rw-r--r--drivers/usb/usbip/stub_rx.c2
-rw-r--r--drivers/usb/usbip/stub_tx.c4
-rw-r--r--drivers/usb/usbip/usbip_event.c2
-rw-r--r--drivers/usb/usbip/vhci_hcd.c6
-rw-r--r--drivers/usb/usbip/vhci_sysfs.c8
-rw-r--r--drivers/usb/usbip/vhci_tx.c2
-rw-r--r--drivers/usb/usbip/vudc_dev.c10
-rw-r--r--drivers/usb/usbip/vudc_tx.c8
242 files changed, 517 insertions, 534 deletions
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c
index 68a8e9de8b4f..909fdb56c09a 100644
--- a/drivers/usb/atm/cxacru.c
+++ b/drivers/usb/atm/cxacru.c
@@ -1130,7 +1130,7 @@ static int cxacru_bind(struct usbatm_data *usbatm_instance,
int ret;
/* instance init */
- instance = kzalloc(sizeof(*instance), GFP_KERNEL);
+ instance = kzalloc_obj(*instance, GFP_KERNEL);
if (!instance)
return -ENOMEM;
diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c
index e6b610a87482..d0a2f1361a91 100644
--- a/drivers/usb/atm/speedtch.c
+++ b/drivers/usb/atm/speedtch.c
@@ -804,7 +804,7 @@ static int speedtch_bind(struct usbatm_data *usbatm,
}
}
- instance = kzalloc(sizeof(*instance), GFP_KERNEL);
+ instance = kzalloc_obj(*instance, GFP_KERNEL);
if (!instance) {
ret = -ENOMEM;
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
index 78a2585f33ec..b27a5f8842b6 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -2516,7 +2516,7 @@ static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf,
return ret;
}
- sc = kzalloc(sizeof(struct uea_softc), GFP_KERNEL);
+ sc = kzalloc_obj(struct uea_softc, GFP_KERNEL);
if (!sc)
return -ENOMEM;
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c
index 5f3ad9a99d9e..aa4c209cfb91 100644
--- a/drivers/usb/atm/usbatm.c
+++ b/drivers/usb/atm/usbatm.c
@@ -804,7 +804,7 @@ static int usbatm_atm_open(struct atm_vcc *vcc)
goto fail;
}
- new = kzalloc(sizeof(struct usbatm_vcc_data), GFP_KERNEL);
+ new = kzalloc_obj(struct usbatm_vcc_data, GFP_KERNEL);
if (!new) {
ret = -ENOMEM;
goto fail;
diff --git a/drivers/usb/c67x00/c67x00-drv.c b/drivers/usb/c67x00/c67x00-drv.c
index 8f38e2c5369a..6b6814c1d557 100644
--- a/drivers/usb/c67x00/c67x00-drv.c
+++ b/drivers/usb/c67x00/c67x00-drv.c
@@ -121,7 +121,7 @@ static int c67x00_drv_probe(struct platform_device *pdev)
if (!pdata)
return -ENODEV;
- c67x00 = kzalloc(sizeof(*c67x00), GFP_KERNEL);
+ c67x00 = kzalloc_obj(*c67x00, GFP_KERNEL);
if (!c67x00)
return -ENOMEM;
diff --git a/drivers/usb/c67x00/c67x00-sched.c b/drivers/usb/c67x00/c67x00-sched.c
index a09fa68a6ce7..a832f5696f2a 100644
--- a/drivers/usb/c67x00/c67x00-sched.c
+++ b/drivers/usb/c67x00/c67x00-sched.c
@@ -246,7 +246,7 @@ c67x00_ep_data_alloc(struct c67x00_hcd *c67x00, struct urb *urb)
}
/* Allocate and initialize a new c67x00 endpoint data structure */
- ep_data = kzalloc(sizeof(*ep_data), GFP_ATOMIC);
+ ep_data = kzalloc_obj(*ep_data, GFP_ATOMIC);
if (!ep_data)
return NULL;
@@ -349,7 +349,7 @@ int c67x00_urb_enqueue(struct usb_hcd *hcd,
int port = get_root_port(urb->dev)-1;
/* Allocate and initialize urb private data */
- urbp = kzalloc(sizeof(*urbp), mem_flags);
+ urbp = kzalloc_obj(*urbp, mem_flags);
if (!urbp) {
ret = -ENOMEM;
goto err_urbp;
@@ -574,7 +574,7 @@ static int c67x00_create_td(struct c67x00_hcd *c67x00, struct urb *urb,
|| usb_pipeint(urb->pipe)))
return -EMSGSIZE; /* Not really an error, but expected */
- td = kzalloc(sizeof(*td), GFP_ATOMIC);
+ td = kzalloc_obj(*td, GFP_ATOMIC);
if (!td)
return -ENOMEM;
diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c
index 168707213ed9..15b0060ce62d 100644
--- a/drivers/usb/cdns3/cdns3-gadget.c
+++ b/drivers/usb/cdns3/cdns3-gadget.c
@@ -903,7 +903,7 @@ static int cdns3_prepare_aligned_request_buf(struct cdns3_request *priv_req)
buf = priv_req->aligned_buf;
if (!buf || priv_req->request.length > buf->size) {
- buf = kzalloc(sizeof(*buf), GFP_ATOMIC);
+ buf = kzalloc_obj(*buf, GFP_ATOMIC);
if (!buf)
return -ENOMEM;
@@ -2315,7 +2315,7 @@ struct usb_request *cdns3_gadget_ep_alloc_request(struct usb_ep *ep,
struct cdns3_endpoint *priv_ep = ep_to_cdns3_ep(ep);
struct cdns3_request *priv_req;
- priv_req = kzalloc(sizeof(*priv_req), gfp_flags);
+ priv_req = kzalloc_obj(*priv_req, gfp_flags);
if (!priv_req)
return NULL;
@@ -3287,7 +3287,7 @@ static int cdns3_gadget_start(struct cdns *cdns)
u32 max_speed;
int ret;
- priv_dev = kzalloc(sizeof(*priv_dev), GFP_KERNEL);
+ priv_dev = kzalloc_obj(*priv_dev, GFP_KERNEL);
if (!priv_dev)
return -ENOMEM;
diff --git a/drivers/usb/cdns3/cdns3-pci-wrap.c b/drivers/usb/cdns3/cdns3-pci-wrap.c
index 57f57c24c663..03c9762ad032 100644
--- a/drivers/usb/cdns3/cdns3-pci-wrap.c
+++ b/drivers/usb/cdns3/cdns3-pci-wrap.c
@@ -97,7 +97,7 @@ static int cdns3_pci_probe(struct pci_dev *pdev,
if (pci_is_enabled(func)) {
wrap = pci_get_drvdata(func);
} else {
- wrap = kzalloc(sizeof(*wrap), GFP_KERNEL);
+ wrap = kzalloc_obj(*wrap, GFP_KERNEL);
if (!wrap)
return -ENOMEM;
}
diff --git a/drivers/usb/cdns3/cdnsp-gadget.c b/drivers/usb/cdns3/cdnsp-gadget.c
index d37c29a253dd..475ac61ad4c4 100644
--- a/drivers/usb/cdns3/cdnsp-gadget.c
+++ b/drivers/usb/cdns3/cdnsp-gadget.c
@@ -1102,7 +1102,7 @@ static struct usb_request *cdnsp_gadget_ep_alloc_request(struct usb_ep *ep,
struct cdnsp_ep *pep = to_cdnsp_ep(ep);
struct cdnsp_request *preq;
- preq = kzalloc(sizeof(*preq), gfp_flags);
+ preq = kzalloc_obj(*preq, gfp_flags);
if (!preq)
return NULL;
@@ -1905,7 +1905,7 @@ static int __cdnsp_gadget_init(struct cdns *cdns)
cdns_drd_gadget_on(cdns);
- pdev = kzalloc(sizeof(*pdev), GFP_KERNEL);
+ pdev = kzalloc_obj(*pdev, GFP_KERNEL);
if (!pdev)
return -ENOMEM;
diff --git a/drivers/usb/cdns3/cdnsp-mem.c b/drivers/usb/cdns3/cdnsp-mem.c
index 97866bfb2da9..a2a1b21f2ef8 100644
--- a/drivers/usb/cdns3/cdnsp-mem.c
+++ b/drivers/usb/cdns3/cdnsp-mem.c
@@ -35,7 +35,7 @@ static struct cdnsp_segment *cdnsp_segment_alloc(struct cdnsp_device *pdev,
dma_addr_t dma;
int i;
- seg = kzalloc(sizeof(*seg), flags);
+ seg = kzalloc_obj(*seg, flags);
if (!seg)
return NULL;
@@ -376,7 +376,7 @@ static struct cdnsp_ring *cdnsp_ring_alloc(struct cdnsp_device *pdev,
struct cdnsp_ring *ring;
int ret;
- ring = kzalloc(sizeof *(ring), flags);
+ ring = kzalloc_obj(*(ring), flags);
if (!ring)
return NULL;
@@ -575,9 +575,8 @@ int cdnsp_alloc_stream_info(struct cdnsp_device *pdev,
stream_info->num_stream_ctxs = num_stream_ctxs;
/* Initialize the array of virtual pointers to stream rings. */
- stream_info->stream_rings = kcalloc(num_streams,
- sizeof(struct cdnsp_ring *),
- GFP_ATOMIC);
+ stream_info->stream_rings = kzalloc_objs(struct cdnsp_ring *,
+ num_streams, GFP_ATOMIC);
if (!stream_info->stream_rings)
return -ENOMEM;
diff --git a/drivers/usb/cdns3/cdnsp-pci.c b/drivers/usb/cdns3/cdnsp-pci.c
index 5e7b88ca8b96..b6199f98ff77 100644
--- a/drivers/usb/cdns3/cdnsp-pci.c
+++ b/drivers/usb/cdns3/cdnsp-pci.c
@@ -82,7 +82,7 @@ static int cdnsp_pci_probe(struct pci_dev *pdev,
if (pci_is_enabled(func)) {
cdnsp = pci_get_drvdata(func);
} else {
- cdnsp = kzalloc(sizeof(*cdnsp), GFP_KERNEL);
+ cdnsp = kzalloc_obj(*cdnsp, GFP_KERNEL);
if (!cdnsp) {
ret = -ENOMEM;
goto put_pci;
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index c8d931d9d433..f2de86d0ce40 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -360,8 +360,8 @@ static int add_td_to_list(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq,
{
int i;
u32 temp;
- struct td_node *lastnode, *node = kzalloc(sizeof(struct td_node),
- GFP_ATOMIC);
+ struct td_node *lastnode, *node = kzalloc_obj(struct td_node,
+ GFP_ATOMIC);
if (node == NULL)
return -ENOMEM;
@@ -1645,7 +1645,7 @@ static struct usb_request *ep_alloc_request(struct usb_ep *ep, gfp_t gfp_flags)
if (ep == NULL)
return NULL;
- hwreq = kzalloc(sizeof(struct ci_hw_req), gfp_flags);
+ hwreq = kzalloc_obj(struct ci_hw_req, gfp_flags);
if (hwreq != NULL) {
INIT_LIST_HEAD(&hwreq->queue);
INIT_LIST_HEAD(&hwreq->tds);
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 54be4aa1dcb2..8816c6eaba1d 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1350,7 +1350,7 @@ skip_normal_probe:
made_compressed_probe:
dev_dbg(&intf->dev, "interfaces are valid\n");
- acm = kzalloc(sizeof(struct acm), GFP_KERNEL);
+ acm = kzalloc_obj(struct acm, GFP_KERNEL);
if (!acm)
return -ENOMEM;
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
index ecd6d1f39e49..28fc93e0c01d 100644
--- a/drivers/usb/class/cdc-wdm.c
+++ b/drivers/usb/class/cdc-wdm.c
@@ -1027,7 +1027,7 @@ static int wdm_create(struct usb_interface *intf, struct usb_endpoint_descriptor
int rv = -ENOMEM;
struct wdm_device *desc;
- desc = kzalloc(sizeof(struct wdm_device), GFP_KERNEL);
+ desc = kzalloc_obj(struct wdm_device, GFP_KERNEL);
if (!desc)
goto out;
INIT_LIST_HEAD(&desc->device_list);
@@ -1050,10 +1050,10 @@ static int wdm_create(struct usb_interface *intf, struct usb_endpoint_descriptor
desc->wMaxPacketSize = usb_endpoint_maxp(ep);
- desc->orq = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL);
+ desc->orq = kmalloc_obj(struct usb_ctrlrequest, GFP_KERNEL);
if (!desc->orq)
goto err;
- desc->irq = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL);
+ desc->irq = kmalloc_obj(struct usb_ctrlrequest, GFP_KERNEL);
if (!desc->irq)
goto err;
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index a7a1d38b6bef..653583dc7a8d 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -1142,7 +1142,7 @@ static int usblp_probe(struct usb_interface *intf,
/* Malloc and start initializing usblp structure so we can use it
* directly. */
- usblp = kzalloc(sizeof(struct usblp), GFP_KERNEL);
+ usblp = kzalloc_obj(struct usblp, GFP_KERNEL);
if (!usblp) {
retval = -ENOMEM;
goto abort_ret;
diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index 206f1b738ed3..20bc86367660 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -172,7 +172,7 @@ static int usbtmc_open(struct inode *inode, struct file *filp)
return -ENODEV;
}
- file_data = kzalloc(sizeof(*file_data), GFP_KERNEL);
+ file_data = kzalloc_obj(*file_data, GFP_KERNEL);
if (!file_data)
return -ENOMEM;
@@ -2378,7 +2378,7 @@ static int usbtmc_probe(struct usb_interface *intf,
dev_dbg(&intf->dev, "%s called\n", __func__);
- data = kzalloc(sizeof(*data), GFP_KERNEL);
+ data = kzalloc_obj(*data, GFP_KERNEL);
if (!data)
return -ENOMEM;
diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c
index 4a2ee447b213..2f414b7c3e2c 100644
--- a/drivers/usb/common/ulpi.c
+++ b/drivers/usb/common/ulpi.c
@@ -324,7 +324,7 @@ struct ulpi *ulpi_register_interface(struct device *dev,
struct ulpi *ulpi;
int ret;
- ulpi = kzalloc(sizeof(*ulpi), GFP_KERNEL);
+ ulpi = kzalloc_obj(*ulpi, GFP_KERNEL);
if (!ulpi)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
index 2bb1ceb9d621..129cbfd74f26 100644
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -823,7 +823,7 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx,
nalts[i] = j = USB_MAXALTSETTING;
}
- intfc = kzalloc(struct_size(intfc, altsetting, j), GFP_KERNEL);
+ intfc = kzalloc_flex(*intfc, altsetting, j, GFP_KERNEL);
config->intf_cache[i] = intfc;
if (!intfc)
return -ENOMEM;
@@ -1045,7 +1045,7 @@ int usb_get_bos_descriptor(struct usb_device *dev)
return -ENOMSG;
}
- bos = kzalloc(sizeof(*bos), GFP_KERNEL);
+ bos = kzalloc_obj(*bos, GFP_KERNEL);
if (!bos)
return -ENOMEM;
@@ -1066,7 +1066,7 @@ int usb_get_bos_descriptor(struct usb_device *dev)
if (total_len < length)
return -EINVAL;
- dev->bos = kzalloc(sizeof(*dev->bos), GFP_KERNEL);
+ dev->bos = kzalloc_obj(*dev->bos, GFP_KERNEL);
if (!dev->bos)
return -ENOMEM;
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index f6ce6e26e0d4..d7ac181454f9 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -245,7 +245,7 @@ static int usbdev_mmap(struct file *file, struct vm_area_struct *vma)
if (ret)
goto error;
- usbm = kzalloc(sizeof(struct usb_memory), GFP_KERNEL);
+ usbm = kzalloc_obj(struct usb_memory, GFP_KERNEL);
if (!usbm) {
ret = -ENOMEM;
goto error_decrease_mem;
@@ -402,7 +402,7 @@ static struct async *alloc_async(unsigned int numisoframes)
{
struct async *as;
- as = kzalloc(sizeof(struct async), GFP_KERNEL);
+ as = kzalloc_obj(struct async, GFP_KERNEL);
if (!as)
return NULL;
as->urb = usb_alloc_urb(numisoframes, GFP_KERNEL);
@@ -970,7 +970,7 @@ static int parse_usbdevfs_streams(struct usb_dev_state *ps,
if (num_streams_ret && (num_streams < 2 || num_streams > 65536))
return -EINVAL;
- eps = kmalloc_array(num_eps, sizeof(*eps), GFP_KERNEL);
+ eps = kmalloc_objs(*eps, num_eps, GFP_KERNEL);
if (!eps)
return -ENOMEM;
@@ -1039,7 +1039,7 @@ static int usbdev_open(struct inode *inode, struct file *file)
int ret;
ret = -ENOMEM;
- ps = kzalloc(sizeof(struct usb_dev_state), GFP_KERNEL);
+ ps = kzalloc_obj(struct usb_dev_state, GFP_KERNEL);
if (!ps)
goto out_free_ps;
@@ -1196,7 +1196,7 @@ static int do_proc_control(struct usb_dev_state *ps,
urb = usb_alloc_urb(0, GFP_NOIO);
if (!urb)
goto done;
- dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_NOIO);
+ dr = kmalloc_obj(struct usb_ctrlrequest, GFP_NOIO);
if (!dr)
goto done;
@@ -1670,7 +1670,7 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb
/* min 8 byte setup packet */
if (uurb->buffer_length < 8)
return -EINVAL;
- dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL);
+ dr = kmalloc_obj(struct usb_ctrlrequest, GFP_KERNEL);
if (!dr)
return -ENOMEM;
if (copy_from_user(dr, uurb->buffer, 8)) {
@@ -1805,9 +1805,8 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb
as->mem_usage = u;
if (num_sgs) {
- as->urb->sg = kmalloc_array(num_sgs,
- sizeof(struct scatterlist),
- GFP_KERNEL | __GFP_NOWARN);
+ as->urb->sg = kmalloc_objs(struct scatterlist, num_sgs,
+ GFP_KERNEL | __GFP_NOWARN);
if (!as->urb->sg) {
ret = -ENOMEM;
goto error;
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 2f5958bc4f7f..db67874879d8 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -57,7 +57,7 @@ ssize_t usb_store_new_id(struct usb_dynids *dynids,
if (fields < 2)
return -EINVAL;
- dynid = kzalloc(sizeof(*dynid), GFP_KERNEL);
+ dynid = kzalloc_obj(*dynid, GFP_KERNEL);
if (!dynid)
return -ENOMEM;
diff --git a/drivers/usb/core/endpoint.c b/drivers/usb/core/endpoint.c
index e48399401608..f44f0fffeb41 100644
--- a/drivers/usb/core/endpoint.c
+++ b/drivers/usb/core/endpoint.c
@@ -154,7 +154,7 @@ int usb_create_ep_devs(struct device *parent,
struct ep_device *ep_dev;
int retval;
- ep_dev = kzalloc(sizeof(*ep_dev), GFP_KERNEL);
+ ep_dev = kzalloc_obj(*ep_dev, GFP_KERNEL);
if (!ep_dev) {
retval = -ENOMEM;
goto exit;
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 2d99a59d9f3f..f1b2b0e4c437 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2193,7 +2193,7 @@ int ehset_single_step_set_feature(struct usb_hcd *hcd, int port)
if (!buf)
return -ENOMEM;
- dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL);
+ dr = kmalloc_obj(struct usb_ctrlrequest, GFP_KERNEL);
if (!dr) {
kfree(buf);
return -ENOMEM;
@@ -2567,16 +2567,16 @@ struct usb_hcd *__usb_create_hcd(const struct hc_driver *driver,
if (!hcd)
return NULL;
if (primary_hcd == NULL) {
- hcd->address0_mutex = kmalloc(sizeof(*hcd->address0_mutex),
- GFP_KERNEL);
+ hcd->address0_mutex = kmalloc_obj(*hcd->address0_mutex,
+ GFP_KERNEL);
if (!hcd->address0_mutex) {
kfree(hcd);
dev_dbg(dev, "hcd address0 mutex alloc failed\n");
return NULL;
}
mutex_init(hcd->address0_mutex);
- hcd->bandwidth_mutex = kmalloc(sizeof(*hcd->bandwidth_mutex),
- GFP_KERNEL);
+ hcd->bandwidth_mutex = kmalloc_obj(*hcd->bandwidth_mutex,
+ GFP_KERNEL);
if (!hcd->bandwidth_mutex) {
kfree(hcd->address0_mutex);
kfree(hcd);
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index be50d03034a9..22a54c632c26 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -929,7 +929,7 @@ int usb_hub_clear_tt_buffer(struct urb *urb)
* since each TT has "at least two" buffers that can need it (and
* there can be many TTs per hub). even if they're uncommon.
*/
- clear = kmalloc(sizeof *clear, GFP_ATOMIC);
+ clear = kmalloc_obj(*clear, GFP_ATOMIC);
if (clear == NULL) {
dev_err(&udev->dev, "can't save CLEAR_TT_BUFFER state\n");
/* FIXME recover somehow ... RESET_TT? */
@@ -1461,20 +1461,20 @@ static int hub_configure(struct usb_hub *hub,
unsigned full_load;
unsigned maxchild;
- hub->buffer = kmalloc(sizeof(*hub->buffer), GFP_KERNEL);
+ hub->buffer = kmalloc_obj(*hub->buffer, GFP_KERNEL);
if (!hub->buffer) {
ret = -ENOMEM;
goto fail;
}
- hub->status = kmalloc(sizeof(*hub->status), GFP_KERNEL);
+ hub->status = kmalloc_obj(*hub->status, GFP_KERNEL);
if (!hub->status) {
ret = -ENOMEM;
goto fail;
}
mutex_init(&hub->status_mutex);
- hub->descriptor = kzalloc(sizeof(*hub->descriptor), GFP_KERNEL);
+ hub->descriptor = kzalloc_obj(*hub->descriptor, GFP_KERNEL);
if (!hub->descriptor) {
ret = -ENOMEM;
goto fail;
@@ -1522,7 +1522,7 @@ static int hub_configure(struct usb_hub *hub,
dev_info(hub_dev, "%d port%s detected\n", maxchild,
str_plural(maxchild));
- hub->ports = kcalloc(maxchild, sizeof(struct usb_port *), GFP_KERNEL);
+ hub->ports = kzalloc_objs(struct usb_port *, maxchild, GFP_KERNEL);
if (!hub->ports) {
ret = -ENOMEM;
goto fail;
@@ -1958,7 +1958,7 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
/* We found a hub */
dev_info(&intf->dev, "USB hub found\n");
- hub = kzalloc(sizeof(*hub), GFP_KERNEL);
+ hub = kzalloc_obj(*hub, GFP_KERNEL);
if (!hub)
return -ENOMEM;
@@ -4142,7 +4142,7 @@ static int usb_req_set_sel(struct usb_device *udev)
* which may be initiated by an error path of a mass storage driver.
* Therefore, use GFP_NOIO.
*/
- sel_values = kmalloc(sizeof *(sel_values), GFP_NOIO);
+ sel_values = kmalloc_obj(*(sel_values), GFP_NOIO);
if (!sel_values)
return -ENOMEM;
@@ -5236,7 +5236,7 @@ check_highspeed(struct usb_hub *hub, struct usb_device *udev, int port1)
if (udev->quirks & USB_QUIRK_DEVICE_QUALIFIER)
return;
- qual = kmalloc(sizeof *qual, GFP_KERNEL);
+ qual = kmalloc_obj(*qual, GFP_KERNEL);
if (qual == NULL)
return;
diff --git a/drivers/usb/core/ledtrig-usbport.c b/drivers/usb/core/ledtrig-usbport.c
index 5e3c515991f3..e7de8864a527 100644
--- a/drivers/usb/core/ledtrig-usbport.c
+++ b/drivers/usb/core/ledtrig-usbport.c
@@ -190,7 +190,7 @@ static int usbport_trig_add_port(struct usbport_trig_data *usbport_data,
size_t len;
int err;
- port = kzalloc(sizeof(*port), GFP_KERNEL);
+ port = kzalloc_obj(*port, GFP_KERNEL);
if (!port) {
err = -ENOMEM;
goto err_out;
@@ -305,7 +305,7 @@ static int usbport_trig_activate(struct led_classdev *led_cdev)
struct usbport_trig_data *usbport_data;
int err;
- usbport_data = kzalloc(sizeof(*usbport_data), GFP_KERNEL);
+ usbport_data = kzalloc_obj(*usbport_data, GFP_KERNEL);
if (!usbport_data)
return -ENOMEM;
usbport_data->led_cdev = led_cdev;
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 6138468c67c4..d8f50d468794 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -141,7 +141,7 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request,
struct usb_ctrlrequest *dr;
int ret;
- dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_NOIO);
+ dr = kmalloc_obj(struct usb_ctrlrequest, GFP_NOIO);
if (!dr)
return -ENOMEM;
@@ -526,7 +526,7 @@ int usb_sg_init(struct usb_sg_request *io, struct usb_device *dev,
}
/* initialize all the urbs we'll use */
- io->urbs = kmalloc_array(io->entries, sizeof(*io->urbs), mem_flags);
+ io->urbs = kmalloc_objs(*io->urbs, io->entries, mem_flags);
if (!io->urbs)
goto nomem;
@@ -1058,7 +1058,7 @@ struct usb_device_descriptor *usb_get_device_descriptor(struct usb_device *udev)
struct usb_device_descriptor *desc;
int ret;
- desc = kmalloc(sizeof(*desc), GFP_NOIO);
+ desc = kmalloc_obj(*desc, GFP_NOIO);
if (!desc)
return ERR_PTR(-ENOMEM);
@@ -2028,15 +2028,13 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
n = nintf = 0;
if (cp) {
nintf = cp->desc.bNumInterfaces;
- new_interfaces = kmalloc_array(nintf, sizeof(*new_interfaces),
- GFP_NOIO);
+ new_interfaces = kmalloc_objs(*new_interfaces, nintf, GFP_NOIO);
if (!new_interfaces)
return -ENOMEM;
for (; n < nintf; ++n) {
- new_interfaces[n] = kzalloc(
- sizeof(struct usb_interface),
- GFP_NOIO);
+ new_interfaces[n] = kzalloc_obj(struct usb_interface,
+ GFP_NOIO);
if (!new_interfaces[n]) {
ret = -ENOMEM;
free_interfaces:
@@ -2289,7 +2287,7 @@ int usb_driver_set_configuration(struct usb_device *udev, int config)
{
struct set_config_request *req;
- req = kmalloc(sizeof(*req), GFP_KERNEL);
+ req = kmalloc_obj(*req, GFP_KERNEL);
if (!req)
return -ENOMEM;
req->udev = udev;
diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
index f54198171b6a..36096973eb59 100644
--- a/drivers/usb/core/port.c
+++ b/drivers/usb/core/port.c
@@ -739,11 +739,11 @@ int usb_hub_create_port_device(struct usb_hub *hub, int port1)
struct usb_device *hdev = hub->hdev;
int retval;
- port_dev = kzalloc(sizeof(*port_dev), GFP_KERNEL);
+ port_dev = kzalloc_obj(*port_dev, GFP_KERNEL);
if (!port_dev)
return -ENOMEM;
- port_dev->req = kzalloc(sizeof(*(port_dev->req)), GFP_KERNEL);
+ port_dev->req = kzalloc_obj(*(port_dev->req), GFP_KERNEL);
if (!port_dev->req) {
kfree(port_dev);
return -ENOMEM;
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index c4d85089d19b..135a89ab2bfa 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -61,8 +61,7 @@ static int quirks_param_set(const char *value, const struct kernel_param *kp)
quirk_list = NULL;
}
- quirk_list = kcalloc(quirk_count, sizeof(struct quirk_entry),
- GFP_KERNEL);
+ quirk_list = kzalloc_objs(struct quirk_entry, quirk_count, GFP_KERNEL);
if (!quirk_list) {
quirk_count = 0;
mutex_unlock(&quirk_mutex);
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index ff8df16cca35..c06b44ca507b 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -72,8 +72,7 @@ struct urb *usb_alloc_urb(int iso_packets, gfp_t mem_flags)
{
struct urb *urb;
- urb = kmalloc(struct_size(urb, iso_frame_desc, iso_packets),
- mem_flags);
+ urb = kmalloc_flex(*urb, iso_frame_desc, iso_packets, mem_flags);
if (!urb)
return NULL;
usb_init_urb(urb);
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index e740f7852bcd..cfb882b86981 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -648,7 +648,7 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent,
struct usb_hcd *usb_hcd = bus_to_hcd(bus);
unsigned raw_port = port1;
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ dev = kzalloc_obj(*dev, GFP_KERNEL);
if (!dev)
return NULL;
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 0637bfbc054e..d216e26c787b 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -397,7 +397,7 @@ static struct usb_request *dwc2_hsotg_ep_alloc_request(struct usb_ep *ep,
{
struct dwc2_hsotg_req *req;
- req = kzalloc(sizeof(*req), flags);
+ req = kzalloc_obj(*req, flags);
if (!req)
return NULL;
diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index 30eb8506617c..55809a83f8f8 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -3823,7 +3823,7 @@ static struct dwc2_hcd_urb *dwc2_hcd_urb_alloc(struct dwc2_hsotg *hsotg,
{
struct dwc2_hcd_urb *urb;
- urb = kzalloc(struct_size(urb, iso_descs, iso_desc_count), mem_flags);
+ urb = kzalloc_flex(*urb, iso_descs, iso_desc_count, mem_flags);
if (urb)
urb->packet_count = iso_desc_count;
return urb;
@@ -4743,7 +4743,7 @@ static int _dwc2_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
qh_allocated = true;
}
- qtd = kzalloc(sizeof(*qtd), mem_flags);
+ qtd = kzalloc_obj(*qtd, mem_flags);
if (!qtd) {
retval = -ENOMEM;
goto fail1;
@@ -5218,7 +5218,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg)
memset(&hsotg->hc_ptr_array[0], 0, sizeof(hsotg->hc_ptr_array));
for (i = 0; i < num_channels; i++) {
- channel = kzalloc(sizeof(*channel), GFP_KERNEL);
+ channel = kzalloc_obj(*channel, GFP_KERNEL);
if (!channel)
goto error3;
channel->hc_num = i;
diff --git a/drivers/usb/dwc2/hcd_queue.c b/drivers/usb/dwc2/hcd_queue.c
index 904fe0632b34..4f00ff1dc3e1 100644
--- a/drivers/usb/dwc2/hcd_queue.c
+++ b/drivers/usb/dwc2/hcd_queue.c
@@ -1585,7 +1585,7 @@ struct dwc2_qh *dwc2_hcd_qh_create(struct dwc2_hsotg *hsotg,
return NULL;
/* Allocate memory */
- qh = kzalloc(sizeof(*qh), mem_flags);
+ qh = kzalloc_obj(*qh, mem_flags);
if (!qh)
return NULL;
diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c
index ffb1101f55c7..a005865862c8 100644
--- a/drivers/usb/dwc3/debugfs.c
+++ b/drivers/usb/dwc3/debugfs.c
@@ -1003,7 +1003,7 @@ void dwc3_debugfs_init(struct dwc3 *dwc)
{
struct dentry *root;
- dwc->regset = kzalloc(sizeof(*dwc->regset), GFP_KERNEL);
+ dwc->regset = kzalloc_obj(*dwc->regset, GFP_KERNEL);
if (!dwc->regset)
return;
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index c65291e7b8d9..7bd60fc7cd74 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1188,7 +1188,7 @@ static struct usb_request *dwc3_gadget_ep_alloc_request(struct usb_ep *ep,
struct dwc3_request *req;
struct dwc3_ep *dep = to_dwc3_ep(ep);
- req = kzalloc(sizeof(*req), gfp_flags);
+ req = kzalloc_obj(*req, gfp_flags);
if (!req)
return NULL;
@@ -3373,7 +3373,7 @@ static int dwc3_gadget_init_endpoint(struct dwc3 *dwc, u8 epnum)
int ret;
u8 num = epnum >> 1;
- dep = kzalloc(sizeof(*dep), GFP_KERNEL);
+ dep = kzalloc_obj(*dep, GFP_KERNEL);
if (!dep)
return -ENOMEM;
@@ -4728,7 +4728,7 @@ int dwc3_gadget_init(struct dwc3 *dwc)
}
init_completion(&dwc->ep0_in_setup);
- dwc->gadget = kzalloc(sizeof(struct usb_gadget), GFP_KERNEL);
+ dwc->gadget = kzalloc_obj(struct usb_gadget, GFP_KERNEL);
if (!dwc->gadget) {
ret = -ENOMEM;
goto err3;
diff --git a/drivers/usb/fotg210/fotg210-hcd.c b/drivers/usb/fotg210/fotg210-hcd.c
index fbb5d590eab6..65a16d2cdfd7 100644
--- a/drivers/usb/fotg210/fotg210-hcd.c
+++ b/drivers/usb/fotg210/fotg210-hcd.c
@@ -515,7 +515,7 @@ static ssize_t fill_periodic_buffer(struct debug_buffer *buf)
unsigned i;
__hc32 tag;
- seen = kmalloc_array(DBG_SCHED_LIMIT, sizeof(*seen), GFP_ATOMIC);
+ seen = kmalloc_objs(*seen, DBG_SCHED_LIMIT, GFP_ATOMIC);
if (!seen)
return 0;
@@ -738,7 +738,7 @@ static struct debug_buffer
{
struct debug_buffer *buf;
- buf = kzalloc(sizeof(struct debug_buffer), GFP_KERNEL);
+ buf = kzalloc_obj(struct debug_buffer, GFP_KERNEL);
if (buf) {
buf->bus = bus;
@@ -1847,7 +1847,7 @@ static struct fotg210_qh *fotg210_qh_alloc(struct fotg210_hcd *fotg210,
struct fotg210_qh *qh;
dma_addr_t dma;
- qh = kzalloc(sizeof(*qh), GFP_ATOMIC);
+ qh = kzalloc_obj(*qh, GFP_ATOMIC);
if (!qh)
goto done;
qh->hw = (struct fotg210_qh_hw *)
@@ -3899,7 +3899,7 @@ static struct fotg210_iso_stream *iso_stream_alloc(gfp_t mem_flags)
{
struct fotg210_iso_stream *stream;
- stream = kzalloc(sizeof(*stream), mem_flags);
+ stream = kzalloc_obj(*stream, mem_flags);
if (likely(stream != NULL)) {
INIT_LIST_HEAD(&stream->td_list);
INIT_LIST_HEAD(&stream->free_list);
@@ -4007,7 +4007,7 @@ static struct fotg210_iso_sched *iso_sched_alloc(unsigned packets,
{
struct fotg210_iso_sched *iso_sched;
- iso_sched = kzalloc(struct_size(iso_sched, packet, packets), mem_flags);
+ iso_sched = kzalloc_flex(*iso_sched, packet, packets, mem_flags);
if (likely(iso_sched != NULL))
INIT_LIST_HEAD(&iso_sched->td_list);
diff --git a/drivers/usb/fotg210/fotg210-udc.c b/drivers/usb/fotg210/fotg210-udc.c
index 0bae12e34f9a..79509ec08be9 100644
--- a/drivers/usb/fotg210/fotg210-udc.c
+++ b/drivers/usb/fotg210/fotg210-udc.c
@@ -244,7 +244,7 @@ static struct usb_request *fotg210_ep_alloc_request(struct usb_ep *_ep,
{
struct fotg210_request *req;
- req = kzalloc(sizeof(struct fotg210_request), gfp_flags);
+ req = kzalloc_obj(struct fotg210_request, gfp_flags);
if (!req)
return NULL;
@@ -1183,7 +1183,7 @@ int fotg210_udc_probe(struct platform_device *pdev, struct fotg210 *fotg)
return irq;
/* initialize udc */
- fotg210 = kzalloc(sizeof(struct fotg210_udc), GFP_KERNEL);
+ fotg210 = kzalloc_obj(struct fotg210_udc, GFP_KERNEL);
if (fotg210 == NULL)
return -ENOMEM;
@@ -1207,7 +1207,7 @@ int fotg210_udc_probe(struct platform_device *pdev, struct fotg210 *fotg)
ret = -ENOMEM;
for (i = 0; i < FOTG210_MAX_NUM_EP; i++) {
- fotg210->ep[i] = kzalloc(sizeof(struct fotg210_ep), GFP_KERNEL);
+ fotg210->ep[i] = kzalloc_obj(struct fotg210_ep, GFP_KERNEL);
if (!fotg210->ep[i])
goto err_alloc;
}
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 5b3866909b75..aba08d058ff9 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -2531,7 +2531,7 @@ static int composite_bind(struct usb_gadget *gadget,
struct usb_composite_driver *composite = to_cdriver(gdriver);
int status = -ENOMEM;
- cdev = kzalloc(sizeof *cdev, GFP_KERNEL);
+ cdev = kzalloc_obj(*cdev, GFP_KERNEL);
if (!cdev)
return status;
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index acef1c6f199c..5163a994f9e7 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -727,7 +727,7 @@ static struct config_group *config_desc_make(
if (ret)
return ERR_PTR(ret);
- cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
+ cfg = kzalloc_obj(*cfg, GFP_KERNEL);
if (!cfg)
return ERR_PTR(-ENOMEM);
cfg->c.label = kstrdup(buf, GFP_KERNEL);
@@ -870,7 +870,7 @@ static struct config_item *gadget_language_string_make(struct config_group *grou
language = to_gadget_language(&group->cg_item);
- string = kzalloc(sizeof(*string), GFP_KERNEL);
+ string = kzalloc_obj(*string, GFP_KERNEL);
if (!string)
return ERR_PTR(-ENOMEM);
@@ -922,7 +922,7 @@ static struct config_group *gadget_language_make(struct config_group *group,
int langs = 0;
int ret;
- new = kzalloc(sizeof(*new), GFP_KERNEL);
+ new = kzalloc_obj(*new, GFP_KERNEL);
if (!new)
return ERR_PTR(-ENOMEM);
@@ -1629,8 +1629,8 @@ configfs_attach_gadget_strings(struct gadget_info *gi)
if (!nlangs)
return NULL;
- gadget_strings = kcalloc(nlangs + 1, /* including NULL terminator */
- sizeof(struct usb_gadget_strings *), GFP_KERNEL);
+ gadget_strings = kzalloc_objs(struct usb_gadget_strings *, nlangs + 1,
+ GFP_KERNEL)/* including NULL terminator */;
if (!gadget_strings)
return ERR_PTR(-ENOMEM);
@@ -1645,8 +1645,8 @@ configfs_attach_gadget_strings(struct gadget_info *gi)
goto cleanup;
}
- stringtab = kcalloc(language->nstrings + 1, sizeof(struct usb_string),
- GFP_KERNEL);
+ stringtab = kzalloc_objs(struct usb_string,
+ language->nstrings + 1, GFP_KERNEL);
if (!stringtab) {
us = ERR_PTR(-ENOMEM);
goto cleanup;
@@ -1992,7 +1992,7 @@ static struct config_group *gadgets_make(
{
struct gadget_info *gi;
- gi = kzalloc(sizeof(*gi), GFP_KERNEL);
+ gi = kzalloc_obj(*gi, GFP_KERNEL);
if (!gi)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/usb/gadget/function/f_acm.c b/drivers/usb/gadget/function/f_acm.c
index 0ad857f1f325..d34b4710f962 100644
--- a/drivers/usb/gadget/function/f_acm.c
+++ b/drivers/usb/gadget/function/f_acm.c
@@ -748,7 +748,7 @@ static struct usb_function *acm_alloc_func(struct usb_function_instance *fi)
struct f_serial_opts *opts;
struct f_acm *acm;
- acm = kzalloc(sizeof(*acm), GFP_KERNEL);
+ acm = kzalloc_obj(*acm, GFP_KERNEL);
if (!acm)
return ERR_PTR(-ENOMEM);
@@ -882,7 +882,7 @@ static struct usb_function_instance *acm_alloc_instance(void)
struct f_serial_opts *opts;
int ret;
- opts = kzalloc(sizeof(*opts), GFP_KERNEL);
+ opts = kzalloc_obj(*opts, GFP_KERNEL);
if (!opts)
return ERR_PTR(-ENOMEM);
opts->protocol = USB_CDC_ACM_PROTO_AT_V25TER;
diff --git a/drivers/usb/gadget/function/f_ecm.c b/drivers/usb/gadget/function/f_ecm.c
index 675d2bc538a4..aa91d705bc8d 100644
--- a/drivers/usb/gadget/function/f_ecm.c
+++ b/drivers/usb/gadget/function/f_ecm.c
@@ -847,7 +847,7 @@ static struct usb_function_instance *ecm_alloc_inst(void)
{
struct f_ecm_opts *opts;
- opts = kzalloc(sizeof(*opts), GFP_KERNEL);
+ opts = kzalloc_obj(*opts, GFP_KERNEL);
if (!opts)
return ERR_PTR(-ENOMEM);
mutex_init(&opts->lock);
@@ -927,7 +927,7 @@ static struct usb_function *ecm_alloc(struct usb_function_instance *fi)
int status;
/* allocate and initialize one new instance */
- ecm = kzalloc(sizeof(*ecm), GFP_KERNEL);
+ ecm = kzalloc_obj(*ecm, GFP_KERNEL);
if (!ecm)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/usb/gadget/function/f_eem.c b/drivers/usb/gadget/function/f_eem.c
index edbbadad6138..acdd6c637c7b 100644
--- a/drivers/usb/gadget/function/f_eem.c
+++ b/drivers/usb/gadget/function/f_eem.c
@@ -462,7 +462,7 @@ static int eem_unwrap(struct gether *port,
goto next;
}
- ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
+ ctx = kmalloc_obj(*ctx, GFP_KERNEL);
if (!ctx) {
kfree(req->buf);
usb_ep_free_request(ep, req);
@@ -608,7 +608,7 @@ static struct usb_function_instance *eem_alloc_inst(void)
{
struct f_eem_opts *opts;
- opts = kzalloc(sizeof(*opts), GFP_KERNEL);
+ opts = kzalloc_obj(*opts, GFP_KERNEL);
if (!opts)
return ERR_PTR(-ENOMEM);
mutex_init(&opts->lock);
@@ -651,7 +651,7 @@ static struct usb_function *eem_alloc(struct usb_function_instance *fi)
struct f_eem_opts *opts;
/* allocate and initialize one new instance */
- eem = kzalloc(sizeof(*eem), GFP_KERNEL);
+ eem = kzalloc_obj(*eem, GFP_KERNEL);
if (!eem)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index 2c6986e381ca..84cfa7a8437a 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -814,7 +814,7 @@ static void *ffs_build_sg_list(struct sg_table *sgt, size_t sz)
return NULL;
n_pages = PAGE_ALIGN(sz) >> PAGE_SHIFT;
- pages = kvmalloc_array(n_pages, sizeof(struct page *), GFP_KERNEL);
+ pages = kvmalloc_objs(struct page *, n_pages, GFP_KERNEL);
if (!pages) {
vfree(vaddr);
@@ -957,7 +957,7 @@ static ssize_t __ffs_epfile_read_data(struct ffs_epfile *epfile,
data_len, ret);
data_len -= ret;
- buf = kmalloc(struct_size(buf, storage, data_len), GFP_KERNEL);
+ buf = kmalloc_flex(*buf, storage, data_len, GFP_KERNEL);
if (!buf)
return -ENOMEM;
buf->length = data_len;
@@ -1245,7 +1245,7 @@ static ssize_t ffs_epfile_write_iter(struct kiocb *kiocb, struct iov_iter *from)
ssize_t res;
if (!is_sync_kiocb(kiocb)) {
- p = kzalloc(sizeof(io_data), GFP_KERNEL);
+ p = kzalloc_obj(io_data, GFP_KERNEL);
if (!p)
return -ENOMEM;
p->aio = true;
@@ -1280,7 +1280,7 @@ static ssize_t ffs_epfile_read_iter(struct kiocb *kiocb, struct iov_iter *to)
ssize_t res;
if (!is_sync_kiocb(kiocb)) {
- p = kzalloc(sizeof(io_data), GFP_KERNEL);
+ p = kzalloc_obj(io_data, GFP_KERNEL);
if (!p)
return -ENOMEM;
p->aio = true;
@@ -1503,7 +1503,7 @@ static int ffs_dmabuf_attach(struct file *file, int fd)
goto err_dmabuf_put;
}
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ priv = kzalloc_obj(*priv, GFP_KERNEL);
if (!priv) {
err = -ENOMEM;
goto err_dmabuf_detach;
@@ -1652,7 +1652,7 @@ static int ffs_dmabuf_transfer(struct file *file,
if (ret)
goto err_resv_unlock;
- fence = kmalloc(sizeof(*fence), GFP_KERNEL);
+ fence = kmalloc_obj(*fence, GFP_KERNEL);
if (!fence) {
ret = -ENOMEM;
goto err_resv_unlock;
@@ -2067,7 +2067,7 @@ static int ffs_fs_init_fs_context(struct fs_context *fc)
{
struct ffs_sb_fill_data *ctx;
- ctx = kzalloc(sizeof(struct ffs_sb_fill_data), GFP_KERNEL);
+ ctx = kzalloc_obj(struct ffs_sb_fill_data, GFP_KERNEL);
if (!ctx)
return -ENOMEM;
@@ -2183,7 +2183,7 @@ static void ffs_data_closed(struct ffs_data *ffs)
static struct ffs_data *ffs_data_new(const char *dev_name)
{
- struct ffs_data *ffs = kzalloc(sizeof *ffs, GFP_KERNEL);
+ struct ffs_data *ffs = kzalloc_obj(*ffs, GFP_KERNEL);
if (!ffs)
return NULL;
@@ -2330,7 +2330,7 @@ static int ffs_epfiles_create(struct ffs_data *ffs)
int err;
count = ffs->eps_count;
- epfiles = kcalloc(count, sizeof(*epfiles), GFP_KERNEL);
+ epfiles = kzalloc_objs(*epfiles, count, GFP_KERNEL);
if (!epfiles)
return -ENOMEM;
@@ -4031,7 +4031,7 @@ static struct usb_function_instance *ffs_alloc_inst(void)
struct f_fs_opts *opts;
struct ffs_dev *dev;
- opts = kzalloc(sizeof(*opts), GFP_KERNEL);
+ opts = kzalloc_obj(*opts, GFP_KERNEL);
if (!opts)
return ERR_PTR(-ENOMEM);
@@ -4107,7 +4107,7 @@ static struct usb_function *ffs_alloc(struct usb_function_instance *fi)
{
struct ffs_function *func;
- func = kzalloc(sizeof(*func), GFP_KERNEL);
+ func = kzalloc_obj(*func, GFP_KERNEL);
if (!func)
return ERR_PTR(-ENOMEM);
@@ -4138,7 +4138,7 @@ static struct ffs_dev *_ffs_alloc_dev(void)
if (_ffs_get_single_dev())
return ERR_PTR(-EBUSY);
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ dev = kzalloc_obj(*dev, GFP_KERNEL);
if (!dev)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c
index bee0d0458ff7..93dd678cafe1 100644
--- a/drivers/usb/gadget/function/f_hid.c
+++ b/drivers/usb/gadget/function/f_hid.c
@@ -650,7 +650,7 @@ static int f_hidg_get_report(struct file *file, struct usb_hidg_report __user *b
struct report_entry *ptr;
__u8 report_id;
- entry = kmalloc(sizeof(*entry), GFP_KERNEL);
+ entry = kmalloc_obj(*entry, GFP_KERNEL);
if (!entry)
return -ENOMEM;
@@ -775,7 +775,7 @@ static void hidg_intout_complete(struct usb_ep *ep, struct usb_request *req)
switch (req->status) {
case 0:
- req_list = kzalloc(sizeof(*req_list), GFP_ATOMIC);
+ req_list = kzalloc_obj(*req_list, GFP_ATOMIC);
if (!req_list) {
ERROR(cdev, "Unable to allocate mem for req_list\n");
goto free_req;
@@ -1530,7 +1530,7 @@ static struct usb_function_instance *hidg_alloc_inst(void)
struct usb_function_instance *ret;
int status = 0;
- opts = kzalloc(sizeof(*opts), GFP_KERNEL);
+ opts = kzalloc_obj(*opts, GFP_KERNEL);
if (!opts)
return ERR_PTR(-ENOMEM);
mutex_init(&opts->lock);
@@ -1596,7 +1596,7 @@ static struct usb_function *hidg_alloc(struct usb_function_instance *fi)
int ret;
/* allocate and initialize one new instance */
- hidg = kzalloc(sizeof(*hidg), GFP_KERNEL);
+ hidg = kzalloc_obj(*hidg, GFP_KERNEL);
if (!hidg)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/usb/gadget/function/f_loopback.c b/drivers/usb/gadget/function/f_loopback.c
index 39862e236837..b8fa60af9385 100644
--- a/drivers/usb/gadget/function/f_loopback.c
+++ b/drivers/usb/gadget/function/f_loopback.c
@@ -425,7 +425,7 @@ static struct usb_function *loopback_alloc(struct usb_function_instance *fi)
struct f_loopback *loop;
struct f_lb_opts *lb_opts;
- loop = kzalloc(sizeof *loop, GFP_KERNEL);
+ loop = kzalloc_obj(*loop, GFP_KERNEL);
if (!loop)
return ERR_PTR(-ENOMEM);
@@ -568,7 +568,7 @@ static struct usb_function_instance *loopback_alloc_instance(void)
{
struct f_lb_opts *lb_opts;
- lb_opts = kzalloc(sizeof(*lb_opts), GFP_KERNEL);
+ lb_opts = kzalloc_obj(*lb_opts, GFP_KERNEL);
if (!lb_opts)
return ERR_PTR(-ENOMEM);
mutex_init(&lb_opts->lock);
diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c
index 5c3f34a2f35c..c894ede6bcd2 100644
--- a/drivers/usb/gadget/function/f_mass_storage.c
+++ b/drivers/usb/gadget/function/f_mass_storage.c
@@ -2699,7 +2699,7 @@ static void fsg_lun_release(struct device *dev)
static struct fsg_common *fsg_common_setup(struct fsg_common *common)
{
if (!common) {
- common = kzalloc(sizeof(*common), GFP_KERNEL);
+ common = kzalloc_obj(*common, GFP_KERNEL);
if (!common)
return ERR_PTR(-ENOMEM);
common->free_storage_on_release = 1;
@@ -2740,7 +2740,7 @@ int fsg_common_set_num_buffers(struct fsg_common *common, unsigned int n)
struct fsg_buffhd *bh, *buffhds;
int i;
- buffhds = kcalloc(n, sizeof(*buffhds), GFP_KERNEL);
+ buffhds = kzalloc_objs(*buffhds, n, GFP_KERNEL);
if (!buffhds)
return -ENOMEM;
@@ -2887,7 +2887,7 @@ int fsg_common_create_lun(struct fsg_common *common, struct fsg_lun_config *cfg,
return -EINVAL;
}
- lun = kzalloc(sizeof(*lun), GFP_KERNEL);
+ lun = kzalloc_obj(*lun, GFP_KERNEL);
if (!lun)
return -ENOMEM;
@@ -3311,7 +3311,7 @@ static struct config_group *fsg_lun_make(struct config_group *group,
goto out;
}
- opts = kzalloc(sizeof(*opts), GFP_KERNEL);
+ opts = kzalloc_obj(*opts, GFP_KERNEL);
if (!opts) {
ret = -ENOMEM;
goto out;
@@ -3489,7 +3489,7 @@ static struct usb_function_instance *fsg_alloc_inst(void)
struct fsg_lun_config config;
int rc;
- opts = kzalloc(sizeof(*opts), GFP_KERNEL);
+ opts = kzalloc_obj(*opts, GFP_KERNEL);
if (!opts)
return ERR_PTR(-ENOMEM);
mutex_init(&opts->lock);
@@ -3554,7 +3554,7 @@ static struct usb_function *fsg_alloc(struct usb_function_instance *fi)
struct fsg_common *common = opts->common;
struct fsg_dev *fsg;
- fsg = kzalloc(sizeof(*fsg), GFP_KERNEL);
+ fsg = kzalloc_obj(*fsg, GFP_KERNEL);
if (unlikely(!fsg))
return ERR_PTR(-ENOMEM);
diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c
index f592f9eb85d4..d98f946b1621 100644
--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -931,8 +931,8 @@ static int f_midi_bind(struct usb_configuration *c, struct usb_function *f)
goto fail;
/* allocate temporary function list */
- midi_function = kcalloc((MAX_PORTS * 4) + 11, sizeof(*midi_function),
- GFP_KERNEL);
+ midi_function = kzalloc_objs(*midi_function, (MAX_PORTS * 4) + 11,
+ GFP_KERNEL);
if (!midi_function) {
status = -ENOMEM;
goto fail;
@@ -1279,7 +1279,7 @@ static struct usb_function_instance *f_midi_alloc_inst(void)
{
struct f_midi_opts *opts;
- opts = kzalloc(sizeof(*opts), GFP_KERNEL);
+ opts = kzalloc_obj(*opts, GFP_KERNEL);
if (!opts)
return ERR_PTR(-ENOMEM);
@@ -1361,8 +1361,7 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi)
}
/* allocate and initialize one new instance */
- midi = kzalloc(struct_size(midi, in_ports_array, opts->in_ports),
- GFP_KERNEL);
+ midi = kzalloc_flex(*midi, in_ports_array, opts->in_ports, GFP_KERNEL);
if (!midi) {
status = -ENOMEM;
goto setup_fail;
diff --git a/drivers/usb/gadget/function/f_midi2.c b/drivers/usb/gadget/function/f_midi2.c
index 95ec87bed3ee..1a4feca1f083 100644
--- a/drivers/usb/gadget/function/f_midi2.c
+++ b/drivers/usb/gadget/function/f_midi2.c
@@ -1187,8 +1187,8 @@ static int f_midi2_init_ep(struct f_midi2 *midi2, struct f_midi2_ep *ep,
return -ENODEV;
usb_ep->complete = complete;
- usb_ep->reqs = kcalloc(midi2->info.num_reqs, sizeof(*usb_ep->reqs),
- GFP_KERNEL);
+ usb_ep->reqs = kzalloc_objs(*usb_ep->reqs, midi2->info.num_reqs,
+ GFP_KERNEL);
if (!usb_ep->reqs)
return -ENOMEM;
for (i = 0; i < midi2->info.num_reqs; i++) {
@@ -2340,7 +2340,7 @@ static int f_midi2_block_opts_create(struct f_midi2_ep_opts *ep_opts,
goto out;
}
- block_opts = kzalloc(sizeof(*block_opts), GFP_KERNEL);
+ block_opts = kzalloc_obj(*block_opts, GFP_KERNEL);
if (!block_opts) {
ret = -ENOMEM;
goto out;
@@ -2502,7 +2502,7 @@ static int f_midi2_ep_opts_create(struct f_midi2_opts *opts,
{
struct f_midi2_ep_opts *ep_opts;
- ep_opts = kzalloc(sizeof(*ep_opts), GFP_KERNEL);
+ ep_opts = kzalloc_obj(*ep_opts, GFP_KERNEL);
if (!ep_opts)
return -ENOMEM;
@@ -2652,7 +2652,7 @@ static struct usb_function_instance *f_midi2_alloc_inst(void)
struct f_midi2_block_opts *block_opts;
int ret;
- opts = kzalloc(sizeof(*opts), GFP_KERNEL);
+ opts = kzalloc_obj(*opts, GFP_KERNEL);
if (!opts)
return ERR_PTR(-ENOMEM);
@@ -2813,7 +2813,7 @@ static struct usb_function *f_midi2_alloc(struct usb_function_instance *fi)
struct f_midi2_block *bp;
int i, num_eps, blk;
- midi2 = kzalloc(sizeof(*midi2), GFP_KERNEL);
+ midi2 = kzalloc_obj(*midi2, GFP_KERNEL);
if (!midi2)
return ERR_PTR(-ENOMEM);
@@ -2855,8 +2855,8 @@ static struct usb_function *f_midi2_alloc(struct usb_function_instance *fi)
}
}
- midi2->string_defs = kcalloc(midi2->total_blocks + 1,
- sizeof(*midi2->string_defs), GFP_KERNEL);
+ midi2->string_defs = kzalloc_objs(*midi2->string_defs,
+ midi2->total_blocks + 1, GFP_KERNEL);
if (!midi2->string_defs) {
do_f_midi2_free(midi2, opts);
return ERR_PTR(-ENOMEM);
diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c
index e23adc132f88..6bbdb10ce3ca 100644
--- a/drivers/usb/gadget/function/f_ncm.c
+++ b/drivers/usb/gadget/function/f_ncm.c
@@ -1683,7 +1683,7 @@ static struct usb_function_instance *ncm_alloc_inst(void)
char *names[1];
struct config_group *ncm_interf_group;
- struct f_ncm_opts *opts __free(kfree) = kzalloc(sizeof(*opts), GFP_KERNEL);
+ struct f_ncm_opts *opts __free(kfree) = kzalloc_obj(*opts, GFP_KERNEL);
if (!opts)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/usb/gadget/function/f_obex.c b/drivers/usb/gadget/function/f_obex.c
index 6d498f63183e..e9e9fd70c243 100644
--- a/drivers/usb/gadget/function/f_obex.c
+++ b/drivers/usb/gadget/function/f_obex.c
@@ -426,7 +426,7 @@ static struct usb_function_instance *obex_alloc_inst(void)
struct f_serial_opts *opts;
int ret;
- opts = kzalloc(sizeof(*opts), GFP_KERNEL);
+ opts = kzalloc_obj(*opts, GFP_KERNEL);
if (!opts)
return ERR_PTR(-ENOMEM);
@@ -461,7 +461,7 @@ static struct usb_function *obex_alloc(struct usb_function_instance *fi)
struct f_serial_opts *opts;
/* allocate and initialize one new instance */
- obex = kzalloc(sizeof(*obex), GFP_KERNEL);
+ obex = kzalloc_obj(*obex, GFP_KERNEL);
if (!obex)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/usb/gadget/function/f_phonet.c b/drivers/usb/gadget/function/f_phonet.c
index d644d5495fdc..b427dcae456c 100644
--- a/drivers/usb/gadget/function/f_phonet.c
+++ b/drivers/usb/gadget/function/f_phonet.c
@@ -623,7 +623,7 @@ static struct usb_function_instance *phonet_alloc_inst(void)
{
struct f_phonet_opts *opts;
- opts = kzalloc(sizeof(*opts), GFP_KERNEL);
+ opts = kzalloc_obj(*opts, GFP_KERNEL);
if (!opts)
return ERR_PTR(-ENOMEM);
@@ -669,7 +669,7 @@ static struct usb_function *phonet_alloc(struct usb_function_instance *fi)
struct f_phonet *fp;
struct f_phonet_opts *opts;
- fp = kzalloc(struct_size(fp, out_reqv, phonet_rxq_size), GFP_KERNEL);
+ fp = kzalloc_flex(*fp, out_reqv, phonet_rxq_size, GFP_KERNEL);
if (!fp)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/usb/gadget/function/f_printer.c b/drivers/usb/gadget/function/f_printer.c
index b2fa2b56c37e..d0e6435ac7a6 100644
--- a/drivers/usb/gadget/function/f_printer.c
+++ b/drivers/usb/gadget/function/f_printer.c
@@ -1374,7 +1374,7 @@ static struct usb_function_instance *gprinter_alloc_inst(void)
struct usb_function_instance *ret;
int status = 0;
- opts = kzalloc(sizeof(*opts), GFP_KERNEL);
+ opts = kzalloc_obj(*opts, GFP_KERNEL);
if (!opts)
return ERR_PTR(-ENOMEM);
@@ -1482,7 +1482,7 @@ static struct usb_function *gprinter_alloc(struct usb_function_instance *fi)
return ERR_PTR(-ENOENT);
}
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ dev = kzalloc_obj(*dev, GFP_KERNEL);
if (!dev) {
mutex_unlock(&opts->lock);
return ERR_PTR(-ENOMEM);
diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c
index 7451e7cb7a85..39a87458bab4 100644
--- a/drivers/usb/gadget/function/f_rndis.c
+++ b/drivers/usb/gadget/function/f_rndis.c
@@ -673,7 +673,7 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f)
rndis_opts = container_of(f->fi, struct f_rndis_opts, func_inst);
if (cdev->use_os_string) {
- os_desc_table = kzalloc(sizeof(*os_desc_table), GFP_KERNEL);
+ os_desc_table = kzalloc_obj(*os_desc_table, GFP_KERNEL);
if (!os_desc_table)
return -ENOMEM;
}
@@ -888,7 +888,7 @@ static struct usb_function_instance *rndis_alloc_inst(void)
char *names[1];
struct config_group *rndis_interf_group;
- opts = kzalloc(sizeof(*opts), GFP_KERNEL);
+ opts = kzalloc_obj(*opts, GFP_KERNEL);
if (!opts)
return ERR_PTR(-ENOMEM);
opts->rndis_os_desc.ext_compat_id = opts->rndis_ext_compat_id;
@@ -956,7 +956,7 @@ static struct usb_function *rndis_alloc(struct usb_function_instance *fi)
struct rndis_params *params;
/* allocate and initialize one new instance */
- rndis = kzalloc(sizeof(*rndis), GFP_KERNEL);
+ rndis = kzalloc_obj(*rndis, GFP_KERNEL);
if (!rndis)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/usb/gadget/function/f_serial.c b/drivers/usb/gadget/function/f_serial.c
index e6b412e0e045..01fc06b29ab2 100644
--- a/drivers/usb/gadget/function/f_serial.c
+++ b/drivers/usb/gadget/function/f_serial.c
@@ -317,7 +317,7 @@ static struct usb_function_instance *gser_alloc_inst(void)
struct f_serial_opts *opts;
int ret;
- opts = kzalloc(sizeof(*opts), GFP_KERNEL);
+ opts = kzalloc_obj(*opts, GFP_KERNEL);
if (!opts)
return ERR_PTR(-ENOMEM);
@@ -376,7 +376,7 @@ static struct usb_function *gser_alloc(struct usb_function_instance *fi)
struct f_serial_opts *opts;
/* allocate and initialize one new instance */
- gser = kzalloc(sizeof(*gser), GFP_KERNEL);
+ gser = kzalloc_obj(*gser, GFP_KERNEL);
if (!gser)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/usb/gadget/function/f_sourcesink.c b/drivers/usb/gadget/function/f_sourcesink.c
index 22104e9c6cab..e77e2e83833f 100644
--- a/drivers/usb/gadget/function/f_sourcesink.c
+++ b/drivers/usb/gadget/function/f_sourcesink.c
@@ -844,7 +844,7 @@ static struct usb_function *source_sink_alloc_func(
struct f_sourcesink *ss;
struct f_ss_opts *ss_opts;
- ss = kzalloc(sizeof(*ss), GFP_KERNEL);
+ ss = kzalloc_obj(*ss, GFP_KERNEL);
if (!ss)
return ERR_PTR(-ENOMEM);
@@ -1297,7 +1297,7 @@ static struct usb_function_instance *source_sink_alloc_inst(void)
{
struct f_ss_opts *ss_opts;
- ss_opts = kzalloc(sizeof(*ss_opts), GFP_KERNEL);
+ ss_opts = kzalloc_obj(*ss_opts, GFP_KERNEL);
if (!ss_opts)
return ERR_PTR(-ENOMEM);
mutex_init(&ss_opts->lock);
diff --git a/drivers/usb/gadget/function/f_subset.c b/drivers/usb/gadget/function/f_subset.c
index ea3fdd842462..4913f60db048 100644
--- a/drivers/usb/gadget/function/f_subset.c
+++ b/drivers/usb/gadget/function/f_subset.c
@@ -428,7 +428,7 @@ static struct usb_function_instance *geth_alloc_inst(void)
{
struct f_gether_opts *opts;
- opts = kzalloc(sizeof(*opts), GFP_KERNEL);
+ opts = kzalloc_obj(*opts, GFP_KERNEL);
if (!opts)
return ERR_PTR(-ENOMEM);
mutex_init(&opts->lock);
@@ -467,7 +467,7 @@ static struct usb_function *geth_alloc(struct usb_function_instance *fi)
int status;
/* allocate and initialize one new instance */
- geth = kzalloc(sizeof(*geth), GFP_KERNEL);
+ geth = kzalloc_obj(*geth, GFP_KERNEL);
if (!geth)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c
index efb94fd82533..29d6fd6ce935 100644
--- a/drivers/usb/gadget/function/f_tcm.c
+++ b/drivers/usb/gadget/function/f_tcm.c
@@ -1676,7 +1676,7 @@ static struct se_portal_group *usbg_make_tpg(struct se_wwn *wwn,
goto unlock_dep;
}
- tpg = kzalloc(sizeof(struct usbg_tpg), GFP_KERNEL);
+ tpg = kzalloc_obj(struct usbg_tpg, GFP_KERNEL);
ret = -ENOMEM;
if (!tpg)
goto unref_dep;
@@ -1768,7 +1768,7 @@ static struct se_wwn *usbg_make_tport(
if (!wnn_name)
return ERR_PTR(-EINVAL);
- tport = kzalloc(sizeof(struct usbg_tport), GFP_KERNEL);
+ tport = kzalloc_obj(struct usbg_tport, GFP_KERNEL);
if (!(tport))
return ERR_PTR(-ENOMEM);
@@ -1861,7 +1861,7 @@ static int tcm_usbg_make_nexus(struct usbg_tpg *tpg, char *name)
goto out_unlock;
}
- tv_nexus = kzalloc(sizeof(*tv_nexus), GFP_KERNEL);
+ tv_nexus = kzalloc_obj(*tv_nexus, GFP_KERNEL);
if (!tv_nexus) {
ret = -ENOMEM;
goto out_unlock;
@@ -2400,7 +2400,7 @@ static int tcm_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
if ((alt == USB_G_ALT_INT_BBB) || (alt == USB_G_ALT_INT_UAS)) {
struct guas_setup_wq *work;
- work = kmalloc(sizeof(*work), GFP_ATOMIC);
+ work = kmalloc_obj(*work, GFP_ATOMIC);
if (!work)
return -ENOMEM;
INIT_WORK(&work->work, tcm_delayed_set_alt);
@@ -2535,7 +2535,7 @@ static struct usb_function_instance *tcm_alloc_inst(void)
int i;
- opts = kzalloc(sizeof(*opts), GFP_KERNEL);
+ opts = kzalloc_obj(*opts, GFP_KERNEL);
if (!opts)
return ERR_PTR(-ENOMEM);
@@ -2590,7 +2590,7 @@ static struct usb_function *tcm_alloc(struct usb_function_instance *fi)
return ERR_PTR(-ENODEV);
}
- fu = kzalloc(sizeof(*fu), GFP_KERNEL);
+ fu = kzalloc_obj(*fu, GFP_KERNEL);
if (!fu) {
mutex_unlock(&tpg_instances_lock);
return ERR_PTR(-ENOMEM);
diff --git a/drivers/usb/gadget/function/f_uac1.c b/drivers/usb/gadget/function/f_uac1.c
index efe9f270b02d..58ada4855de8 100644
--- a/drivers/usb/gadget/function/f_uac1.c
+++ b/drivers/usb/gadget/function/f_uac1.c
@@ -451,7 +451,7 @@ static int audio_notify(struct g_audio *audio, int unit_id, int cs)
goto err_dec_int_count;
}
- msg = kmalloc(sizeof(*msg), GFP_ATOMIC);
+ msg = kmalloc_obj(*msg, GFP_ATOMIC);
if (msg == NULL) {
ret = -ENOMEM;
goto err_free_request;
@@ -1748,7 +1748,7 @@ static struct usb_function_instance *f_audio_alloc_inst(void)
{
struct f_uac1_opts *opts;
- opts = kzalloc(sizeof(*opts), GFP_KERNEL);
+ opts = kzalloc_obj(*opts, GFP_KERNEL);
if (!opts)
return ERR_PTR(-ENOMEM);
@@ -1831,7 +1831,7 @@ static struct usb_function *f_audio_alloc(struct usb_function_instance *fi)
struct f_uac1_opts *opts;
/* allocate and initialize one new instance */
- uac1 = kzalloc(sizeof(*uac1), GFP_KERNEL);
+ uac1 = kzalloc_obj(*uac1, GFP_KERNEL);
if (!uac1)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/usb/gadget/function/f_uac1_legacy.c b/drivers/usb/gadget/function/f_uac1_legacy.c
index 8fc452b4b39a..ed7e1f061784 100644
--- a/drivers/usb/gadget/function/f_uac1_legacy.c
+++ b/drivers/usb/gadget/function/f_uac1_legacy.c
@@ -251,7 +251,7 @@ static struct f_audio_buf *f_audio_buffer_alloc(int buf_size)
{
struct f_audio_buf *copy_buf;
- copy_buf = kzalloc(sizeof *copy_buf, GFP_ATOMIC);
+ copy_buf = kzalloc_obj(*copy_buf, GFP_ATOMIC);
if (!copy_buf)
return ERR_PTR(-ENOMEM);
@@ -942,7 +942,7 @@ static struct usb_function_instance *f_audio_alloc_inst(void)
{
struct f_uac1_legacy_opts *opts;
- opts = kzalloc(sizeof(*opts), GFP_KERNEL);
+ opts = kzalloc_obj(*opts, GFP_KERNEL);
if (!opts)
return ERR_PTR(-ENOMEM);
@@ -985,7 +985,7 @@ static struct usb_function *f_audio_alloc(struct usb_function_instance *fi)
struct f_uac1_legacy_opts *opts;
/* allocate and initialize one new instance */
- audio = kzalloc(sizeof(*audio), GFP_KERNEL);
+ audio = kzalloc_obj(*audio, GFP_KERNEL);
if (!audio)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c
index 98f0f50dc7a8..c66908bbe714 100644
--- a/drivers/usb/gadget/function/f_uac2.c
+++ b/drivers/usb/gadget/function/f_uac2.c
@@ -1388,7 +1388,7 @@ afunc_notify(struct g_audio *agdev, int unit_id, int cs)
goto err_dec_int_count;
}
- msg = kzalloc(sizeof(*msg), GFP_ATOMIC);
+ msg = kzalloc_obj(*msg, GFP_ATOMIC);
if (msg == NULL) {
ret = -ENOMEM;
goto err_free_request;
@@ -2189,7 +2189,7 @@ static struct usb_function_instance *afunc_alloc_inst(void)
{
struct f_uac2_opts *opts;
- opts = kzalloc(sizeof(*opts), GFP_KERNEL);
+ opts = kzalloc_obj(*opts, GFP_KERNEL);
if (!opts)
return ERR_PTR(-ENOMEM);
@@ -2278,7 +2278,7 @@ static struct usb_function *afunc_alloc(struct usb_function_instance *fi)
struct f_uac2 *uac2;
struct f_uac2_opts *opts;
- uac2 = kzalloc(sizeof(*uac2), GFP_KERNEL);
+ uac2 = kzalloc_obj(*uac2, GFP_KERNEL);
if (uac2 == NULL)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
index a96476507d2f..4b9846ab99f2 100644
--- a/drivers/usb/gadget/function/f_uvc.c
+++ b/drivers/usb/gadget/function/f_uvc.c
@@ -887,7 +887,7 @@ static struct usb_function_instance *uvc_alloc_inst(void)
struct uvc_descriptor_header **ctl_cls;
int ret;
- opts = kzalloc(sizeof(*opts), GFP_KERNEL);
+ opts = kzalloc_obj(*opts, GFP_KERNEL);
if (!opts)
return ERR_PTR(-ENOMEM);
opts->func_inst.free_func_inst = uvc_free_inst;
@@ -1042,7 +1042,7 @@ static struct usb_function *uvc_alloc(struct usb_function_instance *fi)
struct uvc_descriptor_header **strm_cls;
struct config_item *streaming, *header, *h;
- uvc = kzalloc(sizeof(*uvc), GFP_KERNEL);
+ uvc = kzalloc_obj(*uvc, GFP_KERNEL);
if (uvc == NULL)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/usb/gadget/function/rndis.c b/drivers/usb/gadget/function/rndis.c
index afd75d72412c..1e168666a3f5 100644
--- a/drivers/usb/gadget/function/rndis.c
+++ b/drivers/usb/gadget/function/rndis.c
@@ -892,7 +892,7 @@ struct rndis_params *rndis_register(void (*resp_avail)(void *v), void *v)
return ERR_PTR(-ENODEV);
}
- params = kzalloc(sizeof(*params), GFP_KERNEL);
+ params = kzalloc_obj(*params, GFP_KERNEL);
if (!params) {
rndis_put_nr(i);
diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/function/u_audio.c
index ca8dbec65f73..24c934bbf0e5 100644
--- a/drivers/usb/gadget/function/u_audio.c
+++ b/drivers/usb/gadget/function/u_audio.c
@@ -1191,7 +1191,7 @@ int g_audio_setup(struct g_audio *g_audio, const char *pcm_name,
if (!g_audio)
return -EINVAL;
- uac = kzalloc(sizeof(*uac), GFP_KERNEL);
+ uac = kzalloc_obj(*uac, GFP_KERNEL);
if (!uac)
return -ENOMEM;
g_audio->uac = uac;
@@ -1209,9 +1209,8 @@ int g_audio_setup(struct g_audio *g_audio, const char *pcm_name,
prm->max_psize = g_audio->out_ep_maxpsize;
prm->srate = params->c_srates[0];
- prm->reqs = kcalloc(params->req_number,
- sizeof(struct usb_request *),
- GFP_KERNEL);
+ prm->reqs = kzalloc_objs(struct usb_request *,
+ params->req_number, GFP_KERNEL);
if (!prm->reqs) {
err = -ENOMEM;
goto fail;
@@ -1234,9 +1233,8 @@ int g_audio_setup(struct g_audio *g_audio, const char *pcm_name,
prm->max_psize = g_audio->in_ep_maxpsize;
prm->srate = params->p_srates[0];
- prm->reqs = kcalloc(params->req_number,
- sizeof(struct usb_request *),
- GFP_KERNEL);
+ prm->reqs = kzalloc_objs(struct usb_request *,
+ params->req_number, GFP_KERNEL);
if (!prm->reqs) {
err = -ENOMEM;
goto fail;
diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c
index 1cce5317181a..e61beaa0c53d 100644
--- a/drivers/usb/gadget/function/u_serial.c
+++ b/drivers/usb/gadget/function/u_serial.c
@@ -1082,7 +1082,7 @@ static int gs_console_init(struct gs_port *port)
if (port->console)
return 0;
- cons = kzalloc(sizeof(*port->console), GFP_KERNEL);
+ cons = kzalloc_obj(*port->console, GFP_KERNEL);
if (!cons)
return -ENOMEM;
@@ -1215,7 +1215,7 @@ gs_port_alloc(unsigned port_num, struct usb_cdc_line_coding *coding)
goto out;
}
- port = kzalloc(sizeof(struct gs_port), GFP_KERNEL);
+ port = kzalloc_obj(struct gs_port, GFP_KERNEL);
if (port == NULL) {
ret = -ENOMEM;
goto out;
diff --git a/drivers/usb/gadget/function/u_uac1_legacy.c b/drivers/usb/gadget/function/u_uac1_legacy.c
index dd21c251542c..e95c2fc7fc10 100644
--- a/drivers/usb/gadget/function/u_uac1_legacy.c
+++ b/drivers/usb/gadget/function/u_uac1_legacy.c
@@ -106,7 +106,7 @@ static int playback_default_hw_params(struct gaudio_snd_dev *snd)
snd->channels = 2;
snd->rate = 48000;
- params = kzalloc(sizeof(*params), GFP_KERNEL);
+ params = kzalloc_obj(*params, GFP_KERNEL);
if (!params)
return -ENOMEM;
diff --git a/drivers/usb/gadget/function/uvc_configfs.c b/drivers/usb/gadget/function/uvc_configfs.c
index 4cec6c586d67..553057cbf63a 100644
--- a/drivers/usb/gadget/function/uvc_configfs.c
+++ b/drivers/usb/gadget/function/uvc_configfs.c
@@ -158,7 +158,7 @@ static int uvcg_config_create_group(struct config_group *parent,
{
struct config_group *group;
- group = kzalloc(sizeof(*group), GFP_KERNEL);
+ group = kzalloc_obj(*group, GFP_KERNEL);
if (!group)
return -ENOMEM;
@@ -270,7 +270,7 @@ static struct config_item *uvcg_control_header_make(struct config_group *group,
{
struct uvcg_control_header *h;
- h = kzalloc(sizeof(*h), GFP_KERNEL);
+ h = kzalloc_obj(*h, GFP_KERNEL);
if (!h)
return ERR_PTR(-ENOMEM);
@@ -1273,7 +1273,7 @@ static struct config_item *uvcg_extension_make(struct config_group *group, const
opts_item = group->cg_item.ci_parent->ci_parent;
opts = to_f_uvc_opts(opts_item);
- xu = kzalloc(sizeof(*xu), GFP_KERNEL);
+ xu = kzalloc_obj(*xu, GFP_KERNEL);
if (!xu)
return ERR_PTR(-ENOMEM);
@@ -1437,7 +1437,7 @@ static int uvcg_control_class_create_children(struct config_group *parent)
for (i = 0; i < ARRAY_SIZE(names); ++i) {
struct uvcg_control_class_group *group;
- group = kzalloc(sizeof(*group), GFP_KERNEL);
+ group = kzalloc_obj(*group, GFP_KERNEL);
if (!group)
return -ENOMEM;
@@ -1785,7 +1785,7 @@ static int uvcg_streaming_header_allow_link(struct config_item *src,
uvcg_format_set_indices(to_config_group(target));
- format_ptr = kzalloc(sizeof(*format_ptr), GFP_KERNEL);
+ format_ptr = kzalloc_obj(*format_ptr, GFP_KERNEL);
if (!format_ptr) {
ret = -ENOMEM;
goto out;
@@ -1899,7 +1899,7 @@ static struct config_item
{
struct uvcg_streaming_header *h;
- h = kzalloc(sizeof(*h), GFP_KERNEL);
+ h = kzalloc_obj(*h, GFP_KERNEL);
if (!h)
return ERR_PTR(-ENOMEM);
@@ -2163,7 +2163,7 @@ static struct config_item *uvcg_frame_make(struct config_group *group,
struct config_item *opts_item;
struct uvcg_frame_ptr *frame_ptr;
- h = kzalloc(sizeof(*h), GFP_KERNEL);
+ h = kzalloc_obj(*h, GFP_KERNEL);
if (!h)
return ERR_PTR(-ENOMEM);
@@ -2197,7 +2197,7 @@ static struct config_item *uvcg_frame_make(struct config_group *group,
return ERR_PTR(-EINVAL);
}
- frame_ptr = kzalloc(sizeof(*frame_ptr), GFP_KERNEL);
+ frame_ptr = kzalloc_obj(*frame_ptr, GFP_KERNEL);
if (!frame_ptr) {
mutex_unlock(&opts->lock);
kfree(h);
@@ -2483,7 +2483,7 @@ static struct config_group *uvcg_uncompressed_make(struct config_group *group,
if (!color_match)
return ERR_PTR(-EINVAL);
- h = kzalloc(sizeof(*h), GFP_KERNEL);
+ h = kzalloc_obj(*h, GFP_KERNEL);
if (!h)
return ERR_PTR(-ENOMEM);
@@ -2675,7 +2675,7 @@ static struct config_group *uvcg_mjpeg_make(struct config_group *group,
if (!color_match)
return ERR_PTR(-EINVAL);
- h = kzalloc(sizeof(*h), GFP_KERNEL);
+ h = kzalloc_obj(*h, GFP_KERNEL);
if (!h)
return ERR_PTR(-ENOMEM);
@@ -2926,7 +2926,7 @@ static struct config_group *uvcg_framebased_make(struct config_group *group,
if (!color_match)
return ERR_PTR(-EINVAL);
- h = kzalloc(sizeof(*h), GFP_KERNEL);
+ h = kzalloc_obj(*h, GFP_KERNEL);
if (!h)
return ERR_PTR(-ENOMEM);
@@ -3075,7 +3075,7 @@ static struct config_group *uvcg_color_matching_make(struct config_group *group,
{
struct uvcg_color_matching *color_match;
- color_match = kzalloc(sizeof(*color_match), GFP_KERNEL);
+ color_match = kzalloc_obj(*color_match, GFP_KERNEL);
if (!color_match)
return ERR_PTR(-ENOMEM);
@@ -3097,7 +3097,7 @@ static int uvcg_color_matching_create_children(struct config_group *parent)
{
struct uvcg_color_matching *color_match;
- color_match = kzalloc(sizeof(*color_match), GFP_KERNEL);
+ color_match = kzalloc_obj(*color_match, GFP_KERNEL);
if (!color_match)
return -ENOMEM;
@@ -3553,7 +3553,7 @@ static int uvcg_streaming_class_create_children(struct config_group *parent)
for (i = 0; i < ARRAY_SIZE(names); ++i) {
struct uvcg_streaming_class_group *group;
- group = kzalloc(sizeof(*group), GFP_KERNEL);
+ group = kzalloc_obj(*group, GFP_KERNEL);
if (!group)
return -ENOMEM;
diff --git a/drivers/usb/gadget/function/uvc_v4l2.c b/drivers/usb/gadget/function/uvc_v4l2.c
index fd4b998ccd16..574b3a8986a0 100644
--- a/drivers/usb/gadget/function/uvc_v4l2.c
+++ b/drivers/usb/gadget/function/uvc_v4l2.c
@@ -667,7 +667,7 @@ uvc_v4l2_open(struct file *file)
struct uvc_device *uvc = video_get_drvdata(vdev);
struct uvc_file_handle *handle;
- handle = kzalloc(sizeof(*handle), GFP_KERNEL);
+ handle = kzalloc_obj(*handle, GFP_KERNEL);
if (handle == NULL)
return -ENOMEM;
diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c
index f568dee08b3b..b2784a57dbcd 100644
--- a/drivers/usb/gadget/function/uvc_video.c
+++ b/drivers/usb/gadget/function/uvc_video.c
@@ -559,7 +559,7 @@ uvc_video_alloc_requests(struct uvc_video *video)
uvc_video_prep_requests(video);
for (i = 0; i < video->uvc_num_requests; i++) {
- ureq = kzalloc(sizeof(struct uvc_request), GFP_KERNEL);
+ ureq = kzalloc_obj(struct uvc_request, GFP_KERNEL);
if (ureq == NULL)
goto error;
diff --git a/drivers/usb/gadget/legacy/dbgp.c b/drivers/usb/gadget/legacy/dbgp.c
index d70fb5bc2357..af8968ef9380 100644
--- a/drivers/usb/gadget/legacy/dbgp.c
+++ b/drivers/usb/gadget/legacy/dbgp.c
@@ -298,7 +298,7 @@ static int dbgp_bind(struct usb_gadget *gadget,
dbgp.req->length = DBGP_REQ_EP0_LEN;
#ifdef CONFIG_USB_G_DBGP_SERIAL
- dbgp.serial = kzalloc(sizeof(struct gserial), GFP_KERNEL);
+ dbgp.serial = kzalloc_obj(struct gserial, GFP_KERNEL);
if (!dbgp.serial) {
stp = 3;
err = -ENOMEM;
diff --git a/drivers/usb/gadget/legacy/g_ffs.c b/drivers/usb/gadget/legacy/g_ffs.c
index 578556422ea3..98a08efe86dd 100644
--- a/drivers/usb/gadget/legacy/g_ffs.c
+++ b/drivers/usb/gadget/legacy/g_ffs.c
@@ -188,7 +188,7 @@ static int __init gfs_init(void)
/*
* Allocate in one chunk for easier maintenance
*/
- f_ffs[0] = kcalloc(func_num * N_CONF, sizeof(*f_ffs[0]), GFP_KERNEL);
+ f_ffs[0] = kzalloc_objs(*f_ffs[0], func_num * N_CONF, GFP_KERNEL);
if (!f_ffs[0]) {
ret = -ENOMEM;
goto no_func;
@@ -196,7 +196,7 @@ static int __init gfs_init(void)
for (i = 1; i < N_CONF; ++i)
f_ffs[i] = f_ffs[0] + i * func_num;
- fi_ffs = kcalloc(func_num, sizeof(*fi_ffs), GFP_KERNEL);
+ fi_ffs = kzalloc_objs(*fi_ffs, func_num, GFP_KERNEL);
if (!fi_ffs) {
ret = -ENOMEM;
goto no_func;
diff --git a/drivers/usb/gadget/legacy/hid.c b/drivers/usb/gadget/legacy/hid.c
index 3684546e8801..bc25c04daaaf 100644
--- a/drivers/usb/gadget/legacy/hid.c
+++ b/drivers/usb/gadget/legacy/hid.c
@@ -227,7 +227,7 @@ static int hidg_plat_driver_probe(struct platform_device *pdev)
return -ENODEV;
}
- entry = kzalloc(sizeof(*entry), GFP_KERNEL);
+ entry = kzalloc_obj(*entry, GFP_KERNEL);
if (!entry)
return -ENOMEM;
diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
index 62566a8e7451..52512fba80ec 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -173,7 +173,7 @@ static struct dev_data *dev_new (void)
{
struct dev_data *dev;
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ dev = kzalloc_obj(*dev, GFP_KERNEL);
if (!dev)
return NULL;
dev->state = STATE_DEV_DISABLED;
@@ -614,7 +614,7 @@ ep_read_iter(struct kiocb *iocb, struct iov_iter *to)
if (value >= 0 && (copy_to_iter(buf, value, to) != value))
value = -EFAULT;
} else {
- struct kiocb_priv *priv = kzalloc(sizeof *priv, GFP_KERNEL);
+ struct kiocb_priv *priv = kzalloc_obj(*priv, GFP_KERNEL);
value = -ENOMEM;
if (!priv)
goto fail;
@@ -682,7 +682,7 @@ ep_write_iter(struct kiocb *iocb, struct iov_iter *from)
} else if (is_sync_kiocb(iocb)) {
value = ep_io(epdata, buf, len);
} else {
- struct kiocb_priv *priv = kzalloc(sizeof *priv, GFP_KERNEL);
+ struct kiocb_priv *priv = kzalloc_obj(*priv, GFP_KERNEL);
value = -ENOMEM;
if (priv) {
value = ep_aio(iocb, priv, epdata, buf, len);
@@ -1598,7 +1598,7 @@ static int activate_ep_files (struct dev_data *dev)
gadget_for_each_ep (ep, dev->gadget) {
- data = kzalloc(sizeof(*data), GFP_KERNEL);
+ data = kzalloc_obj(*data, GFP_KERNEL);
if (!data)
goto enomem0;
data->state = STATE_EP_DISABLED;
diff --git a/drivers/usb/gadget/legacy/raw_gadget.c b/drivers/usb/gadget/legacy/raw_gadget.c
index 46f343ba48b3..5cb8d262329f 100644
--- a/drivers/usb/gadget/legacy/raw_gadget.c
+++ b/drivers/usb/gadget/legacy/raw_gadget.c
@@ -190,7 +190,7 @@ static struct raw_dev *dev_new(void)
{
struct raw_dev *dev;
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ dev = kzalloc_obj(*dev, GFP_KERNEL);
if (!dev)
return NULL;
/* Matches kref_put() in raw_release(). */
@@ -1251,7 +1251,7 @@ static int raw_ioctl_eps_info(struct raw_dev *dev, unsigned long value)
struct usb_raw_eps_info *info;
struct raw_ep *ep;
- info = kzalloc(sizeof(*info), GFP_KERNEL);
+ info = kzalloc_obj(*info, GFP_KERNEL);
if (!info) {
ret = -ENOMEM;
goto out;
diff --git a/drivers/usb/gadget/udc/amd5536udc_pci.c b/drivers/usb/gadget/udc/amd5536udc_pci.c
index a36913ae31f9..e709bd4976c5 100644
--- a/drivers/usb/gadget/udc/amd5536udc_pci.c
+++ b/drivers/usb/gadget/udc/amd5536udc_pci.c
@@ -95,7 +95,7 @@ static int udc_pci_probe(
}
/* init */
- dev = kzalloc(sizeof(struct udc), GFP_KERNEL);
+ dev = kzalloc_obj(struct udc, GFP_KERNEL);
if (!dev)
return -ENOMEM;
diff --git a/drivers/usb/gadget/udc/aspeed-vhub/core.c b/drivers/usb/gadget/udc/aspeed-vhub/core.c
index 19c1849ae665..4a8b9ff8368f 100644
--- a/drivers/usb/gadget/udc/aspeed-vhub/core.c
+++ b/drivers/usb/gadget/udc/aspeed-vhub/core.c
@@ -78,7 +78,7 @@ struct usb_request *ast_vhub_alloc_request(struct usb_ep *u_ep,
{
struct ast_vhub_req *req;
- req = kzalloc(sizeof(*req), gfp_flags);
+ req = kzalloc_obj(*req, gfp_flags);
if (!req)
return NULL;
return &req->req;
diff --git a/drivers/usb/gadget/udc/aspeed-vhub/dev.c b/drivers/usb/gadget/udc/aspeed-vhub/dev.c
index a09f72772e6e..c79522164f18 100644
--- a/drivers/usb/gadget/udc/aspeed-vhub/dev.c
+++ b/drivers/usb/gadget/udc/aspeed-vhub/dev.c
@@ -560,7 +560,7 @@ int ast_vhub_init_dev(struct ast_vhub *vhub, unsigned int idx)
* endpoint 0.
*/
d->max_epns = min_t(u32, vhub->max_epns, 30);
- d->epns = kcalloc(d->max_epns, sizeof(*d->epns), GFP_KERNEL);
+ d->epns = kzalloc_objs(*d->epns, d->max_epns, GFP_KERNEL);
if (!d->epns)
return -ENOMEM;
@@ -569,7 +569,7 @@ int ast_vhub_init_dev(struct ast_vhub *vhub, unsigned int idx)
* named "parent" devices for each port so we create a sub device
* here for that purpose
*/
- d->port_dev = kzalloc(sizeof(struct device), GFP_KERNEL);
+ d->port_dev = kzalloc_obj(struct device, GFP_KERNEL);
if (!d->port_dev) {
rc = -ENOMEM;
goto fail_alloc;
diff --git a/drivers/usb/gadget/udc/aspeed_udc.c b/drivers/usb/gadget/udc/aspeed_udc.c
index 353bfb1ff0a1..7fc6696b7694 100644
--- a/drivers/usb/gadget/udc/aspeed_udc.c
+++ b/drivers/usb/gadget/udc/aspeed_udc.c
@@ -452,7 +452,7 @@ static struct usb_request *ast_udc_ep_alloc_request(struct usb_ep *_ep,
struct ast_udc_ep *ep = to_ast_ep(_ep);
struct ast_udc_request *req;
- req = kzalloc(sizeof(struct ast_udc_request), gfp_flags);
+ req = kzalloc_obj(struct ast_udc_request, gfp_flags);
if (!req) {
EP_DBG(ep, "request allocation failed\n");
return NULL;
diff --git a/drivers/usb/gadget/udc/at91_udc.c b/drivers/usb/gadget/udc/at91_udc.c
index 42b94d858e37..5aa360ba4f03 100644
--- a/drivers/usb/gadget/udc/at91_udc.c
+++ b/drivers/usb/gadget/udc/at91_udc.c
@@ -585,7 +585,7 @@ at91_ep_alloc_request(struct usb_ep *_ep, gfp_t gfp_flags)
{
struct at91_request *req;
- req = kzalloc(sizeof (struct at91_request), gfp_flags);
+ req = kzalloc_obj(struct at91_request, gfp_flags);
if (!req)
return NULL;
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 0c6f2ad81d37..427535bf35a6 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -40,7 +40,7 @@ static int queue_dbg_open(struct inode *inode, struct file *file)
struct usba_request *req, *req_copy;
struct list_head *queue_data;
- queue_data = kmalloc(sizeof(*queue_data), GFP_KERNEL);
+ queue_data = kmalloc_obj(*queue_data, GFP_KERNEL);
if (!queue_data)
return -ENOMEM;
INIT_LIST_HEAD(queue_data);
@@ -702,7 +702,7 @@ usba_ep_alloc_request(struct usb_ep *_ep, gfp_t gfp_flags)
DBG(DBG_GADGET, "ep_alloc_request: %p, 0x%x\n", _ep, gfp_flags);
- req = kzalloc(sizeof(*req), gfp_flags);
+ req = kzalloc_obj(*req, gfp_flags);
if (!req)
return NULL;
diff --git a/drivers/usb/gadget/udc/bcm63xx_udc.c b/drivers/usb/gadget/udc/bcm63xx_udc.c
index 502612a5650e..c4f9ea45bdbb 100644
--- a/drivers/usb/gadget/udc/bcm63xx_udc.c
+++ b/drivers/usb/gadget/udc/bcm63xx_udc.c
@@ -1115,7 +1115,7 @@ static struct usb_request *bcm63xx_udc_alloc_request(struct usb_ep *ep,
{
struct bcm63xx_req *breq;
- breq = kzalloc(sizeof(*breq), mem_flags);
+ breq = kzalloc_obj(*breq, mem_flags);
if (!breq)
return NULL;
return &breq->req;
diff --git a/drivers/usb/gadget/udc/bdc/bdc_core.c b/drivers/usb/gadget/udc/bdc/bdc_core.c
index f47aac078f6b..51602d9eca02 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_core.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_core.c
@@ -397,8 +397,8 @@ static int bdc_mem_alloc(struct bdc *bdc)
"ieps:%d eops:%d num_eps:%d\n",
num_ieps, num_oeps, bdc->num_eps);
/* allocate array of ep pointers */
- bdc->bdc_ep_array = kcalloc(bdc->num_eps, sizeof(struct bdc_ep *),
- GFP_KERNEL);
+ bdc->bdc_ep_array = kzalloc_objs(struct bdc_ep *, bdc->num_eps,
+ GFP_KERNEL);
if (!bdc->bdc_ep_array)
goto fail;
diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c b/drivers/usb/gadget/udc/bdc/bdc_ep.c
index f995cfa9b99e..a7f2fe29e433 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_ep.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c
@@ -138,16 +138,15 @@ static int ep_bd_list_alloc(struct bdc_ep *ep)
__func__, ep, num_tabs);
/* Allocate memory for table array */
- ep->bd_list.bd_table_array = kcalloc(num_tabs,
- sizeof(struct bd_table *),
- GFP_ATOMIC);
+ ep->bd_list.bd_table_array = kzalloc_objs(struct bd_table *, num_tabs,
+ GFP_ATOMIC);
if (!ep->bd_list.bd_table_array)
return -ENOMEM;
/* Allocate memory for each table */
for (index = 0; index < num_tabs; index++) {
/* Allocate memory for bd_table structure */
- bd_table = kzalloc(sizeof(*bd_table), GFP_ATOMIC);
+ bd_table = kzalloc_obj(*bd_table, GFP_ATOMIC);
if (!bd_table)
goto fail;
@@ -1829,7 +1828,7 @@ static struct usb_request *bdc_gadget_alloc_request(struct usb_ep *_ep,
struct bdc_req *req;
struct bdc_ep *ep;
- req = kzalloc(sizeof(*req), gfp_flags);
+ req = kzalloc_obj(*req, gfp_flags);
if (!req)
return NULL;
@@ -1946,7 +1945,7 @@ static int init_ep(struct bdc *bdc, u32 epnum, u32 dir)
struct bdc_ep *ep;
dev_dbg(bdc->dev, "%s epnum=%d dir=%d\n", __func__, epnum, dir);
- ep = kzalloc(sizeof(*ep), GFP_KERNEL);
+ ep = kzalloc_obj(*ep, GFP_KERNEL);
if (!ep)
return -ENOMEM;
diff --git a/drivers/usb/gadget/udc/cdns2/cdns2-gadget.c b/drivers/usb/gadget/udc/cdns2/cdns2-gadget.c
index 9b53daf76583..308d3c468ab1 100644
--- a/drivers/usb/gadget/udc/cdns2/cdns2-gadget.c
+++ b/drivers/usb/gadget/udc/cdns2/cdns2-gadget.c
@@ -1505,7 +1505,7 @@ struct usb_request *cdns2_gadget_ep_alloc_request(struct usb_ep *ep,
struct cdns2_endpoint *pep = ep_to_cdns2_ep(ep);
struct cdns2_request *preq;
- preq = kzalloc(sizeof(*preq), gfp_flags);
+ preq = kzalloc_obj(*preq, gfp_flags);
if (!preq)
return NULL;
diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
index 8dbe79bdc0f9..394ed540c22f 100644
--- a/drivers/usb/gadget/udc/core.c
+++ b/drivers/usb/gadget/udc/core.c
@@ -1393,7 +1393,7 @@ int usb_add_gadget(struct usb_gadget *gadget)
struct usb_udc *udc;
int ret = -ENOMEM;
- udc = kzalloc(sizeof(*udc), GFP_KERNEL);
+ udc = kzalloc_obj(*udc, GFP_KERNEL);
if (!udc)
goto error;
diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
index 1cefca660773..e183f36b2b0b 100644
--- a/drivers/usb/gadget/udc/dummy_hcd.c
+++ b/drivers/usb/gadget/udc/dummy_hcd.c
@@ -666,7 +666,7 @@ static struct usb_request *dummy_alloc_request(struct usb_ep *_ep,
if (!_ep)
return NULL;
- req = kzalloc(sizeof(*req), mem_flags);
+ req = kzalloc_obj(*req, mem_flags);
if (!req)
return NULL;
INIT_LIST_HEAD(&req->queue);
@@ -1270,7 +1270,7 @@ static int dummy_urb_enqueue(
unsigned long flags;
int rc;
- urbp = kmalloc(sizeof *urbp, mem_flags);
+ urbp = kmalloc_obj(*urbp, mem_flags);
if (!urbp)
return -ENOMEM;
urbp->urb = urb;
@@ -2819,7 +2819,7 @@ static int __init dummy_hcd_init(void)
}
}
for (i = 0; i < mod_data.num; i++) {
- dum[i] = kzalloc(sizeof(struct dummy), GFP_KERNEL);
+ dum[i] = kzalloc_obj(struct dummy, GFP_KERNEL);
if (!dum[i]) {
retval = -ENOMEM;
goto err_add_pdata;
diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c b/drivers/usb/gadget/udc/fsl_qe_udc.c
index aacfde06387c..edbffafa6fa7 100644
--- a/drivers/usb/gadget/udc/fsl_qe_udc.c
+++ b/drivers/usb/gadget/udc/fsl_qe_udc.c
@@ -417,7 +417,7 @@ static int qe_ep_rxbd_update(struct qe_ep *ep)
bd = ep->rxbase;
- ep->rxframe = kmalloc(sizeof(*ep->rxframe), GFP_ATOMIC);
+ ep->rxframe = kmalloc_obj(*ep->rxframe, GFP_ATOMIC);
if (!ep->rxframe)
return -ENOMEM;
@@ -666,7 +666,7 @@ static int qe_ep_init(struct qe_udc *udc,
}
if ((ep->tm == USBP_TM_CTL) || (ep->dir == USB_DIR_IN)) {
- ep->txframe = kmalloc(sizeof(*ep->txframe), GFP_ATOMIC);
+ ep->txframe = kmalloc_obj(*ep->txframe, GFP_ATOMIC);
if (!ep->txframe)
goto en_done2;
qe_frame_init(ep->txframe);
@@ -1670,7 +1670,7 @@ static struct usb_request *qe_alloc_request(struct usb_ep *_ep, gfp_t gfp_flags)
{
struct qe_req *req;
- req = kzalloc(sizeof(*req), gfp_flags);
+ req = kzalloc_obj(*req, gfp_flags);
if (!req)
return NULL;
@@ -2344,7 +2344,7 @@ static struct qe_udc *qe_udc_config(struct platform_device *ofdev)
u64 size;
u32 offset;
- udc = kzalloc(sizeof(*udc), GFP_KERNEL);
+ udc = kzalloc_obj(*udc, GFP_KERNEL);
if (!udc)
goto cleanup;
diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c
index 4dea8bc30cf6..961728e92a88 100644
--- a/drivers/usb/gadget/udc/fsl_udc_core.c
+++ b/drivers/usb/gadget/udc/fsl_udc_core.c
@@ -678,7 +678,7 @@ fsl_alloc_request(struct usb_ep *_ep, gfp_t gfp_flags)
{
struct fsl_req *req;
- req = kzalloc(sizeof *req, gfp_flags);
+ req = kzalloc_obj(*req, gfp_flags);
if (!req)
return NULL;
@@ -2250,7 +2250,7 @@ static int struct_udc_setup(struct fsl_udc *udc,
pdata = dev_get_platdata(&pdev->dev);
udc->phy_mode = pdata->phy_mode;
- udc->eps = kcalloc(udc->max_ep, sizeof(struct fsl_ep), GFP_KERNEL);
+ udc->eps = kzalloc_objs(struct fsl_ep, udc->max_ep, GFP_KERNEL);
if (!udc->eps) {
dev_err(&udc->gadget.dev, "kmalloc udc endpoint status failed\n");
goto eps_alloc_failed;
@@ -2369,7 +2369,7 @@ static int fsl_udc_probe(struct platform_device *pdev)
unsigned int i;
u32 dccparams;
- udc_controller = kzalloc(sizeof(struct fsl_udc), GFP_KERNEL);
+ udc_controller = kzalloc_obj(struct fsl_udc, GFP_KERNEL);
if (udc_controller == NULL)
return -ENOMEM;
diff --git a/drivers/usb/gadget/udc/goku_udc.c b/drivers/usb/gadget/udc/goku_udc.c
index b860c2e76449..f9ddf22c57ef 100644
--- a/drivers/usb/gadget/udc/goku_udc.c
+++ b/drivers/usb/gadget/udc/goku_udc.c
@@ -273,7 +273,7 @@ goku_alloc_request(struct usb_ep *_ep, gfp_t gfp_flags)
if (!_ep)
return NULL;
- req = kzalloc(sizeof *req, gfp_flags);
+ req = kzalloc_obj(*req, gfp_flags);
if (!req)
return NULL;
@@ -1755,7 +1755,7 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id)
}
/* alloc, and start init */
- dev = kzalloc (sizeof *dev, GFP_KERNEL);
+ dev = kzalloc_obj(*dev, GFP_KERNEL);
if (!dev) {
retval = -ENOMEM;
goto err;
diff --git a/drivers/usb/gadget/udc/gr_udc.c b/drivers/usb/gadget/udc/gr_udc.c
index bf5b3c964c18..cdcbfae140e9 100644
--- a/drivers/usb/gadget/udc/gr_udc.c
+++ b/drivers/usb/gadget/udc/gr_udc.c
@@ -347,7 +347,7 @@ static struct usb_request *gr_alloc_request(struct usb_ep *_ep, gfp_t gfp_flags)
{
struct gr_request *req;
- req = kzalloc(sizeof(*req), gfp_flags);
+ req = kzalloc_obj(*req, gfp_flags);
if (!req)
return NULL;
diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c b/drivers/usb/gadget/udc/lpc32xx_udc.c
index 83c7e243dcf9..044c31869cfb 100644
--- a/drivers/usb/gadget/udc/lpc32xx_udc.c
+++ b/drivers/usb/gadget/udc/lpc32xx_udc.c
@@ -1705,7 +1705,7 @@ static struct usb_request *lpc32xx_ep_alloc_request(struct usb_ep *_ep,
{
struct lpc32xx_request *req;
- req = kzalloc(sizeof(struct lpc32xx_request), gfp_flags);
+ req = kzalloc_obj(struct lpc32xx_request, gfp_flags);
if (!req)
return NULL;
diff --git a/drivers/usb/gadget/udc/m66592-udc.c b/drivers/usb/gadget/udc/m66592-udc.c
index 54885175b8a4..08ae3d5a79ff 100644
--- a/drivers/usb/gadget/udc/m66592-udc.c
+++ b/drivers/usb/gadget/udc/m66592-udc.c
@@ -1330,7 +1330,7 @@ static struct usb_request *m66592_alloc_request(struct usb_ep *_ep,
{
struct m66592_request *req;
- req = kzalloc(sizeof(struct m66592_request), gfp_flags);
+ req = kzalloc_obj(struct m66592_request, gfp_flags);
if (!req)
return NULL;
@@ -1571,7 +1571,7 @@ static int m66592_probe(struct platform_device *pdev)
}
/* initialize ucd */
- m66592 = kzalloc(sizeof(struct m66592), GFP_KERNEL);
+ m66592 = kzalloc_obj(struct m66592, GFP_KERNEL);
if (m66592 == NULL) {
ret = -ENOMEM;
goto clean_up;
diff --git a/drivers/usb/gadget/udc/max3420_udc.c b/drivers/usb/gadget/udc/max3420_udc.c
index 7349ea774adf..11fd61cba5af 100644
--- a/drivers/usb/gadget/udc/max3420_udc.c
+++ b/drivers/usb/gadget/udc/max3420_udc.c
@@ -1007,7 +1007,7 @@ static struct usb_request *max3420_alloc_request(struct usb_ep *_ep,
struct max3420_ep *ep = to_max3420_ep(_ep);
struct max3420_req *req;
- req = kzalloc(sizeof(*req), gfp_flags);
+ req = kzalloc_obj(*req, gfp_flags);
if (!req)
return NULL;
diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c
index 8ea1adc7461d..aa1a88a2aa3b 100644
--- a/drivers/usb/gadget/udc/net2280.c
+++ b/drivers/usb/gadget/udc/net2280.c
@@ -554,7 +554,7 @@ static struct usb_request
}
ep = container_of(_ep, struct net2280_ep, ep);
- req = kzalloc(sizeof(*req), gfp_flags);
+ req = kzalloc_obj(*req, gfp_flags);
if (!req)
return NULL;
@@ -3625,7 +3625,7 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id)
int retval, i;
/* alloc, and start init */
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ dev = kzalloc_obj(*dev, GFP_KERNEL);
if (dev == NULL) {
retval = -ENOMEM;
goto done;
diff --git a/drivers/usb/gadget/udc/omap_udc.c b/drivers/usb/gadget/udc/omap_udc.c
index 062bf2b57d2e..8dda63c38ee5 100644
--- a/drivers/usb/gadget/udc/omap_udc.c
+++ b/drivers/usb/gadget/udc/omap_udc.c
@@ -267,7 +267,7 @@ omap_alloc_request(struct usb_ep *ep, gfp_t gfp_flags)
{
struct omap_req *req;
- req = kzalloc(sizeof(*req), gfp_flags);
+ req = kzalloc_obj(*req, gfp_flags);
if (!req)
return NULL;
@@ -2627,7 +2627,7 @@ omap_udc_setup(struct platform_device *odev, struct usb_phy *xceiv)
/* UDC_PULLUP_EN gates the chip clock */
/* OTG_SYSCON_1 |= DEV_IDLE_EN; */
- udc = kzalloc(sizeof(*udc), GFP_KERNEL);
+ udc = kzalloc_obj(*udc, GFP_KERNEL);
if (!udc)
return -ENOMEM;
diff --git a/drivers/usb/gadget/udc/pch_udc.c b/drivers/usb/gadget/udc/pch_udc.c
index 0b20ecbe64f9..0a6886428739 100644
--- a/drivers/usb/gadget/udc/pch_udc.c
+++ b/drivers/usb/gadget/udc/pch_udc.c
@@ -1717,7 +1717,7 @@ static struct usb_request *pch_udc_alloc_request(struct usb_ep *usbep,
if (!usbep)
return NULL;
ep = container_of(usbep, struct pch_udc_ep, ep);
- req = kzalloc(sizeof *req, gfp);
+ req = kzalloc_obj(*req, gfp);
if (!req)
return NULL;
req->req.dma = DMA_ADDR_INVALID;
diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c b/drivers/usb/gadget/udc/pxa25x_udc.c
index b97fb7b0cb2c..b3d58d7c3a77 100644
--- a/drivers/usb/gadget/udc/pxa25x_udc.c
+++ b/drivers/usb/gadget/udc/pxa25x_udc.c
@@ -508,7 +508,7 @@ pxa25x_ep_alloc_request (struct usb_ep *_ep, gfp_t gfp_flags)
{
struct pxa25x_request *req;
- req = kzalloc(sizeof(*req), gfp_flags);
+ req = kzalloc_obj(*req, gfp_flags);
if (!req)
return NULL;
diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c
index 897f53601b5b..4fac477d24c0 100644
--- a/drivers/usb/gadget/udc/pxa27x_udc.c
+++ b/drivers/usb/gadget/udc/pxa27x_udc.c
@@ -573,7 +573,7 @@ pxa_ep_alloc_request(struct usb_ep *_ep, gfp_t gfp_flags)
{
struct pxa27x_request *req;
- req = kzalloc(sizeof *req, gfp_flags);
+ req = kzalloc_obj(*req, gfp_flags);
if (!req)
return NULL;
diff --git a/drivers/usb/gadget/udc/r8a66597-udc.c b/drivers/usb/gadget/udc/r8a66597-udc.c
index e5c2630e3711..e7a5d8553c0e 100644
--- a/drivers/usb/gadget/udc/r8a66597-udc.c
+++ b/drivers/usb/gadget/udc/r8a66597-udc.c
@@ -1580,7 +1580,7 @@ static struct usb_request *r8a66597_alloc_request(struct usb_ep *_ep,
{
struct r8a66597_request *req;
- req = kzalloc(sizeof(struct r8a66597_request), gfp_flags);
+ req = kzalloc_obj(struct r8a66597_request, gfp_flags);
if (!req)
return NULL;
diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
index 7cdcc9d16b8b..b0b264d34919 100644
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -2265,7 +2265,7 @@ static struct usb_request *__renesas_usb3_ep_alloc_request(gfp_t gfp_flags)
{
struct renesas_usb3_request *usb3_req;
- usb3_req = kzalloc(sizeof(struct renesas_usb3_request), gfp_flags);
+ usb3_req = kzalloc_obj(struct renesas_usb3_request, gfp_flags);
if (!usb3_req)
return NULL;
diff --git a/drivers/usb/gadget/udc/renesas_usbf.c b/drivers/usb/gadget/udc/renesas_usbf.c
index 4c201574a0af..5d510665da1f 100644
--- a/drivers/usb/gadget/udc/renesas_usbf.c
+++ b/drivers/usb/gadget/udc/renesas_usbf.c
@@ -2081,7 +2081,7 @@ static struct usb_request *usbf_ep_alloc_request(struct usb_ep *_ep,
if (!_ep)
return NULL;
- req = kzalloc(sizeof(*req), gfp_flags);
+ req = kzalloc_obj(*req, gfp_flags);
if (!req)
return NULL;
diff --git a/drivers/usb/gadget/udc/snps_udc_core.c b/drivers/usb/gadget/udc/snps_udc_core.c
index 373942ceb076..5f9514623956 100644
--- a/drivers/usb/gadget/udc/snps_udc_core.c
+++ b/drivers/usb/gadget/udc/snps_udc_core.c
@@ -523,7 +523,7 @@ udc_alloc_request(struct usb_ep *usbep, gfp_t gfp)
ep = container_of(usbep, struct udc_ep, ep);
VDBG(ep->dev, "udc_alloc_req(): ep%d\n", ep->num);
- req = kzalloc(sizeof(struct udc_request), gfp);
+ req = kzalloc_obj(struct udc_request, gfp);
if (!req)
return NULL;
diff --git a/drivers/usb/gadget/udc/tegra-xudc.c b/drivers/usb/gadget/udc/tegra-xudc.c
index 7f7251c10e95..e9d33be02866 100644
--- a/drivers/usb/gadget/udc/tegra-xudc.c
+++ b/drivers/usb/gadget/udc/tegra-xudc.c
@@ -1906,7 +1906,7 @@ tegra_xudc_ep_alloc_request(struct usb_ep *usb_ep, gfp_t gfp)
{
struct tegra_xudc_request *req;
- req = kzalloc(sizeof(*req), gfp);
+ req = kzalloc_obj(*req, gfp);
if (!req)
return NULL;
diff --git a/drivers/usb/gadget/udc/udc-xilinx.c b/drivers/usb/gadget/udc/udc-xilinx.c
index 8d803a612bb1..bef06fe7543b 100644
--- a/drivers/usb/gadget/udc/udc-xilinx.c
+++ b/drivers/usb/gadget/udc/udc-xilinx.c
@@ -970,7 +970,7 @@ static struct usb_request *xudc_ep_alloc_request(struct usb_ep *_ep,
struct xusb_ep *ep = to_xusb_ep(_ep);
struct xusb_req *req;
- req = kzalloc(sizeof(*req), gfp_flags);
+ req = kzalloc_obj(*req, gfp_flags);
if (!req)
return NULL;
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 435001128221..cc3f2da39d71 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -629,7 +629,7 @@ static ssize_t fill_periodic_buffer(struct debug_buffer *buf)
unsigned i;
__hc32 tag;
- seen = kmalloc_array(DBG_SCHED_LIMIT, sizeof(*seen), GFP_ATOMIC);
+ seen = kmalloc_objs(*seen, DBG_SCHED_LIMIT, GFP_ATOMIC);
if (!seen)
return 0;
seen_count = 0;
@@ -917,7 +917,7 @@ static struct debug_buffer *alloc_buffer(struct usb_bus *bus,
{
struct debug_buffer *buf;
- buf = kzalloc(sizeof(*buf), GFP_KERNEL);
+ buf = kzalloc_obj(*buf, GFP_KERNEL);
if (buf) {
buf->bus = bus;
diff --git a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c
index 4c6c08b675b5..a2d4499e67e0 100644
--- a/drivers/usb/host/ehci-mem.c
+++ b/drivers/usb/host/ehci-mem.c
@@ -69,7 +69,7 @@ static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, gfp_t flags)
struct ehci_qh *qh;
dma_addr_t dma;
- qh = kzalloc(sizeof *qh, GFP_ATOMIC);
+ qh = kzalloc_obj(*qh, GFP_ATOMIC);
if (!qh)
goto done;
qh->hw = (struct ehci_qh_hw *)
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index 7e834587e7de..a241337c9af8 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -117,9 +117,8 @@ static struct ehci_tt *find_tt(struct usb_device *udev)
if (utt->multi) {
tt_index = utt->hcpriv;
if (!tt_index) { /* Create the index array */
- tt_index = kcalloc(utt->hub->maxchild,
- sizeof(*tt_index),
- GFP_ATOMIC);
+ tt_index = kzalloc_objs(*tt_index, utt->hub->maxchild,
+ GFP_ATOMIC);
if (!tt_index)
return ERR_PTR(-ENOMEM);
utt->hcpriv = tt_index;
@@ -137,7 +136,7 @@ static struct ehci_tt *find_tt(struct usb_device *udev)
struct ehci_hcd *ehci =
hcd_to_ehci(bus_to_hcd(udev->bus));
- tt = kzalloc(sizeof(*tt), GFP_ATOMIC);
+ tt = kzalloc_obj(*tt, GFP_ATOMIC);
if (!tt) {
if (allocated_index) {
utt->hcpriv = NULL;
@@ -1003,7 +1002,7 @@ iso_stream_alloc(gfp_t mem_flags)
{
struct ehci_iso_stream *stream;
- stream = kzalloc(sizeof(*stream), mem_flags);
+ stream = kzalloc_obj(*stream, mem_flags);
if (likely(stream != NULL)) {
INIT_LIST_HEAD(&stream->td_list);
INIT_LIST_HEAD(&stream->free_list);
@@ -1167,7 +1166,7 @@ iso_sched_alloc(unsigned packets, gfp_t mem_flags)
{
struct ehci_iso_sched *iso_sched;
- iso_sched = kzalloc(struct_size(iso_sched, packet, packets), mem_flags);
+ iso_sched = kzalloc_flex(*iso_sched, packet, packets, mem_flags);
if (likely(iso_sched != NULL))
INIT_LIST_HEAD(&iso_sched->td_list);
diff --git a/drivers/usb/host/fhci-hcd.c b/drivers/usb/host/fhci-hcd.c
index 22a0942f0bce..445847b92f33 100644
--- a/drivers/usb/host/fhci-hcd.c
+++ b/drivers/usb/host/fhci-hcd.c
@@ -193,7 +193,7 @@ static int fhci_mem_init(struct fhci_hcd *fhci)
{
int i;
- fhci->hc_list = kzalloc(sizeof(*fhci->hc_list), GFP_KERNEL);
+ fhci->hc_list = kzalloc_obj(*fhci->hc_list, GFP_KERNEL);
if (!fhci->hc_list)
goto err;
@@ -203,7 +203,7 @@ static int fhci_mem_init(struct fhci_hcd *fhci)
INIT_LIST_HEAD(&fhci->hc_list->intr_list);
INIT_LIST_HEAD(&fhci->hc_list->done_list);
- fhci->vroot_hub = kzalloc(sizeof(*fhci->vroot_hub), GFP_KERNEL);
+ fhci->vroot_hub = kzalloc_obj(*fhci->vroot_hub, GFP_KERNEL);
if (!fhci->vroot_hub)
goto err;
@@ -217,7 +217,7 @@ static int fhci_mem_init(struct fhci_hcd *fhci)
for (i = 0; i < MAX_TDS; i++) {
struct td *td;
- td = kmalloc(sizeof(*td), GFP_KERNEL);
+ td = kmalloc_obj(*td, GFP_KERNEL);
if (!td)
goto err;
fhci_recycle_empty_td(fhci, td);
@@ -225,7 +225,7 @@ static int fhci_mem_init(struct fhci_hcd *fhci)
for (i = 0; i < MAX_EDS; i++) {
struct ed *ed;
- ed = kmalloc(sizeof(*ed), GFP_KERNEL);
+ ed = kmalloc_obj(*ed, GFP_KERNEL);
if (!ed)
goto err;
fhci_recycle_empty_ed(fhci, ed);
@@ -264,7 +264,7 @@ static int fhci_usb_init(struct fhci_hcd *fhci)
usb->max_frame_usage = FRAME_TIME_USAGE;
usb->sw_transaction_time = SW_FIX_TIME_BETWEEN_TRANSACTION;
- usb->actual_frame = kzalloc(sizeof(*usb->actual_frame), GFP_KERNEL);
+ usb->actual_frame = kzalloc_obj(*usb->actual_frame, GFP_KERNEL);
if (!usb->actual_frame) {
fhci_usb_free(usb);
return -ENOMEM;
@@ -306,7 +306,7 @@ static struct fhci_usb *fhci_create_lld(struct fhci_hcd *fhci)
struct fhci_usb *usb;
/* allocate memory for SCC data structure */
- usb = kzalloc(sizeof(*usb), GFP_KERNEL);
+ usb = kzalloc_obj(*usb, GFP_KERNEL);
if (!usb)
return NULL;
@@ -426,12 +426,12 @@ static int fhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
}
/* allocate the private part of the URB */
- urb_priv = kzalloc(sizeof(*urb_priv), mem_flags);
+ urb_priv = kzalloc_obj(*urb_priv, mem_flags);
if (!urb_priv)
return -ENOMEM;
/* allocate the private part of the URB */
- urb_priv->tds = kcalloc(size, sizeof(*urb_priv->tds), mem_flags);
+ urb_priv->tds = kzalloc_objs(*urb_priv->tds, size, mem_flags);
if (!urb_priv->tds) {
kfree(urb_priv);
return -ENOMEM;
diff --git a/drivers/usb/host/fhci-mem.c b/drivers/usb/host/fhci-mem.c
index 658aedc6adc1..d5951fc1964a 100644
--- a/drivers/usb/host/fhci-mem.c
+++ b/drivers/usb/host/fhci-mem.c
@@ -42,7 +42,7 @@ static struct td *get_empty_td(struct fhci_hcd *fhci)
td = list_entry(fhci->empty_tds.next, struct td, node);
list_del(fhci->empty_tds.next);
} else {
- td = kmalloc(sizeof(*td), GFP_ATOMIC);
+ td = kmalloc_obj(*td, GFP_ATOMIC);
if (!td)
fhci_err(fhci, "No memory to allocate to TD\n");
else
@@ -66,7 +66,7 @@ struct ed *fhci_get_empty_ed(struct fhci_hcd *fhci)
ed = list_entry(fhci->empty_eds.next, struct ed, node);
list_del(fhci->empty_eds.next);
} else {
- ed = kmalloc(sizeof(*ed), GFP_ATOMIC);
+ ed = kmalloc_obj(*ed, GFP_ATOMIC);
if (!ed)
fhci_err(fhci, "No memory to allocate to ED\n");
else
diff --git a/drivers/usb/host/fhci-tds.c b/drivers/usb/host/fhci-tds.c
index d98fd9e1af0b..6fb4feb4ad7b 100644
--- a/drivers/usb/host/fhci-tds.c
+++ b/drivers/usb/host/fhci-tds.c
@@ -161,7 +161,7 @@ u32 fhci_create_ep(struct fhci_usb *usb, enum fhci_mem_alloc data_mem,
return -EINVAL;
}
- ep = kzalloc(sizeof(*ep), GFP_KERNEL);
+ ep = kzalloc_obj(*ep, GFP_KERNEL);
if (!ep)
return -ENOMEM;
@@ -183,7 +183,7 @@ u32 fhci_create_ep(struct fhci_usb *usb, enum fhci_mem_alloc data_mem,
struct packet *pkt;
u8 *buff;
- pkt = kmalloc(sizeof(*pkt), GFP_KERNEL);
+ pkt = kmalloc_obj(*pkt, GFP_KERNEL);
if (!pkt) {
err_for = "frame";
goto err;
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index 71c22c4bd163..b5e9056895e4 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -703,7 +703,7 @@ static int isp116x_urb_enqueue(struct usb_hcd *hcd,
}
/* avoid all allocations within spinlocks: request or endpoint */
if (!hep->hcpriv) {
- ep = kzalloc(sizeof *ep, mem_flags);
+ ep = kzalloc_obj(*ep, mem_flags);
if (!ep)
return -ENOMEM;
}
diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c
index 4b5f03f683f7..82e231e05dc2 100644
--- a/drivers/usb/host/max3421-hcd.c
+++ b/drivers/usb/host/max3421-hcd.c
@@ -1523,7 +1523,7 @@ max3421_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags)
max3421_ep = urb->ep->hcpriv;
if (!max3421_ep) {
/* gets freed in max3421_endpoint_disable: */
- max3421_ep = kzalloc(sizeof(struct max3421_ep), GFP_ATOMIC);
+ max3421_ep = kzalloc_obj(struct max3421_ep, GFP_ATOMIC);
if (!max3421_ep) {
retval = -ENOMEM;
goto out;
@@ -1878,10 +1878,10 @@ max3421_probe(struct spi_device *spi)
INIT_LIST_HEAD(&max3421_hcd->ep_list);
spi_set_drvdata(spi, max3421_hcd);
- max3421_hcd->tx = kmalloc(sizeof(*max3421_hcd->tx), GFP_KERNEL);
+ max3421_hcd->tx = kmalloc_obj(*max3421_hcd->tx, GFP_KERNEL);
if (!max3421_hcd->tx)
goto error;
- max3421_hcd->rx = kmalloc(sizeof(*max3421_hcd->rx), GFP_KERNEL);
+ max3421_hcd->rx = kmalloc_obj(*max3421_hcd->rx, GFP_KERNEL);
if (!max3421_hcd->rx)
goto error;
diff --git a/drivers/usb/host/octeon-hcd.c b/drivers/usb/host/octeon-hcd.c
index 361d33b0c4d2..34ce771fa0f5 100644
--- a/drivers/usb/host/octeon-hcd.c
+++ b/drivers/usb/host/octeon-hcd.c
@@ -1098,7 +1098,7 @@ static struct cvmx_usb_pipe *cvmx_usb_open_pipe(struct octeon_hcd *usb,
{
struct cvmx_usb_pipe *pipe;
- pipe = kzalloc(sizeof(*pipe), GFP_ATOMIC);
+ pipe = kzalloc_obj(*pipe, GFP_ATOMIC);
if (!pipe)
return NULL;
if ((device_speed == CVMX_USB_SPEED_HIGH) &&
@@ -2138,7 +2138,7 @@ static struct cvmx_usb_transaction *cvmx_usb_submit_transaction(
if (unlikely(pipe->transfer_type != type))
return NULL;
- transaction = kzalloc(sizeof(*transaction), GFP_ATOMIC);
+ transaction = kzalloc_obj(*transaction, GFP_ATOMIC);
if (unlikely(!transaction))
return NULL;
@@ -3180,9 +3180,8 @@ static int octeon_usb_urb_enqueue(struct usb_hcd *hcd,
* Allocate a structure to use for our private list of
* isochronous packets.
*/
- iso_packet = kmalloc_array(urb->number_of_packets,
- sizeof(struct cvmx_usb_iso_packet),
- GFP_ATOMIC);
+ iso_packet = kmalloc_objs(struct cvmx_usb_iso_packet,
+ urb->number_of_packets, GFP_ATOMIC);
if (iso_packet) {
int i;
/* Fill the list with the data from the URB */
diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c
index 76bc8d56325d..30e22acd9461 100644
--- a/drivers/usb/host/ohci-dbg.c
+++ b/drivers/usb/host/ohci-dbg.c
@@ -492,7 +492,7 @@ static ssize_t fill_periodic_buffer(struct debug_buffer *buf)
char *next;
unsigned i;
- seen = kmalloc_array(DBG_SCHED_LIMIT, sizeof(*seen), GFP_ATOMIC);
+ seen = kmalloc_objs(*seen, DBG_SCHED_LIMIT, GFP_ATOMIC);
if (!seen)
return 0;
seen_count = 0;
@@ -667,7 +667,7 @@ static struct debug_buffer *alloc_buffer(struct ohci_hcd *ohci,
{
struct debug_buffer *buf;
- buf = kzalloc(sizeof(struct debug_buffer), GFP_KERNEL);
+ buf = kzalloc_obj(struct debug_buffer, GFP_KERNEL);
if (buf) {
buf->ohci = ohci;
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 30840922f729..129468b1efc2 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -190,7 +190,7 @@ static int ohci_urb_enqueue (
}
/* allocate the private part of the URB */
- urb_priv = kzalloc(struct_size(urb_priv, td, size), mem_flags);
+ urb_priv = kzalloc_flex(*urb_priv, td, size, mem_flags);
if (!urb_priv)
return -ENOMEM;
INIT_LIST_HEAD (&urb_priv->pending);
diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c
index 6b7c73eff081..ca96067e6d6d 100644
--- a/drivers/usb/host/oxu210hp-hcd.c
+++ b/drivers/usb/host/oxu210hp-hcd.c
@@ -1149,7 +1149,7 @@ static int ehci_mem_init(struct oxu_hcd *oxu, gfp_t flags)
for (i = 0; i < QTD_NUM; i++)
oxu->qtd_used[i] = 0;
- oxu->murb_pool = kcalloc(MURB_NUM, sizeof(struct oxu_murb), flags);
+ oxu->murb_pool = kzalloc_objs(struct oxu_murb, MURB_NUM, flags);
if (!oxu->murb_pool)
goto fail;
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index d21a03cf5c17..0a26489a40d0 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -337,7 +337,7 @@ static int make_r8a66597_device(struct r8a66597 *r8a66597,
struct r8a66597_device *dev;
int usb_address = urb->setup_packet[2]; /* urb->pipe is address 0 */
- dev = kzalloc(sizeof(struct r8a66597_device), GFP_ATOMIC);
+ dev = kzalloc_obj(struct r8a66597_device, GFP_ATOMIC);
if (dev == NULL)
return -ENOMEM;
@@ -1859,7 +1859,7 @@ static struct r8a66597_td *r8a66597_make_td(struct r8a66597 *r8a66597,
struct r8a66597_td *td;
u16 pipenum;
- td = kzalloc(sizeof(struct r8a66597_td), GFP_ATOMIC);
+ td = kzalloc_obj(struct r8a66597_td, GFP_ATOMIC);
if (td == NULL)
return NULL;
@@ -1901,8 +1901,7 @@ static int r8a66597_urb_enqueue(struct usb_hcd *hcd,
goto error_not_linked;
if (!hep->hcpriv) {
- hep->hcpriv = kzalloc(sizeof(struct r8a66597_pipe),
- GFP_ATOMIC);
+ hep->hcpriv = kzalloc_obj(struct r8a66597_pipe, GFP_ATOMIC);
if (!hep->hcpriv) {
ret = -ENOMEM;
goto error;
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index 5d6dba681e50..4ae47edd4b8b 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -814,7 +814,7 @@ static int sl811h_urb_enqueue(
/* avoid all allocations within spinlocks */
if (!hep->hcpriv) {
- ep = kzalloc(sizeof *ep, mem_flags);
+ ep = kzalloc_obj(*ep, mem_flags);
if (ep == NULL)
return -ENOMEM;
}
diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c
index 16d157013018..afdbcac3185c 100644
--- a/drivers/usb/host/sl811_cs.c
+++ b/drivers/usb/host/sl811_cs.c
@@ -178,7 +178,7 @@ static int sl811_cs_probe(struct pcmcia_device *link)
{
local_info_t *local;
- local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
+ local = kzalloc_obj(local_info_t, GFP_KERNEL);
if (!local)
return -ENOMEM;
local->p_dev = link;
diff --git a/drivers/usb/host/uhci-debug.c b/drivers/usb/host/uhci-debug.c
index c4e67c4b51f6..675107e9bae0 100644
--- a/drivers/usb/host/uhci-debug.c
+++ b/drivers/usb/host/uhci-debug.c
@@ -561,7 +561,7 @@ static int uhci_debug_open(struct inode *inode, struct file *file)
struct uhci_debug *up;
unsigned long flags;
- up = kmalloc(sizeof(*up), GFP_KERNEL);
+ up = kmalloc_obj(*up, GFP_KERNEL);
if (!up)
return -ENOMEM;
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index 8bb11109b66c..027c3798a581 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -603,8 +603,8 @@ static int uhci_start(struct usb_hcd *hcd)
goto err_alloc_frame;
}
- uhci->frame_cpu = kcalloc(UHCI_NUMFRAMES, sizeof(*uhci->frame_cpu),
- GFP_KERNEL);
+ uhci->frame_cpu = kzalloc_objs(*uhci->frame_cpu, UHCI_NUMFRAMES,
+ GFP_KERNEL);
if (!uhci->frame_cpu)
goto err_alloc_frame_cpu;
diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c
index 9fd497e0dc7f..31995b12598f 100644
--- a/drivers/usb/host/xhci-dbgcap.c
+++ b/drivers/usb/host/xhci-dbgcap.c
@@ -238,7 +238,7 @@ dbc_alloc_request(struct xhci_dbc *dbc, unsigned int direction, gfp_t flags)
if (!dbc)
return NULL;
- req = kzalloc(sizeof(*req), flags);
+ req = kzalloc_obj(*req, flags);
if (!req)
return NULL;
@@ -446,7 +446,7 @@ dbc_alloc_ctx(struct device *dev, gfp_t flags)
{
struct xhci_container_ctx *ctx;
- ctx = kzalloc(sizeof(*ctx), flags);
+ ctx = kzalloc_obj(*ctx, flags);
if (!ctx)
return NULL;
@@ -503,14 +503,14 @@ xhci_dbc_ring_alloc(struct device *dev, enum xhci_ring_type type, gfp_t flags)
struct xhci_segment *seg;
dma_addr_t dma;
- ring = kzalloc(sizeof(*ring), flags);
+ ring = kzalloc_obj(*ring, flags);
if (!ring)
return NULL;
ring->num_segs = 1;
ring->type = type;
- seg = kzalloc(sizeof(*seg), flags);
+ seg = kzalloc_obj(*seg, flags);
if (!seg)
goto seg_fail;
@@ -1425,7 +1425,7 @@ xhci_alloc_dbc(struct device *dev, void __iomem *base, const struct dbc_driver *
struct xhci_dbc *dbc;
int ret;
- dbc = kzalloc(sizeof(*dbc), GFP_KERNEL);
+ dbc = kzalloc_obj(*dbc, GFP_KERNEL);
if (!dbc)
return NULL;
diff --git a/drivers/usb/host/xhci-dbgtty.c b/drivers/usb/host/xhci-dbgtty.c
index 90282e51e23e..a058277b5ff9 100644
--- a/drivers/usb/host/xhci-dbgtty.c
+++ b/drivers/usb/host/xhci-dbgtty.c
@@ -584,7 +584,7 @@ int xhci_dbc_tty_probe(struct device *dev, void __iomem *base, struct xhci_hcd *
if (!dbc_tty_driver)
return -ENODEV;
- port = kzalloc(sizeof(*port), GFP_KERNEL);
+ port = kzalloc_obj(*port, GFP_KERNEL);
if (!port)
return -ENOMEM;
diff --git a/drivers/usb/host/xhci-debugfs.c b/drivers/usb/host/xhci-debugfs.c
index c1eb1036ede9..296ff14d4e9a 100644
--- a/drivers/usb/host/xhci-debugfs.c
+++ b/drivers/usb/host/xhci-debugfs.c
@@ -87,7 +87,7 @@ static struct xhci_regset *xhci_debugfs_alloc_regset(struct xhci_hcd *xhci)
{
struct xhci_regset *regset;
- regset = kzalloc(sizeof(*regset), GFP_KERNEL);
+ regset = kzalloc_obj(*regset, GFP_KERNEL);
if (!regset)
return NULL;
@@ -468,7 +468,7 @@ void xhci_debugfs_create_endpoint(struct xhci_hcd *xhci,
if (spriv->eps[ep_index])
return;
- epriv = kzalloc(sizeof(*epriv), GFP_KERNEL);
+ epriv = kzalloc_obj(*epriv, GFP_KERNEL);
if (!epriv)
return;
@@ -608,7 +608,7 @@ void xhci_debugfs_create_slot(struct xhci_hcd *xhci, int slot_id)
struct xhci_slot_priv *priv;
struct xhci_virt_device *dev = xhci->devs[slot_id];
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ priv = kzalloc_obj(*priv, GFP_KERNEL);
if (!priv)
return;
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index c708bdd69f16..75bc1eb98b76 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -977,7 +977,7 @@ int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id,
return 0;
}
- dev = kzalloc(sizeof(*dev), flags);
+ dev = kzalloc_obj(*dev, flags);
if (!dev)
return 0;
diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c
index 27eb384a3963..ef255b968ab6 100644
--- a/drivers/usb/host/xhci-mtk-sch.c
+++ b/drivers/usb/host/xhci-mtk-sch.c
@@ -179,8 +179,8 @@ static struct mu3h_sch_tt *find_tt(struct usb_device *udev)
if (utt->multi) {
tt_index = utt->hcpriv;
if (!tt_index) { /* Create the index array */
- tt_index = kcalloc(utt->hub->maxchild,
- sizeof(*tt_index), GFP_KERNEL);
+ tt_index = kzalloc_objs(*tt_index, utt->hub->maxchild,
+ GFP_KERNEL);
if (!tt_index)
return ERR_PTR(-ENOMEM);
utt->hcpriv = tt_index;
@@ -193,7 +193,7 @@ static struct mu3h_sch_tt *find_tt(struct usb_device *udev)
tt = *ptt;
if (!tt) { /* Create the mu3h_sch_tt */
- tt = kzalloc(sizeof(*tt), GFP_KERNEL);
+ tt = kzalloc_obj(*tt, GFP_KERNEL);
if (!tt) {
if (allocated_index) {
utt->hcpriv = NULL;
@@ -264,7 +264,7 @@ create_sch_ep(struct xhci_hcd_mtk *mtk, struct usb_device *udev,
else
len = 1;
- sch_ep = kzalloc(struct_size(sch_ep, bw_budget_table, len), GFP_KERNEL);
+ sch_ep = kzalloc_flex(*sch_ep, bw_budget_table, len, GFP_KERNEL);
if (!sch_ep)
return ERR_PTR(-ENOMEM);
@@ -891,7 +891,7 @@ int xhci_mtk_sch_init(struct xhci_hcd_mtk *mtk)
/* ss IN and OUT are separated */
num_usb_bus = xhci->usb3_rhub.num_ports * 2 + xhci->usb2_rhub.num_ports;
- sch_array = kcalloc(num_usb_bus, sizeof(*sch_array), GFP_KERNEL);
+ sch_array = kzalloc_objs(*sch_array, num_usb_bus, GFP_KERNEL);
if (sch_array == NULL)
return -ENOMEM;
diff --git a/drivers/usb/host/xhci-sideband.c b/drivers/usb/host/xhci-sideband.c
index 2bd77255032b..3ebe22755693 100644
--- a/drivers/usb/host/xhci-sideband.c
+++ b/drivers/usb/host/xhci-sideband.c
@@ -28,11 +28,11 @@ xhci_ring_to_sgtable(struct xhci_sideband *sb, struct xhci_ring *ring)
dev = xhci_to_hcd(sb->xhci)->self.sysdev;
sz = ring->num_segs * TRB_SEGMENT_SIZE;
n_pages = PAGE_ALIGN(sz) >> PAGE_SHIFT;
- pages = kvmalloc_array(n_pages, sizeof(struct page *), GFP_KERNEL);
+ pages = kvmalloc_objs(struct page *, n_pages, GFP_KERNEL);
if (!pages)
return NULL;
- sgt = kzalloc(sizeof(*sgt), GFP_KERNEL);
+ sgt = kzalloc_obj(*sgt, GFP_KERNEL);
if (!sgt) {
kvfree(pages);
return NULL;
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index b3ba16b9718c..c36ab323d68e 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1641,7 +1641,7 @@ static int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag
else
num_tds = 1;
- urb_priv = kzalloc(struct_size(urb_priv, td, num_tds), mem_flags);
+ urb_priv = kzalloc_flex(*urb_priv, td, num_tds, mem_flags);
if (!urb_priv)
return -ENOMEM;
diff --git a/drivers/usb/image/mdc800.c b/drivers/usb/image/mdc800.c
index 7b7e1554ea20..9cb74eb91b07 100644
--- a/drivers/usb/image/mdc800.c
+++ b/drivers/usb/image/mdc800.c
@@ -982,7 +982,7 @@ static int __init usb_mdc800_init (void)
{
int retval = -ENODEV;
/* Allocate Memory */
- mdc800=kzalloc (sizeof (struct mdc800_data), GFP_KERNEL);
+ mdc800=kzalloc_obj(struct mdc800_data, GFP_KERNEL);
if (!mdc800)
goto cleanup_on_fail;
diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c
index 82859374f302..20b0b3736322 100644
--- a/drivers/usb/image/microtek.c
+++ b/drivers/usb/image/microtek.c
@@ -723,7 +723,7 @@ static int mts_usb_probe(struct usb_interface *intf,
}
- new_desc = kzalloc(sizeof(struct mts_desc), GFP_KERNEL);
+ new_desc = kzalloc_obj(struct mts_desc, GFP_KERNEL);
if (!new_desc)
goto out;
diff --git a/drivers/usb/isp1760/isp1760-hcd.c b/drivers/usb/isp1760/isp1760-hcd.c
index 8dcd9cc22413..fbb83c84beee 100644
--- a/drivers/usb/isp1760/isp1760-hcd.c
+++ b/drivers/usb/isp1760/isp1760-hcd.c
@@ -2572,15 +2572,15 @@ int isp1760_hcd_register(struct isp1760_hcd *priv, struct resource *mem,
priv->hcd = hcd;
- priv->atl_slots = kcalloc(mem_layout->slot_num,
- sizeof(struct isp1760_slotinfo), GFP_KERNEL);
+ priv->atl_slots = kzalloc_objs(struct isp1760_slotinfo,
+ mem_layout->slot_num, GFP_KERNEL);
if (!priv->atl_slots) {
ret = -ENOMEM;
goto put_hcd;
}
- priv->int_slots = kcalloc(mem_layout->slot_num,
- sizeof(struct isp1760_slotinfo), GFP_KERNEL);
+ priv->int_slots = kzalloc_objs(struct isp1760_slotinfo,
+ mem_layout->slot_num, GFP_KERNEL);
if (!priv->int_slots) {
ret = -ENOMEM;
goto free_atl_slots;
diff --git a/drivers/usb/isp1760/isp1760-udc.c b/drivers/usb/isp1760/isp1760-udc.c
index 65ac91d0595a..e45a54c4a560 100644
--- a/drivers/usb/isp1760/isp1760-udc.c
+++ b/drivers/usb/isp1760/isp1760-udc.c
@@ -878,7 +878,7 @@ static struct usb_request *isp1760_ep_alloc_request(struct usb_ep *ep,
{
struct isp1760_request *req;
- req = kzalloc(sizeof(*req), gfp_flags);
+ req = kzalloc_obj(*req, gfp_flags);
if (!req)
return NULL;
diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c
index ed6a19254d2f..2c311dc92ab9 100644
--- a/drivers/usb/misc/adutux.c
+++ b/drivers/usb/misc/adutux.c
@@ -657,7 +657,7 @@ static int adu_probe(struct usb_interface *interface,
int res;
/* allocate memory for our device state and initialize it */
- dev = kzalloc(sizeof(struct adu_device), GFP_KERNEL);
+ dev = kzalloc_obj(struct adu_device, GFP_KERNEL);
if (!dev)
return -ENOMEM;
diff --git a/drivers/usb/misc/apple-mfi-fastcharge.c b/drivers/usb/misc/apple-mfi-fastcharge.c
index 47b38dcc2992..8cf08fbda163 100644
--- a/drivers/usb/misc/apple-mfi-fastcharge.c
+++ b/drivers/usb/misc/apple-mfi-fastcharge.c
@@ -184,7 +184,7 @@ static int mfi_fc_probe(struct usb_device *udev)
if (!mfi_fc_match(udev))
return -ENODEV;
- mfi = kzalloc(sizeof(struct mfi_device), GFP_KERNEL);
+ mfi = kzalloc_obj(struct mfi_device, GFP_KERNEL);
if (!mfi)
return -ENOMEM;
diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c
index 62b5a30edc42..e9b26cf7bcfc 100644
--- a/drivers/usb/misc/appledisplay.c
+++ b/drivers/usb/misc/appledisplay.c
@@ -226,7 +226,7 @@ static int appledisplay_probe(struct usb_interface *iface,
int_in_endpointAddr = endpoint->bEndpointAddress;
/* allocate memory for our device state and initialize it */
- pdata = kzalloc(sizeof(struct appledisplay), GFP_KERNEL);
+ pdata = kzalloc_obj(struct appledisplay, GFP_KERNEL);
if (!pdata) {
retval = -ENOMEM;
goto error;
diff --git a/drivers/usb/misc/chaoskey.c b/drivers/usb/misc/chaoskey.c
index 45cff32656c6..039e2b1bba00 100644
--- a/drivers/usb/misc/chaoskey.c
+++ b/drivers/usb/misc/chaoskey.c
@@ -143,7 +143,7 @@ static int chaoskey_probe(struct usb_interface *interface,
/* Looks good, allocate and initialize */
- dev = kzalloc(sizeof(struct chaoskey), GFP_KERNEL);
+ dev = kzalloc_obj(struct chaoskey, GFP_KERNEL);
if (dev == NULL)
goto out;
diff --git a/drivers/usb/misc/cypress_cy7c63.c b/drivers/usb/misc/cypress_cy7c63.c
index 75f5a740cba3..ace0ec94506c 100644
--- a/drivers/usb/misc/cypress_cy7c63.c
+++ b/drivers/usb/misc/cypress_cy7c63.c
@@ -211,7 +211,7 @@ static int cypress_probe(struct usb_interface *interface,
int retval = -ENOMEM;
/* allocate memory for our device state and initialize it */
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ dev = kzalloc_obj(*dev, GFP_KERNEL);
if (!dev)
goto error_mem;
diff --git a/drivers/usb/misc/cytherm.c b/drivers/usb/misc/cytherm.c
index 875016dd073c..6af966118792 100644
--- a/drivers/usb/misc/cytherm.c
+++ b/drivers/usb/misc/cytherm.c
@@ -307,7 +307,7 @@ static int cytherm_probe(struct usb_interface *interface,
struct usb_cytherm *dev;
int retval = -ENOMEM;
- dev = kzalloc(sizeof(struct usb_cytherm), GFP_KERNEL);
+ dev = kzalloc_obj(struct usb_cytherm, GFP_KERNEL);
if (!dev)
goto error_mem;
diff --git a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c
index ea39243efee3..1f649eedfa68 100644
--- a/drivers/usb/misc/idmouse.c
+++ b/drivers/usb/misc/idmouse.c
@@ -330,7 +330,7 @@ static int idmouse_probe(struct usb_interface *interface,
return -ENODEV;
/* allocate memory for our device state and initialize it */
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ dev = kzalloc_obj(*dev, GFP_KERNEL);
if (dev == NULL)
return -ENOMEM;
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c
index 365c10069345..5f882cb6ff07 100644
--- a/drivers/usb/misc/iowarrior.c
+++ b/drivers/usb/misc/iowarrior.c
@@ -777,7 +777,7 @@ static int iowarrior_probe(struct usb_interface *interface,
int res;
/* allocate memory for our device state and initialize it */
- dev = kzalloc(sizeof(struct iowarrior), GFP_KERNEL);
+ dev = kzalloc_obj(struct iowarrior, GFP_KERNEL);
if (!dev)
return retval;
diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c
index f392d6f84df9..cb7125a5b27f 100644
--- a/drivers/usb/misc/ldusb.c
+++ b/drivers/usb/misc/ldusb.c
@@ -656,7 +656,7 @@ static int ld_usb_probe(struct usb_interface *intf, const struct usb_device_id *
/* allocate memory for our device state and initialize it */
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ dev = kzalloc_obj(*dev, GFP_KERNEL);
if (!dev)
goto exit;
mutex_init(&dev->mutex);
diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
index 379cf01a6e96..a2909dee0d2a 100644
--- a/drivers/usb/misc/legousbtower.c
+++ b/drivers/usb/misc/legousbtower.c
@@ -748,7 +748,7 @@ static int tower_probe(struct usb_interface *interface, const struct usb_device_
int result;
/* allocate memory for our device state and initialize it */
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ dev = kzalloc_obj(*dev, GFP_KERNEL);
if (!dev)
goto exit;
diff --git a/drivers/usb/misc/lvstest.c b/drivers/usb/misc/lvstest.c
index 25ec5666a75e..52d84e2d8193 100644
--- a/drivers/usb/misc/lvstest.c
+++ b/drivers/usb/misc/lvstest.c
@@ -260,7 +260,7 @@ static ssize_t get_dev_desc_store(struct device *dev,
struct usb_device_descriptor *descriptor;
int ret;
- descriptor = kmalloc(sizeof(*descriptor), GFP_KERNEL);
+ descriptor = kmalloc_obj(*descriptor, GFP_KERNEL);
if (!descriptor)
return -ENOMEM;
diff --git a/drivers/usb/misc/onboard_usb_dev.c b/drivers/usb/misc/onboard_usb_dev.c
index 41360a7591e5..40572d7192f6 100644
--- a/drivers/usb/misc/onboard_usb_dev.c
+++ b/drivers/usb/misc/onboard_usb_dev.c
@@ -202,7 +202,7 @@ static int onboard_dev_add_usbdev(struct onboard_dev *onboard_dev,
goto error;
}
- node = kzalloc(sizeof(*node), GFP_KERNEL);
+ node = kzalloc_obj(*node, GFP_KERNEL);
if (!node) {
err = -ENOMEM;
goto error;
diff --git a/drivers/usb/misc/onboard_usb_dev_pdevs.c b/drivers/usb/misc/onboard_usb_dev_pdevs.c
index 722504752ce3..2550108bf73c 100644
--- a/drivers/usb/misc/onboard_usb_dev_pdevs.c
+++ b/drivers/usb/misc/onboard_usb_dev_pdevs.c
@@ -109,7 +109,7 @@ void onboard_dev_create_pdevs(struct usb_device *parent_hub, struct list_head *p
goto node_put;
}
- pdle = kzalloc(sizeof(*pdle), GFP_KERNEL);
+ pdle = kzalloc_obj(*pdle, GFP_KERNEL);
if (!pdle) {
of_platform_device_destroy(&pdev->dev, NULL);
goto node_put;
diff --git a/drivers/usb/misc/sisusbvga/sisusbvga.c b/drivers/usb/misc/sisusbvga/sisusbvga.c
index febf34f9f049..be7e7abc47c6 100644
--- a/drivers/usb/misc/sisusbvga/sisusbvga.c
+++ b/drivers/usb/misc/sisusbvga/sisusbvga.c
@@ -2797,7 +2797,7 @@ static int sisusb_probe(struct usb_interface *intf,
dev->devnum);
/* Allocate memory for our private */
- sisusb = kzalloc(sizeof(*sisusb), GFP_KERNEL);
+ sisusb = kzalloc_obj(*sisusb, GFP_KERNEL);
if (!sisusb)
return -ENOMEM;
diff --git a/drivers/usb/misc/trancevibrator.c b/drivers/usb/misc/trancevibrator.c
index 26baba3ab7d7..a43f2ef30433 100644
--- a/drivers/usb/misc/trancevibrator.c
+++ b/drivers/usb/misc/trancevibrator.c
@@ -86,7 +86,7 @@ static int tv_probe(struct usb_interface *interface,
struct trancevibrator *dev;
int retval;
- dev = kzalloc(sizeof(struct trancevibrator), GFP_KERNEL);
+ dev = kzalloc_obj(struct trancevibrator, GFP_KERNEL);
if (!dev) {
retval = -ENOMEM;
goto error;
diff --git a/drivers/usb/misc/usb-ljca.c b/drivers/usb/misc/usb-ljca.c
index 9e65bb9577ea..a959dd824f0e 100644
--- a/drivers/usb/misc/usb-ljca.c
+++ b/drivers/usb/misc/usb-ljca.c
@@ -529,7 +529,7 @@ static int ljca_new_client_device(struct ljca_adapter *adap, u8 type, u8 id,
struct ljca_client *client;
int ret;
- client = kzalloc(sizeof *client, GFP_KERNEL);
+ client = kzalloc_obj(*client, GFP_KERNEL);
if (!client) {
kfree(data);
return -ENOMEM;
@@ -597,7 +597,7 @@ static int ljca_enumerate_gpio(struct ljca_adapter *adap)
return -EINVAL;
/* construct platform data */
- gpio_info = kzalloc(sizeof *gpio_info, GFP_KERNEL);
+ gpio_info = kzalloc_obj(*gpio_info, GFP_KERNEL);
if (!gpio_info)
return -ENOMEM;
gpio_info->num = gpio_num;
@@ -630,7 +630,7 @@ static int ljca_enumerate_i2c(struct ljca_adapter *adap)
for (i = 0; i < desc->num; i++) {
/* construct platform data */
- i2c_info = kzalloc(sizeof *i2c_info, GFP_KERNEL);
+ i2c_info = kzalloc_obj(*i2c_info, GFP_KERNEL);
if (!i2c_info)
return -ENOMEM;
@@ -669,7 +669,7 @@ static int ljca_enumerate_spi(struct ljca_adapter *adap)
for (i = 0; i < desc->num; i++) {
/* construct platform data */
- spi_info = kzalloc(sizeof *spi_info, GFP_KERNEL);
+ spi_info = kzalloc_obj(*spi_info, GFP_KERNEL);
if (!spi_info)
return -ENOMEM;
diff --git a/drivers/usb/misc/usbio.c b/drivers/usb/misc/usbio.c
index 37644dddf157..50ff9f1ca78f 100644
--- a/drivers/usb/misc/usbio.c
+++ b/drivers/usb/misc/usbio.c
@@ -439,7 +439,7 @@ static int usbio_add_client(struct usbio_device *usbio, char *name, u8 id, void
struct auxiliary_device *adev;
int ret;
- client = kzalloc(sizeof(*client), GFP_KERNEL);
+ client = kzalloc_obj(*client, GFP_KERNEL);
if (!client)
return -ENOMEM;
diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c
index bb546f624a45..be798a293904 100644
--- a/drivers/usb/misc/usblcd.c
+++ b/drivers/usb/misc/usblcd.c
@@ -323,7 +323,7 @@ static int lcd_probe(struct usb_interface *interface,
int retval;
/* allocate memory for our device state and initialize it */
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ dev = kzalloc_obj(*dev, GFP_KERNEL);
if (!dev)
return -ENOMEM;
diff --git a/drivers/usb/misc/usbsevseg.c b/drivers/usb/misc/usbsevseg.c
index 546deff754ba..97fcb35513ce 100644
--- a/drivers/usb/misc/usbsevseg.c
+++ b/drivers/usb/misc/usbsevseg.c
@@ -308,7 +308,7 @@ static int sevseg_probe(struct usb_interface *interface,
struct usb_sevsegdev *mydev;
int rc = -ENOMEM;
- mydev = kzalloc(sizeof(struct usb_sevsegdev), GFP_KERNEL);
+ mydev = kzalloc_obj(struct usb_sevsegdev, GFP_KERNEL);
if (!mydev)
goto error_mem;
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index 5c92c8d8e283..689cf82ce47d 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -545,7 +545,7 @@ alloc_sglist(int nents, int max, int vary, struct usbtest_dev *dev, int pipe)
if (max == 0)
return NULL;
- sg = kmalloc_array(nents, sizeof(*sg), GFP_KERNEL);
+ sg = kmalloc_objs(*sg, nents, GFP_KERNEL);
if (!sg)
return NULL;
sg_init_table(sg, nents);
@@ -1221,7 +1221,7 @@ test_ctrl_queue(struct usbtest_dev *dev, struct usbtest_param_32 *param)
* as with bulk/intr sglists, sglen is the queue depth; it also
* controls which subtests run (more tests than sglen) or rerun.
*/
- urb = kcalloc(param->sglen, sizeof(struct urb *), GFP_KERNEL);
+ urb = kzalloc_objs(struct urb *, param->sglen, GFP_KERNEL);
if (!urb)
return -ENOMEM;
for (i = 0; i < param->sglen; i++) {
@@ -1370,7 +1370,7 @@ test_ctrl_queue(struct usbtest_dev *dev, struct usbtest_param_32 *param)
if (!u)
goto cleanup;
- reqp = kmalloc(sizeof(*reqp), GFP_KERNEL);
+ reqp = kmalloc_obj(*reqp, GFP_KERNEL);
if (!reqp)
goto cleanup;
reqp->setup = req;
@@ -1572,7 +1572,7 @@ static int unlink_queued(struct usbtest_dev *dev, int pipe, unsigned num,
memset(buf, 0, size);
/* Allocate and init the urbs we'll queue */
- ctx.urbs = kcalloc(num, sizeof(struct urb *), GFP_KERNEL);
+ ctx.urbs = kzalloc_objs(struct urb *, num, GFP_KERNEL);
if (!ctx.urbs)
goto free_buf;
for (i = 0; i < num; i++) {
@@ -2052,7 +2052,7 @@ test_queue(struct usbtest_dev *dev, struct usbtest_param_32 *param,
if (param->sglen > MAX_SGLEN)
return -EINVAL;
- urbs = kcalloc(param->sglen, sizeof(*urbs), GFP_KERNEL);
+ urbs = kzalloc_objs(*urbs, param->sglen, GFP_KERNEL);
if (!urbs)
return -ENOMEM;
@@ -2786,7 +2786,7 @@ usbtest_probe(struct usb_interface *intf, const struct usb_device_id *id)
}
#endif
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ dev = kzalloc_obj(*dev, GFP_KERNEL);
if (!dev)
return -ENOMEM;
info = (struct usbtest_info *) id->driver_info;
diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c
index b26c1d382d59..46356d099d26 100644
--- a/drivers/usb/misc/uss720.c
+++ b/drivers/usb/misc/uss720.c
@@ -134,7 +134,7 @@ static struct uss720_async_request *submit_async_request(struct parport_uss720_p
usbdev = priv->usbdev;
if (!usbdev)
return NULL;
- rq = kzalloc(sizeof(struct uss720_async_request), mem_flags);
+ rq = kzalloc_obj(struct uss720_async_request, mem_flags);
if (!rq)
return NULL;
kref_init(&rq->ref_count);
@@ -147,7 +147,7 @@ static struct uss720_async_request *submit_async_request(struct parport_uss720_p
kref_put(&rq->ref_count, destroy_async);
return NULL;
}
- rq->dr = kmalloc(sizeof(*rq->dr), mem_flags);
+ rq->dr = kmalloc_obj(*rq->dr, mem_flags);
if (!rq->dr) {
kref_put(&rq->ref_count, destroy_async);
return NULL;
@@ -701,7 +701,7 @@ static int uss720_probe(struct usb_interface *intf,
/*
* Allocate parport interface
*/
- priv = kzalloc(sizeof(struct parport_uss720_private), GFP_KERNEL);
+ priv = kzalloc_obj(struct parport_uss720_private, GFP_KERNEL);
if (!priv) {
usb_put_dev(usbdev);
return -ENOMEM;
diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c
index 70dff0db5354..2e2057ef5b68 100644
--- a/drivers/usb/misc/yurex.c
+++ b/drivers/usb/misc/yurex.c
@@ -197,7 +197,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
int res;
/* allocate memory for our device state and initialize it */
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ dev = kzalloc_obj(*dev, GFP_KERNEL);
if (!dev)
goto error;
kref_init(&dev->kref);
diff --git a/drivers/usb/mon/mon_bin.c b/drivers/usb/mon/mon_bin.c
index e713fc5964b1..c0c4eb0a166d 100644
--- a/drivers/usb/mon/mon_bin.c
+++ b/drivers/usb/mon/mon_bin.c
@@ -694,7 +694,7 @@ static int mon_bin_open(struct inode *inode, struct file *file)
return -ENODEV;
}
- rp = kzalloc(sizeof(struct mon_reader_bin), GFP_KERNEL);
+ rp = kzalloc_obj(struct mon_reader_bin, GFP_KERNEL);
if (rp == NULL) {
rc = -ENOMEM;
goto err_alloc;
@@ -1029,8 +1029,8 @@ static long mon_bin_ioctl(struct file *file, unsigned int cmd, unsigned long arg
return -EINVAL;
size = CHUNK_ALIGN(arg);
- vec = kcalloc(size / CHUNK_SIZE, sizeof(struct mon_pgmap),
- GFP_KERNEL);
+ vec = kzalloc_objs(struct mon_pgmap, size / CHUNK_SIZE,
+ GFP_KERNEL);
if (vec == NULL) {
ret = -ENOMEM;
break;
diff --git a/drivers/usb/mon/mon_main.c b/drivers/usb/mon/mon_main.c
index af852d53aac6..b3a68ac6fb98 100644
--- a/drivers/usb/mon/mon_main.c
+++ b/drivers/usb/mon/mon_main.c
@@ -273,7 +273,7 @@ static void mon_bus_init(struct usb_bus *ubus)
{
struct mon_bus *mbus;
- mbus = kzalloc(sizeof(struct mon_bus), GFP_KERNEL);
+ mbus = kzalloc_obj(struct mon_bus, GFP_KERNEL);
if (mbus == NULL)
goto err_alloc;
kref_init(&mbus->ref);
diff --git a/drivers/usb/mon/mon_stat.c b/drivers/usb/mon/mon_stat.c
index 398e02af6a2b..8329c1fc719e 100644
--- a/drivers/usb/mon/mon_stat.c
+++ b/drivers/usb/mon/mon_stat.c
@@ -29,7 +29,7 @@ static int mon_stat_open(struct inode *inode, struct file *file)
struct mon_bus *mbus;
struct snap *sp;
- sp = kmalloc(sizeof(struct snap), GFP_KERNEL);
+ sp = kmalloc_obj(struct snap, GFP_KERNEL);
if (sp == NULL)
return -ENOMEM;
diff --git a/drivers/usb/mon/mon_text.c b/drivers/usb/mon/mon_text.c
index 68b9b2b41189..b55016068b47 100644
--- a/drivers/usb/mon/mon_text.c
+++ b/drivers/usb/mon/mon_text.c
@@ -330,7 +330,7 @@ static int mon_text_open(struct inode *inode, struct file *file)
mutex_lock(&mon_lock);
mbus = inode->i_private;
- rp = kzalloc(sizeof(struct mon_reader_text), GFP_KERNEL);
+ rp = kzalloc_obj(struct mon_reader_text, GFP_KERNEL);
if (rp == NULL) {
rc = -ENOMEM;
goto err_alloc;
diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c
index 3a25ee18f144..9215373a9738 100644
--- a/drivers/usb/mtu3/mtu3_core.c
+++ b/drivers/usb/mtu3/mtu3_core.c
@@ -613,7 +613,7 @@ static int mtu3_mem_alloc(struct mtu3 *mtu)
/* one for ep0, another is reserved */
mtu->num_eps = min(in_ep_num, out_ep_num) + 1;
- ep_array = kcalloc(mtu->num_eps * 2, sizeof(*ep_array), GFP_KERNEL);
+ ep_array = kzalloc_objs(*ep_array, mtu->num_eps * 2, GFP_KERNEL);
if (ep_array == NULL)
return -ENOMEM;
diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c
index bf73fbc29976..da29f467943f 100644
--- a/drivers/usb/mtu3/mtu3_gadget.c
+++ b/drivers/usb/mtu3/mtu3_gadget.c
@@ -235,7 +235,7 @@ struct usb_request *mtu3_alloc_request(struct usb_ep *ep, gfp_t gfp_flags)
struct mtu3_ep *mep = to_mtu3_ep(ep);
struct mtu3_request *mreq;
- mreq = kzalloc(sizeof(*mreq), gfp_flags);
+ mreq = kzalloc_obj(*mreq, gfp_flags);
if (!mreq)
return NULL;
diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c
index 4cde3abb7006..240953cdf46d 100644
--- a/drivers/usb/musb/musb_cppi41.c
+++ b/drivers/usb/musb/musb_cppi41.c
@@ -756,7 +756,7 @@ cppi41_dma_controller_create(struct musb *musb, void __iomem *base)
return NULL;
}
- controller = kzalloc(sizeof(*controller), GFP_KERNEL);
+ controller = kzalloc_obj(*controller, GFP_KERNEL);
if (!controller)
goto kzalloc_fail;
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index d666c4292753..016d3f3fc1e0 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1133,7 +1133,7 @@ struct usb_request *musb_alloc_request(struct usb_ep *ep, gfp_t gfp_flags)
struct musb_ep *musb_ep = to_musb_ep(ep);
struct musb_request *request;
- request = kzalloc(sizeof *request, gfp_flags);
+ request = kzalloc_obj(*request, gfp_flags);
if (!request)
return NULL;
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index 6b4481a867c5..8efd2fa472f9 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -2154,7 +2154,7 @@ static int musb_urb_enqueue(
* REVISIT consider a dedicated qh kmem_cache, so it's harder
* for bugs in other kernel code to break this driver...
*/
- qh = kzalloc(sizeof *qh, mem_flags);
+ qh = kzalloc_obj(*qh, mem_flags);
if (!qh) {
spin_lock_irqsave(&musb->lock, flags);
usb_hcd_unlink_urb_from_ep(hcd, urb);
diff --git a/drivers/usb/musb/musbhsdma.c b/drivers/usb/musb/musbhsdma.c
index 7acd1635850d..9cd4616d853e 100644
--- a/drivers/usb/musb/musbhsdma.c
+++ b/drivers/usb/musb/musbhsdma.c
@@ -395,7 +395,7 @@ dma_controller_alloc(struct musb *musb, void __iomem *base)
{
struct musb_dma_controller *controller;
- controller = kzalloc(sizeof(*controller), GFP_KERNEL);
+ controller = kzalloc_obj(*controller, GFP_KERNEL);
if (!controller)
return NULL;
diff --git a/drivers/usb/musb/tusb6010_omap.c b/drivers/usb/musb/tusb6010_omap.c
index 60a93b8bbe3c..ed8fea4738cd 100644
--- a/drivers/usb/musb/tusb6010_omap.c
+++ b/drivers/usb/musb/tusb6010_omap.c
@@ -596,7 +596,7 @@ tusb_dma_controller_create(struct musb *musb, void __iomem *base)
| TUSB_DMA_REQ_CONF_DMA_REQ_EN(0x3f)
| TUSB_DMA_REQ_CONF_DMA_REQ_ASSER(2));
- tusb_dma = kzalloc(sizeof(struct tusb_omap_dma), GFP_KERNEL);
+ tusb_dma = kzalloc_obj(struct tusb_omap_dma, GFP_KERNEL);
if (!tusb_dma)
goto out;
@@ -615,13 +615,13 @@ tusb_dma_controller_create(struct musb *musb, void __iomem *base)
struct dma_channel *ch;
struct tusb_omap_dma_ch *chdat;
- ch = kzalloc(sizeof(struct dma_channel), GFP_KERNEL);
+ ch = kzalloc_obj(struct dma_channel, GFP_KERNEL);
if (!ch)
goto cleanup;
dma_channel_pool[i] = ch;
- chdat = kzalloc(sizeof(struct tusb_omap_dma_ch), GFP_KERNEL);
+ chdat = kzalloc_obj(struct tusb_omap_dma_ch, GFP_KERNEL);
if (!chdat)
goto cleanup;
diff --git a/drivers/usb/musb/ux500_dma.c b/drivers/usb/musb/ux500_dma.c
index d5cf5e8bb1ca..0621a6c0c6b6 100644
--- a/drivers/usb/musb/ux500_dma.c
+++ b/drivers/usb/musb/ux500_dma.c
@@ -362,7 +362,7 @@ ux500_dma_controller_create(struct musb *musb, void __iomem *base)
struct resource *iomem;
int ret;
- controller = kzalloc(sizeof(*controller), GFP_KERNEL);
+ controller = kzalloc_obj(*controller, GFP_KERNEL);
if (!controller)
goto kzalloc_fail;
diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c
index e266a47c4d48..f5712dddd1fd 100644
--- a/drivers/usb/phy/phy-fsl-usb.c
+++ b/drivers/usb/phy/phy-fsl-usb.c
@@ -779,11 +779,11 @@ static int fsl_otg_conf(struct platform_device *pdev)
return 0;
/* allocate space to fsl otg device */
- fsl_otg_tc = kzalloc(sizeof(struct fsl_otg), GFP_KERNEL);
+ fsl_otg_tc = kzalloc_obj(struct fsl_otg, GFP_KERNEL);
if (!fsl_otg_tc)
return -ENOMEM;
- fsl_otg_tc->phy.otg = kzalloc(sizeof(struct usb_otg), GFP_KERNEL);
+ fsl_otg_tc->phy.otg = kzalloc_obj(struct usb_otg, GFP_KERNEL);
if (!fsl_otg_tc->phy.otg) {
kfree(fsl_otg_tc);
return -ENOMEM;
diff --git a/drivers/usb/phy/phy-fsl-usb.h b/drivers/usb/phy/phy-fsl-usb.h
index d70341ae5a92..487a11ff4391 100644
--- a/drivers/usb/phy/phy-fsl-usb.h
+++ b/drivers/usb/phy/phy-fsl-usb.h
@@ -345,7 +345,7 @@ inline struct fsl_otg_timer *otg_timer_initializer
{
struct fsl_otg_timer *timer;
- timer = kmalloc(sizeof(struct fsl_otg_timer), GFP_KERNEL);
+ timer = kmalloc_obj(struct fsl_otg_timer, GFP_KERNEL);
if (!timer)
return NULL;
timer->function = function;
diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c
index e8e5723f5412..ca96c0164593 100644
--- a/drivers/usb/renesas_usbhs/mod_gadget.c
+++ b/drivers/usb/renesas_usbhs/mod_gadget.c
@@ -325,7 +325,7 @@ static void __usbhsg_recip_send_status(struct usbhsg_gpriv *gpriv,
}
/* alloc recip data buffer */
- buf = kmalloc(sizeof(*buf), GFP_ATOMIC);
+ buf = kmalloc_obj(*buf, GFP_ATOMIC);
if (!buf) {
usb_ep_free_request(&dcp->ep, req);
return;
@@ -661,7 +661,7 @@ static struct usb_request *usbhsg_ep_alloc_request(struct usb_ep *ep,
{
struct usbhsg_request *ureq;
- ureq = kzalloc(sizeof *ureq, gfp_flags);
+ ureq = kzalloc_obj(*ureq, gfp_flags);
if (!ureq)
return NULL;
@@ -1084,11 +1084,11 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv)
int i;
int ret;
- gpriv = kzalloc(sizeof(struct usbhsg_gpriv), GFP_KERNEL);
+ gpriv = kzalloc_obj(struct usbhsg_gpriv, GFP_KERNEL);
if (!gpriv)
return -ENOMEM;
- uep = kcalloc(pipe_size, sizeof(struct usbhsg_uep), GFP_KERNEL);
+ uep = kzalloc_objs(struct usbhsg_uep, pipe_size, GFP_KERNEL);
if (!uep) {
ret = -ENOMEM;
goto usbhs_mod_gadget_probe_err_gpriv;
diff --git a/drivers/usb/renesas_usbhs/mod_host.c b/drivers/usb/renesas_usbhs/mod_host.c
index ae54221011c3..f7ef3a9f82a4 100644
--- a/drivers/usb/renesas_usbhs/mod_host.c
+++ b/drivers/usb/renesas_usbhs/mod_host.c
@@ -158,7 +158,7 @@ static struct usbhsh_request *usbhsh_ureq_alloc(struct usbhsh_hpriv *hpriv,
{
struct usbhsh_request *ureq;
- ureq = kzalloc(sizeof(struct usbhsh_request), mem_flags);
+ ureq = kzalloc_obj(struct usbhsh_request, mem_flags);
if (!ureq)
return NULL;
@@ -374,7 +374,7 @@ static int usbhsh_endpoint_attach(struct usbhsh_hpriv *hpriv,
struct usb_endpoint_descriptor *desc = &ep->desc;
unsigned long flags;
- uep = kzalloc(sizeof(struct usbhsh_ep), mem_flags);
+ uep = kzalloc_obj(struct usbhsh_ep, mem_flags);
if (!uep)
return -ENOMEM;
diff --git a/drivers/usb/renesas_usbhs/pipe.c b/drivers/usb/renesas_usbhs/pipe.c
index 56fc3ff5016f..f48a22037f43 100644
--- a/drivers/usb/renesas_usbhs/pipe.c
+++ b/drivers/usb/renesas_usbhs/pipe.c
@@ -822,8 +822,7 @@ int usbhs_pipe_probe(struct usbhs_priv *priv)
return -EINVAL;
}
- info->pipe = kcalloc(pipe_size, sizeof(struct usbhs_pipe),
- GFP_KERNEL);
+ info->pipe = kzalloc_objs(struct usbhs_pipe, pipe_size, GFP_KERNEL);
if (!info->pipe)
return -ENOMEM;
diff --git a/drivers/usb/roles/class.c b/drivers/usb/roles/class.c
index 30482d4cf826..31c2c3e370dd 100644
--- a/drivers/usb/roles/class.c
+++ b/drivers/usb/roles/class.c
@@ -364,7 +364,7 @@ usb_role_switch_register(struct device *parent,
if (!desc || !desc->set)
return ERR_PTR(-EINVAL);
- sw = kzalloc(sizeof(*sw), GFP_KERNEL);
+ sw = kzalloc_obj(*sw, GFP_KERNEL);
if (!sw)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
index 800b04fe37fa..336d199e4994 100644
--- a/drivers/usb/serial/ark3116.c
+++ b/drivers/usb/serial/ark3116.c
@@ -126,7 +126,7 @@ static int ark3116_port_probe(struct usb_serial_port *port)
struct usb_serial *serial = port->serial;
struct ark3116_private *priv;
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ priv = kzalloc_obj(*priv, GFP_KERNEL);
if (!priv)
return -ENOMEM;
diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c
index 5c41c1c82c3f..334f59c512d7 100644
--- a/drivers/usb/serial/belkin_sa.c
+++ b/drivers/usb/serial/belkin_sa.c
@@ -114,7 +114,7 @@ static int belkin_sa_port_probe(struct usb_serial_port *port)
struct usb_device *dev = port->serial->dev;
struct belkin_sa_private *priv;
- priv = kmalloc(sizeof(struct belkin_sa_private), GFP_KERNEL);
+ priv = kmalloc_obj(struct belkin_sa_private, GFP_KERNEL);
if (!priv)
return -ENOMEM;
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
index 7cc36f84821f..ceb2612a9228 100644
--- a/drivers/usb/serial/ch341.c
+++ b/drivers/usb/serial/ch341.c
@@ -381,7 +381,7 @@ static int ch341_port_probe(struct usb_serial_port *port)
struct ch341_private *priv;
int r;
- priv = kzalloc(sizeof(struct ch341_private), GFP_KERNEL);
+ priv = kzalloc_obj(struct ch341_private, GFP_KERNEL);
if (!priv)
return -ENOMEM;
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
index c3ea3a46ed76..4b5f56bd01e8 100644
--- a/drivers/usb/serial/console.c
+++ b/drivers/usb/serial/console.c
@@ -133,7 +133,7 @@ static int usb_console_setup(struct console *co, char *options)
* the termios structure, then later call set_termios to
* configure according to command line arguments
*/
- tty = kzalloc(sizeof(*tty), GFP_KERNEL);
+ tty = kzalloc_obj(*tty, GFP_KERNEL);
if (!tty) {
retval = -ENOMEM;
goto reset_open_count;
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 36b25418b214..3c30dd095b32 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -2006,7 +2006,7 @@ static int cp210x_port_probe(struct usb_serial_port *port)
struct usb_serial *serial = port->serial;
struct cp210x_port_private *port_priv;
- port_priv = kzalloc(sizeof(*port_priv), GFP_KERNEL);
+ port_priv = kzalloc_obj(*port_priv, GFP_KERNEL);
if (!port_priv)
return -ENOMEM;
@@ -2163,7 +2163,7 @@ static int cp210x_attach(struct usb_serial *serial)
int result;
struct cp210x_serial_private *priv;
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ priv = kzalloc_obj(*priv, GFP_KERNEL);
if (!priv)
return -ENOMEM;
diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c
index 76dd8e7453b5..609d3a700b70 100644
--- a/drivers/usb/serial/cyberjack.c
+++ b/drivers/usb/serial/cyberjack.c
@@ -101,7 +101,7 @@ static int cyberjack_port_probe(struct usb_serial_port *port)
struct cyberjack_private *priv;
int result;
- priv = kmalloc(sizeof(struct cyberjack_private), GFP_KERNEL);
+ priv = kmalloc_obj(struct cyberjack_private, GFP_KERNEL);
if (!priv)
return -ENOMEM;
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
index e29569d65991..52d52a92b7ea 100644
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
@@ -445,7 +445,7 @@ static int cypress_generic_port_probe(struct usb_serial_port *port)
return -ENODEV;
}
- priv = kzalloc(sizeof(struct cypress_private), GFP_KERNEL);
+ priv = kzalloc_obj(struct cypress_private, GFP_KERNEL);
if (!priv)
return -ENOMEM;
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
index a06485965412..8a8d4dc899b0 100644
--- a/drivers/usb/serial/digi_acceleport.c
+++ b/drivers/usb/serial/digi_acceleport.c
@@ -1209,7 +1209,7 @@ static int digi_port_init(struct usb_serial_port *port, unsigned port_num)
{
struct digi_port *priv;
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ priv = kzalloc_obj(*priv, GFP_KERNEL);
if (!priv)
return -ENOMEM;
@@ -1231,7 +1231,7 @@ static int digi_startup(struct usb_serial *serial)
struct digi_serial *serial_priv;
int ret;
- serial_priv = kzalloc(sizeof(*serial_priv), GFP_KERNEL);
+ serial_priv = kzalloc_obj(*serial_priv, GFP_KERNEL);
if (!serial_priv)
return -ENOMEM;
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index acb48b1c83f7..7500e1a85c88 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -2188,7 +2188,7 @@ static int ftdi_port_probe(struct usb_serial_port *port)
struct ftdi_private *priv;
int result;
- priv = kzalloc(sizeof(struct ftdi_private), GFP_KERNEL);
+ priv = kzalloc_obj(struct ftdi_private, GFP_KERNEL);
if (!priv)
return -ENOMEM;
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
index 614de0c2f5f2..aa7561aba927 100644
--- a/drivers/usb/serial/garmin_gps.c
+++ b/drivers/usb/serial/garmin_gps.c
@@ -267,7 +267,7 @@ static int pkt_add(struct garmin_data *garmin_data_p,
/* process only packets containing data ... */
if (data_length) {
- pkt = kmalloc(struct_size(pkt, data, data_length), GFP_ATOMIC);
+ pkt = kmalloc_flex(*pkt, data, data_length, GFP_ATOMIC);
if (!pkt)
return 0;
@@ -1373,7 +1373,7 @@ static int garmin_port_probe(struct usb_serial_port *port)
int status;
struct garmin_data *garmin_data_p;
- garmin_data_p = kzalloc(sizeof(struct garmin_data), GFP_KERNEL);
+ garmin_data_p = kzalloc_obj(struct garmin_data, GFP_KERNEL);
if (!garmin_data_p)
return -ENOMEM;
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index 1fffda7647f9..b036fcde63e4 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -498,7 +498,7 @@ static int get_epic_descriptor(struct edgeport_serial *ep)
ep->is_epic = 0;
- epic = kmalloc(sizeof(*epic), GFP_KERNEL);
+ epic = kmalloc_obj(*epic, GFP_KERNEL);
if (!epic)
return -ENOMEM;
@@ -2714,7 +2714,7 @@ static int edge_startup(struct usb_serial *serial)
dev = serial->dev;
/* create our private serial structure */
- edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL);
+ edge_serial = kzalloc_obj(struct edgeport_serial, GFP_KERNEL);
if (!edge_serial)
return -ENOMEM;
@@ -2956,7 +2956,7 @@ static int edge_port_probe(struct usb_serial_port *port)
{
struct edgeport_port *edge_port;
- edge_port = kzalloc(sizeof(*edge_port), GFP_KERNEL);
+ edge_port = kzalloc_obj(*edge_port, GFP_KERNEL);
if (!edge_port)
return -ENOMEM;
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index 7d0584b2a234..fed02fdf3dcb 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -528,7 +528,7 @@ static int tx_active(struct edgeport_port *port)
u8 *lsr;
int bytes_left = 0;
- oedb = kmalloc(sizeof(*oedb), GFP_KERNEL);
+ oedb = kmalloc_obj(*oedb, GFP_KERNEL);
if (!oedb)
return -ENOMEM;
@@ -680,7 +680,7 @@ static int check_i2c_image(struct edgeport_serial *serial)
u8 *buffer;
u16 ttype;
- rom_desc = kmalloc(sizeof(*rom_desc), GFP_KERNEL);
+ rom_desc = kmalloc_obj(*rom_desc, GFP_KERNEL);
if (!rom_desc)
return -ENOMEM;
@@ -759,7 +759,7 @@ static int get_manuf_info(struct edgeport_serial *serial, u8 *buffer)
struct edge_ti_manuf_descriptor *desc;
struct device *dev = &serial->serial->dev->dev;
- rom_desc = kmalloc(sizeof(*rom_desc), GFP_KERNEL);
+ rom_desc = kmalloc_obj(*rom_desc, GFP_KERNEL);
if (!rom_desc)
return -ENOMEM;
@@ -1089,7 +1089,7 @@ static int do_download_mode(struct edgeport_serial *serial,
* Validate Hardware version number
* Read Manufacturing Descriptor from TI Based Edgeport
*/
- ti_manuf_desc = kmalloc(sizeof(*ti_manuf_desc), GFP_KERNEL);
+ ti_manuf_desc = kmalloc_obj(*ti_manuf_desc, GFP_KERNEL);
if (!ti_manuf_desc)
return -ENOMEM;
@@ -1107,7 +1107,7 @@ static int do_download_mode(struct edgeport_serial *serial,
return -EINVAL;
}
- rom_desc = kmalloc(sizeof(*rom_desc), GFP_KERNEL);
+ rom_desc = kmalloc_obj(*rom_desc, GFP_KERNEL);
if (!rom_desc) {
kfree(ti_manuf_desc);
return -ENOMEM;
@@ -1123,8 +1123,7 @@ static int do_download_mode(struct edgeport_serial *serial,
dev_dbg(dev, "%s - Found Type FIRMWARE (Type 2) record\n",
__func__);
- firmware_version = kmalloc(sizeof(*firmware_version),
- GFP_KERNEL);
+ firmware_version = kmalloc_obj(*firmware_version, GFP_KERNEL);
if (!firmware_version) {
kfree(rom_desc);
kfree(ti_manuf_desc);
@@ -1419,7 +1418,7 @@ static int do_boot_mode(struct edgeport_serial *serial,
* Validate Hardware version number
* Read Manufacturing Descriptor from TI Based Edgeport
*/
- ti_manuf_desc = kmalloc(sizeof(*ti_manuf_desc), GFP_KERNEL);
+ ti_manuf_desc = kmalloc_obj(*ti_manuf_desc, GFP_KERNEL);
if (!ti_manuf_desc)
return -ENOMEM;
@@ -2219,7 +2218,7 @@ static void change_port_settings(struct tty_struct *tty,
unsigned cflag;
int status;
- config = kmalloc (sizeof (*config), GFP_KERNEL);
+ config = kmalloc_obj(*config, GFP_KERNEL);
if (!config) {
tty->termios = *old_termios;
return;
@@ -2458,7 +2457,7 @@ static void edge_heartbeat_work(struct work_struct *work)
serial = container_of(work, struct edgeport_serial,
heartbeat_work.work);
- rom_desc = kmalloc(sizeof(*rom_desc), GFP_KERNEL);
+ rom_desc = kmalloc_obj(*rom_desc, GFP_KERNEL);
/* Descriptor address request is enough to reset the firmware timer */
if (!rom_desc || !get_descriptor_addr(serial, I2C_DESC_TYPE_ION,
@@ -2497,7 +2496,7 @@ static int edge_startup(struct usb_serial *serial)
u16 product_id;
/* create our private serial structure */
- edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL);
+ edge_serial = kzalloc_obj(struct edgeport_serial, GFP_KERNEL);
if (!edge_serial)
return -ENOMEM;
@@ -2551,7 +2550,7 @@ static int edge_port_probe(struct usb_serial_port *port)
struct edgeport_port *edge_port;
int ret;
- edge_port = kzalloc(sizeof(*edge_port), GFP_KERNEL);
+ edge_port = kzalloc_obj(*edge_port, GFP_KERNEL);
if (!edge_port)
return -ENOMEM;
diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c
index b1e672c2f423..ec2b061c0e84 100644
--- a/drivers/usb/serial/ipw.c
+++ b/drivers/usb/serial/ipw.c
@@ -198,7 +198,7 @@ static int ipw_attach(struct usb_serial *serial)
{
struct usb_wwan_intf_private *data;
- data = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL);
+ data = kzalloc_obj(struct usb_wwan_intf_private, GFP_KERNEL);
if (!data)
return -ENOMEM;
diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c
index a106b71e698f..4eeec9c06a11 100644
--- a/drivers/usb/serial/ir-usb.c
+++ b/drivers/usb/serial/ir-usb.c
@@ -126,7 +126,7 @@ irda_usb_find_class_desc(struct usb_serial *serial, unsigned int ifnum)
struct usb_irda_cs_descriptor *desc;
int ret;
- desc = kzalloc(sizeof(*desc), GFP_KERNEL);
+ desc = kzalloc_obj(*desc, GFP_KERNEL);
if (!desc)
return NULL;
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c
index c21dcc9b6f05..6feb886991d6 100644
--- a/drivers/usb/serial/iuu_phoenix.c
+++ b/drivers/usb/serial/iuu_phoenix.c
@@ -67,7 +67,7 @@ static int iuu_port_probe(struct usb_serial_port *port)
struct iuu_private *priv;
int ret;
- priv = kzalloc(sizeof(struct iuu_private), GFP_KERNEL);
+ priv = kzalloc_obj(struct iuu_private, GFP_KERNEL);
if (!priv)
return -ENOMEM;
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index 9129e0282c24..ba3f80d21e92 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -2789,7 +2789,7 @@ static int keyspan_startup(struct usb_serial *serial)
}
/* Setup private data for serial driver */
- s_priv = kzalloc(sizeof(struct keyspan_serial_private), GFP_KERNEL);
+ s_priv = kzalloc_obj(struct keyspan_serial_private, GFP_KERNEL);
if (!s_priv)
return -ENOMEM;
@@ -2886,7 +2886,7 @@ static int keyspan_port_probe(struct usb_serial_port *port)
s_priv = usb_get_serial_data(serial);
d_details = s_priv->device_details;
- p_priv = kzalloc(sizeof(*p_priv), GFP_KERNEL);
+ p_priv = kzalloc_obj(*p_priv, GFP_KERNEL);
if (!p_priv)
return -ENOMEM;
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
index e98b479593d3..8a0f993ec7c6 100644
--- a/drivers/usb/serial/keyspan_pda.c
+++ b/drivers/usb/serial/keyspan_pda.c
@@ -654,7 +654,7 @@ static int keyspan_pda_port_probe(struct usb_serial_port *port)
struct keyspan_pda_private *priv;
- priv = kmalloc(sizeof(struct keyspan_pda_private), GFP_KERNEL);
+ priv = kmalloc_obj(struct keyspan_pda_private, GFP_KERNEL);
if (!priv)
return -ENOMEM;
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
index d36155b6d2bf..d2960271a1f7 100644
--- a/drivers/usb/serial/kl5kusb105.c
+++ b/drivers/usb/serial/kl5kusb105.c
@@ -189,7 +189,7 @@ static int klsi_105_port_probe(struct usb_serial_port *port)
{
struct klsi_105_private *priv;
- priv = kmalloc(sizeof(*priv), GFP_KERNEL);
+ priv = kmalloc_obj(*priv, GFP_KERNEL);
if (!priv)
return -ENOMEM;
@@ -378,7 +378,7 @@ static void klsi_105_set_termios(struct tty_struct *tty,
unsigned long flags;
speed_t baud;
- cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
+ cfg = kmalloc_obj(*cfg, GFP_KERNEL);
if (!cfg)
return;
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
index 3a1343d88386..3f9311b3bdf9 100644
--- a/drivers/usb/serial/kobil_sct.c
+++ b/drivers/usb/serial/kobil_sct.c
@@ -130,7 +130,7 @@ static int kobil_port_probe(struct usb_serial_port *port)
struct usb_serial *serial = port->serial;
struct kobil_private *priv;
- priv = kmalloc(sizeof(struct kobil_private), GFP_KERNEL);
+ priv = kmalloc_obj(struct kobil_private, GFP_KERNEL);
if (!priv)
return -ENOMEM;
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
index 2bce8cc03aca..2bf86c3cc7ff 100644
--- a/drivers/usb/serial/mct_u232.c
+++ b/drivers/usb/serial/mct_u232.c
@@ -385,7 +385,7 @@ static int mct_u232_port_probe(struct usb_serial_port *port)
return -ENODEV;
}
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ priv = kzalloc_obj(*priv, GFP_KERNEL);
if (!priv)
return -ENOMEM;
diff --git a/drivers/usb/serial/metro-usb.c b/drivers/usb/serial/metro-usb.c
index 028878292901..7e7fb49fc3d5 100644
--- a/drivers/usb/serial/metro-usb.c
+++ b/drivers/usb/serial/metro-usb.c
@@ -245,7 +245,7 @@ static int metrousb_port_probe(struct usb_serial_port *port)
{
struct metrousb_private *metro_priv;
- metro_priv = kzalloc(sizeof(*metro_priv), GFP_KERNEL);
+ metro_priv = kzalloc_obj(*metro_priv, GFP_KERNEL);
if (!metro_priv)
return -ENOMEM;
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index e59bfa7c8030..1495d82bf838 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -555,7 +555,7 @@ static int mos7715_parport_init(struct usb_serial *serial)
struct mos7715_parport *mos_parport;
/* allocate and initialize parallel port control struct */
- mos_parport = kzalloc(sizeof(struct mos7715_parport), GFP_KERNEL);
+ mos_parport = kzalloc_obj(struct mos7715_parport, GFP_KERNEL);
if (!mos_parport)
return -ENOMEM;
@@ -1703,7 +1703,7 @@ static int mos7720_port_probe(struct usb_serial_port *port)
{
struct moschip_port *mos7720_port;
- mos7720_port = kzalloc(sizeof(*mos7720_port), GFP_KERNEL);
+ mos7720_port = kzalloc_obj(*mos7720_port, GFP_KERNEL);
if (!mos7720_port)
return -ENOMEM;
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 9e9aca271c0a..065ac3777906 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -1532,7 +1532,7 @@ static int mos7840_port_probe(struct usb_serial_port *port)
pnum = port->port_number;
dev_dbg(&port->dev, "mos7840_startup: configuring port %d\n", pnum);
- mos7840_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL);
+ mos7840_port = kzalloc_obj(struct moschip_port, GFP_KERNEL);
if (!mos7840_port)
return -ENOMEM;
@@ -1677,8 +1677,8 @@ static int mos7840_port_probe(struct usb_serial_port *port)
/* Initialize LED timers */
if (mos7840_port->has_led) {
mos7840_port->led_urb = usb_alloc_urb(0, GFP_KERNEL);
- mos7840_port->led_dr = kmalloc(sizeof(*mos7840_port->led_dr),
- GFP_KERNEL);
+ mos7840_port->led_dr = kmalloc_obj(*mos7840_port->led_dr,
+ GFP_KERNEL);
if (!mos7840_port->led_urb || !mos7840_port->led_dr) {
status = -ENOMEM;
goto error;
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c
index 397ebd5a3e74..05f5ab767a53 100644
--- a/drivers/usb/serial/omninet.c
+++ b/drivers/usb/serial/omninet.c
@@ -113,7 +113,7 @@ static int omninet_port_probe(struct usb_serial_port *port)
{
struct omninet_data *od;
- od = kzalloc(sizeof(*od), GFP_KERNEL);
+ od = kzalloc_obj(*od, GFP_KERNEL);
if (!od)
return -ENOMEM;
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c
index 1ee84ccc4bbd..0ced33c28545 100644
--- a/drivers/usb/serial/opticon.c
+++ b/drivers/usb/serial/opticon.c
@@ -220,7 +220,7 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port,
/* The connected devices do not have a bulk write endpoint,
* to transmit data to de barcode device the control endpoint is used */
- dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC);
+ dr = kmalloc_obj(struct usb_ctrlrequest, GFP_ATOMIC);
if (!dr)
goto error_no_dr;
@@ -354,7 +354,7 @@ static int opticon_port_probe(struct usb_serial_port *port)
{
struct opticon_private *priv;
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ priv = kzalloc_obj(*priv, GFP_KERNEL);
if (!priv)
return -ENOMEM;
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index d4505a426446..261d852aaccf 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -2606,7 +2606,7 @@ static int option_attach(struct usb_serial *serial)
struct usb_wwan_intf_private *data;
unsigned long device_flags;
- data = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL);
+ data = kzalloc_obj(struct usb_wwan_intf_private, GFP_KERNEL);
if (!data)
return -ENOMEM;
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c
index bd206cb9cc08..70ddda6a300e 100644
--- a/drivers/usb/serial/oti6858.c
+++ b/drivers/usb/serial/oti6858.c
@@ -328,7 +328,7 @@ static int oti6858_port_probe(struct usb_serial_port *port)
{
struct oti6858_private *priv;
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ priv = kzalloc_obj(*priv, GFP_KERNEL);
if (!priv)
return -ENOMEM;
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 22579d0d8ab8..75fd24019cba 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -503,7 +503,7 @@ static int pl2303_startup(struct usb_serial *serial)
type = ret;
dev_dbg(&serial->interface->dev, "device type: %s\n", pl2303_type_data[type].name);
- spriv = kzalloc(sizeof(*spriv), GFP_KERNEL);
+ spriv = kzalloc_obj(*spriv, GFP_KERNEL);
if (!spriv)
return -ENOMEM;
@@ -555,7 +555,7 @@ static int pl2303_port_probe(struct usb_serial_port *port)
{
struct pl2303_private *priv;
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ priv = kzalloc_obj(*priv, GFP_KERNEL);
if (!priv)
return -ENOMEM;
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index 13c664317a05..bbc3e33a2d81 100644
--- a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c
@@ -431,7 +431,7 @@ static int qc_attach(struct usb_serial *serial)
struct usb_wwan_intf_private *data;
bool sendsetup;
- data = kzalloc(sizeof(*data), GFP_KERNEL);
+ data = kzalloc_obj(*data, GFP_KERNEL);
if (!data)
return -ENOMEM;
diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c
index 72fe83a6c978..606beb6e12aa 100644
--- a/drivers/usb/serial/quatech2.c
+++ b/drivers/usb/serial/quatech2.c
@@ -626,7 +626,7 @@ static int qt2_attach(struct usb_serial *serial)
return status;
}
- serial_priv = kzalloc(sizeof(*serial_priv), GFP_KERNEL);
+ serial_priv = kzalloc_obj(*serial_priv, GFP_KERNEL);
if (!serial_priv)
return -ENOMEM;
@@ -657,7 +657,7 @@ static int qt2_port_probe(struct usb_serial_port *port)
struct qt2_port_private *port_priv;
u8 bEndpointAddress;
- port_priv = kzalloc(sizeof(*port_priv), GFP_KERNEL);
+ port_priv = kzalloc_obj(*port_priv, GFP_KERNEL);
if (!port_priv)
return -ENOMEM;
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index 741e68e46139..3b6a025cbeb8 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -828,7 +828,7 @@ static int sierra_startup(struct usb_serial *serial)
{
struct sierra_intf_private *intfdata;
- intfdata = kzalloc(sizeof(*intfdata), GFP_KERNEL);
+ intfdata = kzalloc_obj(*intfdata, GFP_KERNEL);
if (!intfdata)
return -ENOMEM;
@@ -861,7 +861,7 @@ static int sierra_port_probe(struct usb_serial_port *port)
const struct sierra_iface_list *himemory_list;
u8 ifnum;
- portdata = kzalloc(sizeof(*portdata), GFP_KERNEL);
+ portdata = kzalloc_obj(*portdata, GFP_KERNEL);
if (!portdata)
return -ENOMEM;
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c
index 11077beb7232..df1d1eed1236 100644
--- a/drivers/usb/serial/spcp8x5.c
+++ b/drivers/usb/serial/spcp8x5.c
@@ -145,7 +145,7 @@ static int spcp8x5_port_probe(struct usb_serial_port *port)
const struct usb_device_id *id = usb_get_serial_data(port->serial);
struct spcp8x5_private *priv;
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ priv = kzalloc_obj(*priv, GFP_KERNEL);
if (!priv)
return -ENOMEM;
diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c
index df21009bdf42..f73321fd5dfd 100644
--- a/drivers/usb/serial/ssu100.c
+++ b/drivers/usb/serial/ssu100.c
@@ -326,7 +326,7 @@ static int ssu100_port_probe(struct usb_serial_port *port)
{
struct ssu100_port_private *priv;
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ priv = kzalloc_obj(*priv, GFP_KERNEL);
if (!priv)
return -ENOMEM;
diff --git a/drivers/usb/serial/symbolserial.c b/drivers/usb/serial/symbolserial.c
index 58962bcbf9ba..46158cfc546a 100644
--- a/drivers/usb/serial/symbolserial.c
+++ b/drivers/usb/serial/symbolserial.c
@@ -149,7 +149,7 @@ static int symbol_port_probe(struct usb_serial_port *port)
{
struct symbol_private *priv;
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ priv = kzalloc_obj(*priv, GFP_KERNEL);
if (!priv)
return -ENOMEM;
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index d671189ecee2..cb6b0c018809 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -519,7 +519,7 @@ static int ti_startup(struct usb_serial *serial)
dev->descriptor.bNumConfigurations,
dev->actconfig->desc.bConfigurationValue);
- tdev = kzalloc(sizeof(struct ti_device), GFP_KERNEL);
+ tdev = kzalloc_obj(struct ti_device, GFP_KERNEL);
if (!tdev)
return -ENOMEM;
@@ -598,7 +598,7 @@ static int ti_port_probe(struct usb_serial_port *port)
{
struct ti_port *tport;
- tport = kzalloc(sizeof(*tport), GFP_KERNEL);
+ tport = kzalloc_obj(*tport, GFP_KERNEL);
if (!tport)
return -ENOMEM;
@@ -897,7 +897,7 @@ static void ti_set_termios(struct tty_struct *tty,
u16 wbaudrate;
u16 wflags = 0;
- config = kmalloc(sizeof(*config), GFP_KERNEL);
+ config = kmalloc_obj(*config, GFP_KERNEL);
if (!config)
return;
diff --git a/drivers/usb/serial/upd78f0730.c b/drivers/usb/serial/upd78f0730.c
index 15a17bf111f1..ecf0ecfceccb 100644
--- a/drivers/usb/serial/upd78f0730.c
+++ b/drivers/usb/serial/upd78f0730.c
@@ -161,7 +161,7 @@ static int upd78f0730_port_probe(struct usb_serial_port *port)
{
struct upd78f0730_port_private *private;
- private = kzalloc(sizeof(*private), GFP_KERNEL);
+ private = kzalloc_obj(*private, GFP_KERNEL);
if (!private)
return -ENOMEM;
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index c78ff40b1e5f..26c40f8108e4 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -688,7 +688,7 @@ static struct usb_serial *create_serial(struct usb_device *dev,
{
struct usb_serial *serial;
- serial = kzalloc(sizeof(*serial), GFP_KERNEL);
+ serial = kzalloc_obj(*serial, GFP_KERNEL);
if (!serial)
return NULL;
serial->dev = usb_get_dev(dev);
@@ -1005,7 +1005,7 @@ static int usb_serial_probe(struct usb_interface *interface,
}
/* descriptor matches, let's find the endpoints needed */
- epds = kzalloc(sizeof(*epds), GFP_KERNEL);
+ epds = kzalloc_obj(*epds, GFP_KERNEL);
if (!epds) {
retval = -ENOMEM;
goto err_release_sibling;
@@ -1059,7 +1059,7 @@ static int usb_serial_probe(struct usb_interface *interface,
dev_dbg(ddev, "setting up %d port structure(s)\n", max_endpoints);
for (i = 0; i < max_endpoints; ++i) {
- port = kzalloc(sizeof(struct usb_serial_port), GFP_KERNEL);
+ port = kzalloc_obj(struct usb_serial_port, GFP_KERNEL);
if (!port) {
retval = -ENOMEM;
goto err_free_epds;
@@ -1482,7 +1482,7 @@ int __usb_serial_register_drivers(struct usb_serial_driver *const serial_drivers
* Suspend/resume support is implemented in the usb-serial core,
* so fill in the PM-related fields in udriver.
*/
- udriver = kzalloc(sizeof(*udriver), GFP_KERNEL);
+ udriver = kzalloc_obj(*udriver, GFP_KERNEL);
if (!udriver)
return -ENOMEM;
diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
index 0017f6e969e1..ea529a15c1f6 100644
--- a/drivers/usb/serial/usb_wwan.c
+++ b/drivers/usb/serial/usb_wwan.c
@@ -449,7 +449,7 @@ int usb_wwan_port_probe(struct usb_serial_port *port)
if (!port->bulk_in_size || !port->bulk_out_size)
return -ENODEV;
- portdata = kzalloc(sizeof(*portdata), GFP_KERNEL);
+ portdata = kzalloc_obj(*portdata, GFP_KERNEL);
if (!portdata)
return -ENOMEM;
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
index 009faeb2ef55..c530e7a85cb4 100644
--- a/drivers/usb/serial/whiteheat.c
+++ b/drivers/usb/serial/whiteheat.c
@@ -278,8 +278,7 @@ static int whiteheat_attach(struct usb_serial *serial)
serial->type->description,
hw_info->sw_major_rev, hw_info->sw_minor_rev);
- command_info = kmalloc(sizeof(struct whiteheat_command_private),
- GFP_KERNEL);
+ command_info = kmalloc_obj(struct whiteheat_command_private, GFP_KERNEL);
if (!command_info)
goto no_command_private;
@@ -330,7 +329,7 @@ static int whiteheat_port_probe(struct usb_serial_port *port)
{
struct whiteheat_private *info;
- info = kzalloc(sizeof(*info), GFP_KERNEL);
+ info = kzalloc_obj(*info, GFP_KERNEL);
if (!info)
return -ENOMEM;
diff --git a/drivers/usb/serial/xr_serial.c b/drivers/usb/serial/xr_serial.c
index 4186e791b384..91c0a8d0097a 100644
--- a/drivers/usb/serial/xr_serial.c
+++ b/drivers/usb/serial/xr_serial.c
@@ -756,7 +756,7 @@ static void xr_cdc_set_line_coding(struct tty_struct *tty,
struct usb_cdc_line_coding *lc;
int ret;
- lc = kzalloc(sizeof(*lc), GFP_KERNEL);
+ lc = kzalloc_obj(*lc, GFP_KERNEL);
if (!lc)
return;
@@ -1020,7 +1020,7 @@ static int xr_port_probe(struct usb_serial_port *port)
type_id = (int)(unsigned long)usb_get_serial_data(port->serial);
type = &xr_types[type_id];
- data = kzalloc(sizeof(*data), GFP_KERNEL);
+ data = kzalloc_obj(*data, GFP_KERNEL);
if (!data)
return -ENOMEM;
diff --git a/drivers/usb/storage/alauda.c b/drivers/usb/storage/alauda.c
index e01f3a42bde4..691fe47009cf 100644
--- a/drivers/usb/storage/alauda.c
+++ b/drivers/usb/storage/alauda.c
@@ -1113,7 +1113,7 @@ static int init_alauda(struct us_data *us)
struct usb_host_interface *altsetting = us->pusb_intf->cur_altsetting;
nand_init_ecc();
- us->extra = kzalloc(sizeof(struct alauda_info), GFP_NOIO);
+ us->extra = kzalloc_obj(struct alauda_info, GFP_NOIO);
if (!us->extra)
return -ENOMEM;
diff --git a/drivers/usb/storage/datafab.c b/drivers/usb/storage/datafab.c
index 9ba369483c9b..0ded8ef72efa 100644
--- a/drivers/usb/storage/datafab.c
+++ b/drivers/usb/storage/datafab.c
@@ -555,7 +555,7 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us)
};
if (!us->extra) {
- us->extra = kzalloc(sizeof(struct datafab_info), GFP_NOIO);
+ us->extra = kzalloc_obj(struct datafab_info, GFP_NOIO);
if (!us->extra)
return USB_STOR_TRANSPORT_ERROR;
diff --git a/drivers/usb/storage/ene_ub6250.c b/drivers/usb/storage/ene_ub6250.c
index ce91fb105975..5a5f35213c1d 100644
--- a/drivers/usb/storage/ene_ub6250.c
+++ b/drivers/usb/storage/ene_ub6250.c
@@ -1119,9 +1119,9 @@ static int ms_lib_alloc_writebuf(struct us_data *us)
info->MS_Lib.blkpag = kmalloc_array(info->MS_Lib.PagesPerBlock,
info->MS_Lib.BytesPerSector,
GFP_KERNEL);
- info->MS_Lib.blkext = kmalloc_array(info->MS_Lib.PagesPerBlock,
- sizeof(struct ms_lib_type_extdat),
- GFP_KERNEL);
+ info->MS_Lib.blkext = kmalloc_objs(struct ms_lib_type_extdat,
+ info->MS_Lib.PagesPerBlock,
+ GFP_KERNEL);
if ((info->MS_Lib.blkpag == NULL) || (info->MS_Lib.blkext == NULL)) {
ms_lib_free_writebuf(us);
@@ -2336,7 +2336,7 @@ static int ene_ub6250_probe(struct usb_interface *intf,
return result;
/* FIXME: where should the code alloc extra buf ? */
- us->extra = kzalloc(sizeof(struct ene_ub6250_info), GFP_KERNEL);
+ us->extra = kzalloc_obj(struct ene_ub6250_info, GFP_KERNEL);
if (!us->extra)
return -ENOMEM;
us->extra_destructor = ene_ub6250_info_destructor;
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c
index a1669c35bad5..92113848913d 100644
--- a/drivers/usb/storage/isd200.c
+++ b/drivers/usb/storage/isd200.c
@@ -1463,7 +1463,7 @@ static int isd200_init_info(struct us_data *us)
{
struct isd200_info *info;
- info = kzalloc(sizeof(struct isd200_info), GFP_KERNEL);
+ info = kzalloc_obj(struct isd200_info, GFP_KERNEL);
if (!info)
return -ENOMEM;
diff --git a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c
index 089c6f8ac85f..a9c48091491e 100644
--- a/drivers/usb/storage/jumpshot.c
+++ b/drivers/usb/storage/jumpshot.c
@@ -482,7 +482,7 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us)
};
if (!us->extra) {
- us->extra = kzalloc(sizeof(struct jumpshot_info), GFP_NOIO);
+ us->extra = kzalloc_obj(struct jumpshot_info, GFP_NOIO);
if (!us->extra)
return USB_STOR_TRANSPORT_ERROR;
diff --git a/drivers/usb/storage/karma.c b/drivers/usb/storage/karma.c
index 341d6839548a..5f199c21bb0c 100644
--- a/drivers/usb/storage/karma.c
+++ b/drivers/usb/storage/karma.c
@@ -174,7 +174,7 @@ static void rio_karma_destructor(void *extra)
static int rio_karma_init(struct us_data *us)
{
- struct karma_data *data = kzalloc(sizeof(struct karma_data), GFP_NOIO);
+ struct karma_data *data = kzalloc_obj(struct karma_data, GFP_NOIO);
if (!data)
return -ENOMEM;
diff --git a/drivers/usb/storage/onetouch.c b/drivers/usb/storage/onetouch.c
index 5a8a1ffda0ec..083423606ad9 100644
--- a/drivers/usb/storage/onetouch.c
+++ b/drivers/usb/storage/onetouch.c
@@ -183,7 +183,7 @@ static int onetouch_connect_input(struct us_data *ss)
maxp = usb_maxpacket(udev, pipe);
maxp = min(maxp, ONETOUCH_PKT_LEN);
- onetouch = kzalloc(sizeof(struct usb_onetouch), GFP_KERNEL);
+ onetouch = kzalloc_obj(struct usb_onetouch, GFP_KERNEL);
input_dev = input_allocate_device();
if (!onetouch || !input_dev)
goto fail1;
diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c
index 3cc243956fd4..12eb1ab224cd 100644
--- a/drivers/usb/storage/realtek_cr.c
+++ b/drivers/usb/storage/realtek_cr.c
@@ -976,7 +976,7 @@ static int init_realtek_cr(struct us_data *us)
struct rts51x_chip *chip;
int size, i, retval;
- chip = kzalloc(sizeof(struct rts51x_chip), GFP_KERNEL);
+ chip = kzalloc_obj(struct rts51x_chip, GFP_KERNEL);
if (!chip)
return -ENOMEM;
diff --git a/drivers/usb/storage/sddr09.c b/drivers/usb/storage/sddr09.c
index e66b920e99e2..3d45e1b54c66 100644
--- a/drivers/usb/storage/sddr09.c
+++ b/drivers/usb/storage/sddr09.c
@@ -1232,8 +1232,8 @@ sddr09_read_map(struct us_data *us) {
kfree(info->lba_to_pba);
kfree(info->pba_to_lba);
- info->lba_to_pba = kmalloc_array(numblocks, sizeof(int), GFP_NOIO);
- info->pba_to_lba = kmalloc_array(numblocks, sizeof(int), GFP_NOIO);
+ info->lba_to_pba = kmalloc_objs(int, numblocks, GFP_NOIO);
+ info->pba_to_lba = kmalloc_objs(int, numblocks, GFP_NOIO);
if (info->lba_to_pba == NULL || info->pba_to_lba == NULL) {
printk(KERN_WARNING "sddr09_read_map: out of memory\n");
@@ -1428,7 +1428,7 @@ sddr09_common_init(struct us_data *us) {
return -EINVAL;
}
- us->extra = kzalloc(sizeof(struct sddr09_card_info), GFP_NOIO);
+ us->extra = kzalloc_obj(struct sddr09_card_info, GFP_NOIO);
if (!us->extra)
return -ENOMEM;
us->extra_destructor = sddr09_card_info_destructor;
diff --git a/drivers/usb/storage/sddr55.c b/drivers/usb/storage/sddr55.c
index 9d813727e65f..e05e824cd4d1 100644
--- a/drivers/usb/storage/sddr55.c
+++ b/drivers/usb/storage/sddr55.c
@@ -691,8 +691,8 @@ static int sddr55_read_map(struct us_data *us) {
kfree(info->lba_to_pba);
kfree(info->pba_to_lba);
- info->lba_to_pba = kmalloc_array(numblocks, sizeof(int), GFP_NOIO);
- info->pba_to_lba = kmalloc_array(numblocks, sizeof(int), GFP_NOIO);
+ info->lba_to_pba = kmalloc_objs(int, numblocks, GFP_NOIO);
+ info->pba_to_lba = kmalloc_objs(int, numblocks, GFP_NOIO);
if (info->lba_to_pba == NULL || info->pba_to_lba == NULL) {
kfree(info->lba_to_pba);
@@ -799,8 +799,7 @@ static int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us)
struct sddr55_card_info *info;
if (!us->extra) {
- us->extra = kzalloc(
- sizeof(struct sddr55_card_info), GFP_NOIO);
+ us->extra = kzalloc_obj(struct sddr55_card_info, GFP_NOIO);
if (!us->extra)
return USB_STOR_TRANSPORT_ERROR;
us->extra_destructor = sddr55_card_info_destructor;
diff --git a/drivers/usb/storage/shuttle_usbat.c b/drivers/usb/storage/shuttle_usbat.c
index 27faa0ead11d..7e5424268c73 100644
--- a/drivers/usb/storage/shuttle_usbat.c
+++ b/drivers/usb/storage/shuttle_usbat.c
@@ -1454,7 +1454,7 @@ static int init_usbat(struct us_data *us, int devicetype)
unsigned char subcountL = USBAT_ATA_LBA_ME;
unsigned char *status = us->iobuf;
- us->extra = kzalloc(sizeof(struct usbat_info), GFP_NOIO);
+ us->extra = kzalloc_obj(struct usbat_info, GFP_NOIO);
if (!us->extra)
return -ENOMEM;
diff --git a/drivers/usb/storage/sierra_ms.c b/drivers/usb/storage/sierra_ms.c
index 177fa6cd143a..357e5d29da0c 100644
--- a/drivers/usb/storage/sierra_ms.c
+++ b/drivers/usb/storage/sierra_ms.c
@@ -100,7 +100,7 @@ static ssize_t truinst_show(struct device *dev, struct device_attribute *attr,
if (swi_tru_install == TRU_FORCE_MS) {
result = sysfs_emit(buf, "Forced Mass Storage\n");
} else {
- swocInfo = kmalloc(sizeof(struct swoc_info), GFP_KERNEL);
+ swocInfo = kmalloc_obj(struct swoc_info, GFP_KERNEL);
if (!swocInfo) {
sysfs_emit(buf, "Error\n");
return -ENOMEM;
@@ -149,8 +149,7 @@ int sierra_ms_init(struct us_data *us)
else {
usb_stor_dbg(us, "SWIMS: Normal SWoC Logic\n");
- swocInfo = kmalloc(sizeof(struct swoc_info),
- GFP_KERNEL);
+ swocInfo = kmalloc_obj(struct swoc_info, GFP_KERNEL);
if (!swocInfo)
return -ENOMEM;
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index ac3c0b919fdd..0a9902d2b118 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -480,7 +480,7 @@ static struct urb *uas_alloc_sense_urb(struct uas_dev_info *devinfo, gfp_t gfp,
if (!urb)
goto out;
- iu = kzalloc(sizeof(*iu), gfp);
+ iu = kzalloc_obj(*iu, gfp);
if (!iu)
goto free;
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 152ee3376550..0d24d426a176 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -537,7 +537,7 @@ static int associate_dev(struct us_data *us, struct usb_interface *intf)
usb_set_intfdata(intf, us);
/* Allocate the control/setup and DMA-mapped buffers */
- us->cr = kmalloc(sizeof(*us->cr), GFP_KERNEL);
+ us->cr = kmalloc_obj(*us->cr, GFP_KERNEL);
if (!us->cr)
return -ENOMEM;
diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
index dbba53f02497..19f793ac6389 100644
--- a/drivers/usb/typec/class.c
+++ b/drivers/usb/typec/class.c
@@ -646,7 +646,7 @@ typec_register_altmode(struct device *parent,
struct altmode *alt;
int ret;
- alt = kzalloc(sizeof(*alt), GFP_KERNEL);
+ alt = kzalloc_obj(*alt, GFP_KERNEL);
if (!alt) {
altmode_id_remove(parent, id);
return ERR_PTR(-ENOMEM);
@@ -1113,7 +1113,7 @@ struct typec_partner *typec_register_partner(struct typec_port *port,
struct typec_partner *partner;
int ret;
- partner = kzalloc(sizeof(*partner), GFP_KERNEL);
+ partner = kzalloc_obj(*partner, GFP_KERNEL);
if (!partner)
return ERR_PTR(-ENOMEM);
@@ -1313,7 +1313,7 @@ struct typec_plug *typec_register_plug(struct typec_cable *cable,
char name[8];
int ret;
- plug = kzalloc(sizeof(*plug), GFP_KERNEL);
+ plug = kzalloc_obj(*plug, GFP_KERNEL);
if (!plug)
return ERR_PTR(-ENOMEM);
@@ -1466,7 +1466,7 @@ struct typec_cable *typec_register_cable(struct typec_port *port,
struct typec_cable *cable;
int ret;
- cable = kzalloc(sizeof(*cable), GFP_KERNEL);
+ cable = kzalloc_obj(*cable, GFP_KERNEL);
if (!cable)
return ERR_PTR(-ENOMEM);
@@ -2703,7 +2703,7 @@ struct typec_port *typec_register_port(struct device *parent,
int ret;
int id;
- port = kzalloc(sizeof(*port), GFP_KERNEL);
+ port = kzalloc_obj(*port, GFP_KERNEL);
if (!port)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/usb/typec/mode_selection.c b/drivers/usb/typec/mode_selection.c
index a95b31e21b52..56c6eced5666 100644
--- a/drivers/usb/typec/mode_selection.c
+++ b/drivers/usb/typec/mode_selection.c
@@ -216,7 +216,7 @@ static int altmode_add_to_list(struct device *dev, void *data)
struct mode_state *ms;
if (pdev && altmode->ops && altmode->ops->activate) {
- ms = kzalloc(sizeof(*ms), GFP_KERNEL);
+ ms = kzalloc_obj(*ms, GFP_KERNEL);
if (!ms)
return -ENOMEM;
ms->svid = pdev->svid;
@@ -240,7 +240,7 @@ int typec_mode_selection_start(struct typec_partner *partner,
if (partner->sel)
return -EALREADY;
- sel = kzalloc(sizeof(*sel), GFP_KERNEL);
+ sel = kzalloc_obj(*sel, GFP_KERNEL);
if (!sel)
return -ENOMEM;
diff --git a/drivers/usb/typec/mux.c b/drivers/usb/typec/mux.c
index 182c902c42f6..e09de0d3f32f 100644
--- a/drivers/usb/typec/mux.c
+++ b/drivers/usb/typec/mux.c
@@ -76,7 +76,7 @@ struct typec_switch *fwnode_typec_switch_get(struct fwnode_handle *fwnode)
int err;
int i;
- sw = kzalloc(sizeof(*sw), GFP_KERNEL);
+ sw = kzalloc_obj(*sw, GFP_KERNEL);
if (!sw)
return ERR_PTR(-ENOMEM);
@@ -171,7 +171,7 @@ typec_switch_register(struct device *parent,
if (!desc || !desc->set)
return ERR_PTR(-EINVAL);
- sw_dev = kzalloc(sizeof(*sw_dev), GFP_KERNEL);
+ sw_dev = kzalloc_obj(*sw_dev, GFP_KERNEL);
if (!sw_dev)
return ERR_PTR(-ENOMEM);
@@ -301,7 +301,7 @@ struct typec_mux *fwnode_typec_mux_get(struct fwnode_handle *fwnode)
int err;
int i;
- mux = kzalloc(sizeof(*mux), GFP_KERNEL);
+ mux = kzalloc_obj(*mux, GFP_KERNEL);
if (!mux)
return ERR_PTR(-ENOMEM);
@@ -415,7 +415,7 @@ typec_mux_register(struct device *parent, const struct typec_mux_desc *desc)
if (!desc || !desc->set)
return ERR_PTR(-EINVAL);
- mux_dev = kzalloc(sizeof(*mux_dev), GFP_KERNEL);
+ mux_dev = kzalloc_obj(*mux_dev, GFP_KERNEL);
if (!mux_dev)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/usb/typec/pd.c b/drivers/usb/typec/pd.c
index 67f20b5ffdf4..e3337ff98ab2 100644
--- a/drivers/usb/typec/pd.c
+++ b/drivers/usb/typec/pd.c
@@ -480,7 +480,7 @@ static int add_pdo(struct usb_power_delivery_capabilities *cap, u32 pdo, int pos
struct pdo *p;
int ret;
- p = kzalloc(sizeof(*p), GFP_KERNEL);
+ p = kzalloc_obj(*p, GFP_KERNEL);
if (!p)
return -ENOMEM;
@@ -569,7 +569,7 @@ usb_power_delivery_register_capabilities(struct usb_power_delivery *pd,
int ret;
int i;
- cap = kzalloc(sizeof(*cap), GFP_KERNEL);
+ cap = kzalloc_obj(*cap, GFP_KERNEL);
if (!cap)
return ERR_PTR(-ENOMEM);
@@ -697,7 +697,7 @@ usb_power_delivery_register(struct device *parent, struct usb_power_delivery_des
struct usb_power_delivery *pd;
int ret;
- pd = kzalloc(sizeof(*pd), GFP_KERNEL);
+ pd = kzalloc_obj(*pd, GFP_KERNEL);
if (!pd)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/usb/typec/retimer.c b/drivers/usb/typec/retimer.c
index b519fcf358ca..9bc896160af1 100644
--- a/drivers/usb/typec/retimer.c
+++ b/drivers/usb/typec/retimer.c
@@ -110,7 +110,7 @@ typec_retimer_register(struct device *parent, const struct typec_retimer_desc *d
if (!desc || !desc->set)
return ERR_PTR(-EINVAL);
- retimer = kzalloc(sizeof(*retimer), GFP_KERNEL);
+ retimer = kzalloc_obj(*retimer, GFP_KERNEL);
if (!retimer)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index b7828160b81d..13b9873ba92e 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -1665,7 +1665,7 @@ static int tcpm_queue_vdm_unlocked(struct tcpm_port *port, const u32 header,
u32 *data_cpy;
int ret = -ENOMEM;
- event = kzalloc(sizeof(*event), GFP_KERNEL);
+ event = kzalloc_obj(*event, GFP_KERNEL);
if (!event)
goto err_event;
@@ -3803,7 +3803,7 @@ void tcpm_pd_receive(struct tcpm_port *port, const struct pd_message *msg,
{
struct pd_rx_event *event;
- event = kzalloc(sizeof(*event), GFP_ATOMIC);
+ event = kzalloc_obj(*event, GFP_ATOMIC);
if (!event)
return;
diff --git a/drivers/usb/typec/ucsi/debugfs.c b/drivers/usb/typec/ucsi/debugfs.c
index d1f5832165c3..7549fef83d85 100644
--- a/drivers/usb/typec/ucsi/debugfs.c
+++ b/drivers/usb/typec/ucsi/debugfs.c
@@ -112,7 +112,7 @@ DEFINE_SHOW_ATTRIBUTE(ucsi_vbus_volt);
void ucsi_debugfs_register(struct ucsi *ucsi)
{
- ucsi->debugfs = kzalloc(sizeof(*ucsi->debugfs), GFP_KERNEL);
+ ucsi->debugfs = kzalloc_obj(*ucsi->debugfs, GFP_KERNEL);
if (!ucsi->debugfs)
return;
diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
index 91b6c71dd739..fe01a5e915d9 100644
--- a/drivers/usb/typec/ucsi/ucsi.c
+++ b/drivers/usb/typec/ucsi/ucsi.c
@@ -293,7 +293,7 @@ static int ucsi_partner_task(struct ucsi_connector *con,
if (!con->partner)
return 0;
- uwork = kzalloc(sizeof(*uwork), GFP_KERNEL);
+ uwork = kzalloc_obj(*uwork, GFP_KERNEL);
if (!uwork)
return -ENOMEM;
@@ -1865,7 +1865,8 @@ static int ucsi_init(struct ucsi *ucsi)
}
/* Allocate the connectors. Released in ucsi_unregister() */
- connector = kcalloc(ucsi->cap.num_connectors + 1, sizeof(*connector), GFP_KERNEL);
+ connector = kzalloc_objs(*connector, ucsi->cap.num_connectors + 1,
+ GFP_KERNEL);
if (!connector) {
ret = -ENOMEM;
goto err_reset;
@@ -2043,7 +2044,7 @@ struct ucsi *ucsi_create(struct device *dev, const struct ucsi_operations *ops)
!ops->read_message_in || !ops->sync_control || !ops->async_control)
return ERR_PTR(-EINVAL);
- ucsi = kzalloc(sizeof(*ucsi), GFP_KERNEL);
+ ucsi = kzalloc_obj(*ucsi, GFP_KERNEL);
if (!ucsi)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c
index 900a64ad25e4..5fe991baffa2 100644
--- a/drivers/usb/usb-skeleton.c
+++ b/drivers/usb/usb-skeleton.c
@@ -493,7 +493,7 @@ static int skel_probe(struct usb_interface *interface,
int retval;
/* allocate memory for our device state and initialize it */
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ dev = kzalloc_obj(*dev, GFP_KERNEL);
if (!dev)
return -ENOMEM;
diff --git a/drivers/usb/usbip/stub_dev.c b/drivers/usb/usbip/stub_dev.c
index ce625b1ce9a5..e859c51c94e8 100644
--- a/drivers/usb/usbip/stub_dev.c
+++ b/drivers/usb/usbip/stub_dev.c
@@ -263,7 +263,7 @@ static struct stub_device *stub_device_alloc(struct usb_device *udev)
dev_dbg(&udev->dev, "allocating stub device");
/* yes, it's a new device */
- sdev = kzalloc(sizeof(struct stub_device), GFP_KERNEL);
+ sdev = kzalloc_obj(struct stub_device, GFP_KERNEL);
if (!sdev)
return NULL;
diff --git a/drivers/usb/usbip/stub_rx.c b/drivers/usb/usbip/stub_rx.c
index 9aa30ef76f3b..7df83464a75f 100644
--- a/drivers/usb/usbip/stub_rx.c
+++ b/drivers/usb/usbip/stub_rx.c
@@ -535,7 +535,7 @@ static void stub_recv_cmd_submit(struct stub_device *sdev,
/* allocate urb array */
priv->num_urbs = num_urbs;
- priv->urbs = kmalloc_array(num_urbs, sizeof(*priv->urbs), GFP_KERNEL);
+ priv->urbs = kmalloc_objs(*priv->urbs, num_urbs, GFP_KERNEL);
if (!priv->urbs)
goto err_urbs;
diff --git a/drivers/usb/usbip/stub_tx.c b/drivers/usb/usbip/stub_tx.c
index cd92d9fac327..9e6187c3ddb0 100644
--- a/drivers/usb/usbip/stub_tx.c
+++ b/drivers/usb/usbip/stub_tx.c
@@ -17,7 +17,7 @@ void stub_enqueue_ret_unlink(struct stub_device *sdev, __u32 seqnum,
{
struct stub_unlink *unlink;
- unlink = kzalloc(sizeof(struct stub_unlink), GFP_ATOMIC);
+ unlink = kzalloc_obj(struct stub_unlink, GFP_ATOMIC);
if (!unlink) {
usbip_event_add(&sdev->ud, VDEV_EVENT_ERROR_MALLOC);
return;
@@ -191,7 +191,7 @@ static int stub_send_ret_submit(struct stub_device *sdev)
else
iovnum = 2;
- iov = kcalloc(iovnum, sizeof(struct kvec), GFP_KERNEL);
+ iov = kzalloc_objs(struct kvec, iovnum, GFP_KERNEL);
if (!iov) {
usbip_event_add(&sdev->ud, SDEV_EVENT_ERROR_MALLOC);
diff --git a/drivers/usb/usbip/usbip_event.c b/drivers/usb/usbip/usbip_event.c
index 26513540bcdb..0e00c2d000f8 100644
--- a/drivers/usb/usbip/usbip_event.c
+++ b/drivers/usb/usbip/usbip_event.c
@@ -158,7 +158,7 @@ void usbip_event_add(struct usbip_device *ud, unsigned long event)
goto out;
}
- ue = kmalloc(sizeof(struct usbip_event), GFP_ATOMIC);
+ ue = kmalloc_obj(struct usbip_event, GFP_ATOMIC);
if (ue == NULL)
goto out;
diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c
index e55690da19e5..4dcda9e8316f 100644
--- a/drivers/usb/usbip/vhci_hcd.c
+++ b/drivers/usb/usbip/vhci_hcd.c
@@ -671,7 +671,7 @@ static void vhci_tx_urb(struct urb *urb, struct vhci_device *vdev)
struct vhci_hcd *vhci_hcd = vdev_to_vhci_hcd(vdev);
unsigned long flags;
- priv = kzalloc(sizeof(struct vhci_priv), GFP_ATOMIC);
+ priv = kzalloc_obj(struct vhci_priv, GFP_ATOMIC);
if (!priv) {
usbip_event_add(&vdev->ud, VDEV_EVENT_ERROR_MALLOC);
return;
@@ -951,7 +951,7 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
spin_lock(&vdev->priv_lock);
/* setup CMD_UNLINK pdu */
- unlink = kzalloc(sizeof(struct vhci_unlink), GFP_ATOMIC);
+ unlink = kzalloc_obj(struct vhci_unlink, GFP_ATOMIC);
if (!unlink) {
spin_unlock(&vdev->priv_lock);
spin_unlock_irqrestore(&vhci->lock, flags);
@@ -1537,7 +1537,7 @@ static int __init vhci_hcd_init(void)
if (vhci_num_controllers < 1)
vhci_num_controllers = 1;
- vhcis = kcalloc(vhci_num_controllers, sizeof(struct vhci), GFP_KERNEL);
+ vhcis = kzalloc_objs(struct vhci, vhci_num_controllers, GFP_KERNEL);
if (vhcis == NULL)
return -ENOMEM;
diff --git a/drivers/usb/usbip/vhci_sysfs.c b/drivers/usb/usbip/vhci_sysfs.c
index d5865460e82d..f7929b4a43a4 100644
--- a/drivers/usb/usbip/vhci_sysfs.c
+++ b/drivers/usb/usbip/vhci_sysfs.c
@@ -476,8 +476,8 @@ static int init_status_attrs(void)
{
int id;
- status_attrs = kcalloc(vhci_num_controllers, sizeof(struct status_attr),
- GFP_KERNEL);
+ status_attrs = kzalloc_objs(struct status_attr, vhci_num_controllers,
+ GFP_KERNEL);
if (status_attrs == NULL)
return -ENOMEM;
@@ -501,8 +501,8 @@ int vhci_init_attr_group(void)
struct attribute **attrs;
int ret, i;
- attrs = kcalloc((vhci_num_controllers + 5), sizeof(struct attribute *),
- GFP_KERNEL);
+ attrs = kzalloc_objs(struct attribute *, (vhci_num_controllers + 5),
+ GFP_KERNEL);
if (attrs == NULL)
return -ENOMEM;
diff --git a/drivers/usb/usbip/vhci_tx.c b/drivers/usb/usbip/vhci_tx.c
index 0ae40a13a9fe..a63805d57d94 100644
--- a/drivers/usb/usbip/vhci_tx.c
+++ b/drivers/usb/usbip/vhci_tx.c
@@ -82,7 +82,7 @@ static int vhci_send_cmd_submit(struct vhci_device *vdev)
else
iovnum = 3;
- iov = kcalloc(iovnum, sizeof(*iov), GFP_KERNEL);
+ iov = kzalloc_objs(*iov, iovnum, GFP_KERNEL);
if (!iov) {
usbip_event_add(&vdev->ud, SDEV_EVENT_ERROR_MALLOC);
return -ENOMEM;
diff --git a/drivers/usb/usbip/vudc_dev.c b/drivers/usb/usbip/vudc_dev.c
index f11535020e35..80ab3d019b87 100644
--- a/drivers/usb/usbip/vudc_dev.c
+++ b/drivers/usb/usbip/vudc_dev.c
@@ -43,7 +43,7 @@ struct urbp *alloc_urbp(void)
{
struct urbp *urb_p;
- urb_p = kzalloc(sizeof(*urb_p), GFP_KERNEL);
+ urb_p = kzalloc_obj(*urb_p, GFP_KERNEL);
if (!urb_p)
return urb_p;
@@ -284,7 +284,7 @@ static struct usb_request *vep_alloc_request(struct usb_ep *_ep,
if (!_ep)
return NULL;
- req = kzalloc(sizeof(*req), mem_flags);
+ req = kzalloc_obj(*req, mem_flags);
if (!req)
return NULL;
@@ -491,7 +491,7 @@ struct vudc_device *alloc_vudc_device(int devid)
{
struct vudc_device *udc_dev;
- udc_dev = kzalloc(sizeof(*udc_dev), GFP_KERNEL);
+ udc_dev = kzalloc_obj(*udc_dev, GFP_KERNEL);
if (!udc_dev)
return NULL;
@@ -518,7 +518,7 @@ static int init_vudc_hw(struct vudc *udc)
struct usbip_device *ud = &udc->ud;
struct vep *ep;
- udc->ep = kcalloc(VIRTUAL_ENDPOINTS, sizeof(*udc->ep), GFP_KERNEL);
+ udc->ep = kzalloc_objs(*udc->ep, VIRTUAL_ENDPOINTS, GFP_KERNEL);
if (!udc->ep)
goto nomem_ep;
@@ -598,7 +598,7 @@ int vudc_probe(struct platform_device *pdev)
struct vudc *udc;
int ret = -ENOMEM;
- udc = kzalloc(sizeof(*udc), GFP_KERNEL);
+ udc = kzalloc_obj(*udc, GFP_KERNEL);
if (!udc)
goto out;
diff --git a/drivers/usb/usbip/vudc_tx.c b/drivers/usb/usbip/vudc_tx.c
index 30c11bf9f4e7..b4b7796319f1 100644
--- a/drivers/usb/usbip/vudc_tx.c
+++ b/drivers/usb/usbip/vudc_tx.c
@@ -97,7 +97,7 @@ static int v_send_ret_submit(struct vudc *udc, struct urbp *urb_p)
else
iovnum = 2;
- iov = kcalloc(iovnum, sizeof(*iov), GFP_KERNEL);
+ iov = kzalloc_objs(*iov, iovnum, GFP_KERNEL);
if (!iov) {
usbip_event_add(&udc->ud, VUDC_EVENT_ERROR_MALLOC);
ret = -ENOMEM;
@@ -246,12 +246,12 @@ void v_enqueue_ret_unlink(struct vudc *udc, __u32 seqnum, __u32 status)
struct tx_item *txi;
struct v_unlink *unlink;
- txi = kzalloc(sizeof(*txi), GFP_ATOMIC);
+ txi = kzalloc_obj(*txi, GFP_ATOMIC);
if (!txi) {
usbip_event_add(&udc->ud, VDEV_EVENT_ERROR_MALLOC);
return;
}
- unlink = kzalloc(sizeof(*unlink), GFP_ATOMIC);
+ unlink = kzalloc_obj(*unlink, GFP_ATOMIC);
if (!unlink) {
kfree(txi);
usbip_event_add(&udc->ud, VDEV_EVENT_ERROR_MALLOC);
@@ -271,7 +271,7 @@ void v_enqueue_ret_submit(struct vudc *udc, struct urbp *urb_p)
{
struct tx_item *txi;
- txi = kzalloc(sizeof(*txi), GFP_ATOMIC);
+ txi = kzalloc_obj(*txi, GFP_ATOMIC);
if (!txi) {
usbip_event_add(&udc->ud, VDEV_EVENT_ERROR_MALLOC);
return;