summaryrefslogtreecommitdiff
path: root/drivers/tty
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/ehv_bytechan.c2
-rw-r--r--drivers/tty/goldfish.c5
-rw-r--r--drivers/tty/hvc/hvc_console.c2
-rw-r--r--drivers/tty/hvc/hvc_iucv.c2
-rw-r--r--drivers/tty/hvc/hvc_opal.c2
-rw-r--r--drivers/tty/hvc/hvc_vio.c2
-rw-r--r--drivers/tty/hvc/hvc_xen.c8
-rw-r--r--drivers/tty/hvc/hvcs.c5
-rw-r--r--drivers/tty/ipwireless/hardware.c2
-rw-r--r--drivers/tty/ipwireless/main.c2
-rw-r--r--drivers/tty/ipwireless/network.c4
-rw-r--r--drivers/tty/ipwireless/tty.c2
-rw-r--r--drivers/tty/n_gsm.c7
-rw-r--r--drivers/tty/n_hdlc.c7
-rw-r--r--drivers/tty/nozomi.c2
-rw-r--r--drivers/tty/pty.c4
-rw-r--r--drivers/tty/rpmsg_tty.c2
-rw-r--r--drivers/tty/serdev/core.c2
-rw-r--r--drivers/tty/serial/8250/8250_acorn.c2
-rw-r--r--drivers/tty/serial/8250/8250_core.c2
-rw-r--r--drivers/tty/serial/8250/8250_hp300.c2
-rw-r--r--drivers/tty/serial/8250/8250_ni.c2
-rw-r--r--drivers/tty/serial/8250/8250_of.c2
-rw-r--r--drivers/tty/serial/8250/8250_pci.c2
-rw-r--r--drivers/tty/serial/8250/8250_platform.c6
-rw-r--r--drivers/tty/serial/8250/8250_port.c2
-rw-r--r--drivers/tty/serial/8250/serial_cs.c2
-rw-r--r--drivers/tty/serial/icom.c2
-rw-r--r--drivers/tty/serial/jsm/jsm_driver.c2
-rw-r--r--drivers/tty/serial/jsm/jsm_tty.c3
-rw-r--r--drivers/tty/serial/max3100.c2
-rw-r--r--drivers/tty/serial/pch_uart.c4
-rw-r--r--drivers/tty/serial/pxa.c2
-rw-r--r--drivers/tty/serial/serial_base_bus.c4
-rw-r--r--drivers/tty/serial/serial_core.c6
-rw-r--r--drivers/tty/serial/sunhv.c2
-rw-r--r--drivers/tty/serial/sunsab.c5
-rw-r--r--drivers/tty/serial/sunsu.c2
-rw-r--r--drivers/tty/serial/timbuart.c2
-rw-r--r--drivers/tty/serial/ucc_uart.c2
-rw-r--r--drivers/tty/synclink_gt.c2
-rw-r--r--drivers/tty/sysrq.c2
-rw-r--r--drivers/tty/tty_audit.c2
-rw-r--r--drivers/tty/tty_buffer.c2
-rw-r--r--drivers/tty/tty_io.c22
-rw-r--r--drivers/tty/tty_ldisc.c2
-rw-r--r--drivers/tty/vcc.c4
-rw-r--r--drivers/tty/vt/consolemap.c2
-rw-r--r--drivers/tty/vt/keyboard.c3
-rw-r--r--drivers/tty/vt/vc_screen.c2
-rw-r--r--drivers/tty/vt/vt.c5
51 files changed, 84 insertions, 86 deletions
diff --git a/drivers/tty/ehv_bytechan.c b/drivers/tty/ehv_bytechan.c
index 69508d7a4135..2cbbaed14ee6 100644
--- a/drivers/tty/ehv_bytechan.c
+++ b/drivers/tty/ehv_bytechan.c
@@ -772,7 +772,7 @@ static int __init ehv_bc_init(void)
* array, then you can use pointer math (e.g. "bc - bcs") to get its
* tty index.
*/
- bcs = kcalloc(count, sizeof(struct ehv_bc_data), GFP_KERNEL);
+ bcs = kzalloc_objs(struct ehv_bc_data, count, GFP_KERNEL);
if (!bcs)
return -ENOMEM;
diff --git a/drivers/tty/goldfish.c b/drivers/tty/goldfish.c
index 3a9582029005..c587ded7f9a5 100644
--- a/drivers/tty/goldfish.c
+++ b/drivers/tty/goldfish.c
@@ -238,9 +238,8 @@ static int goldfish_tty_create_driver(void)
int ret;
struct tty_driver *tty;
- goldfish_ttys = kcalloc(goldfish_tty_line_count,
- sizeof(*goldfish_ttys),
- GFP_KERNEL);
+ goldfish_ttys = kzalloc_objs(*goldfish_ttys, goldfish_tty_line_count,
+ GFP_KERNEL);
if (goldfish_ttys == NULL) {
ret = -ENOMEM;
goto err_alloc_goldfish_ttys_failed;
diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c
index 6b58f340f210..9b3856766e8c 100644
--- a/drivers/tty/hvc/hvc_console.c
+++ b/drivers/tty/hvc/hvc_console.c
@@ -922,7 +922,7 @@ struct hvc_struct *hvc_alloc(uint32_t vtermno, int data,
return ERR_PTR(err);
}
- hp = kzalloc(struct_size(hp, outbuf, outbuf_size), GFP_KERNEL);
+ hp = kzalloc_flex(*hp, outbuf, outbuf_size, GFP_KERNEL);
if (!hp)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/tty/hvc/hvc_iucv.c b/drivers/tty/hvc/hvc_iucv.c
index a7939c49c9cf..7fd3937d1396 100644
--- a/drivers/tty/hvc/hvc_iucv.c
+++ b/drivers/tty/hvc/hvc_iucv.c
@@ -1050,7 +1050,7 @@ static int __init hvc_iucv_alloc(int id, unsigned int is_console)
char name[9];
int rc;
- priv = kzalloc(sizeof(struct hvc_iucv_private), GFP_KERNEL);
+ priv = kzalloc_obj(struct hvc_iucv_private, GFP_KERNEL);
if (!priv)
return -ENOMEM;
diff --git a/drivers/tty/hvc/hvc_opal.c b/drivers/tty/hvc/hvc_opal.c
index b2ec1f6efa0a..72dfab77890c 100644
--- a/drivers/tty/hvc/hvc_opal.c
+++ b/drivers/tty/hvc/hvc_opal.c
@@ -181,7 +181,7 @@ static int hvc_opal_probe(struct platform_device *dev)
pv = hvc_opal_privs[termno];
boot = 1;
} else if (hvc_opal_privs[termno] == NULL) {
- pv = kzalloc(sizeof(struct hvc_opal_priv), GFP_KERNEL);
+ pv = kzalloc_obj(struct hvc_opal_priv, GFP_KERNEL);
if (!pv)
return -ENOMEM;
pv->proto = proto;
diff --git a/drivers/tty/hvc/hvc_vio.c b/drivers/tty/hvc/hvc_vio.c
index 47930601a26a..8725cc77c557 100644
--- a/drivers/tty/hvc/hvc_vio.c
+++ b/drivers/tty/hvc/hvc_vio.c
@@ -338,7 +338,7 @@ static int hvc_vio_probe(struct vio_dev *vdev,
pr_devel("->non-boot console, using termno %d\n", termno);
if (termno < 0)
return -ENODEV;
- pv = kzalloc(sizeof(struct hvterm_priv), GFP_KERNEL);
+ pv = kzalloc_obj(struct hvterm_priv, GFP_KERNEL);
if (!pv)
return -ENOMEM;
pv->termno = vdev->unit_address;
diff --git a/drivers/tty/hvc/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c
index 95ec01b1aacf..138afdf3bbc4 100644
--- a/drivers/tty/hvc/hvc_xen.c
+++ b/drivers/tty/hvc/hvc_xen.c
@@ -264,7 +264,7 @@ static int xen_hvm_console_init(void)
info = vtermno_to_xencons(HVC_COOKIE);
if (!info) {
- info = kzalloc(sizeof(struct xencons_info), GFP_KERNEL);
+ info = kzalloc_obj(struct xencons_info, GFP_KERNEL);
if (!info)
return -ENOMEM;
spin_lock_init(&info->ring_lock);
@@ -328,7 +328,7 @@ static int xen_pv_console_init(void)
info = vtermno_to_xencons(HVC_COOKIE);
if (!info) {
- info = kzalloc(sizeof(struct xencons_info), GFP_KERNEL);
+ info = kzalloc_obj(struct xencons_info, GFP_KERNEL);
if (!info)
return -ENOMEM;
} else if (info->intf != NULL) {
@@ -352,7 +352,7 @@ static int xen_initial_domain_console_init(void)
info = vtermno_to_xencons(HVC_COOKIE);
if (!info) {
- info = kzalloc(sizeof(struct xencons_info), GFP_KERNEL);
+ info = kzalloc_obj(struct xencons_info, GFP_KERNEL);
if (!info)
return -ENOMEM;
spin_lock_init(&info->ring_lock);
@@ -513,7 +513,7 @@ static int xencons_probe(struct xenbus_device *dev,
if (devid == 0)
return -ENODEV;
- info = kzalloc(sizeof(struct xencons_info), GFP_KERNEL);
+ info = kzalloc_obj(struct xencons_info, GFP_KERNEL);
if (!info)
return -ENOMEM;
spin_lock_init(&info->ring_lock);
diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
index f57fd9095f75..7ff3c87354b8 100644
--- a/drivers/tty/hvc/hvcs.c
+++ b/drivers/tty/hvc/hvcs.c
@@ -748,7 +748,7 @@ static int hvcs_probe(
return -EFAULT;
}
- hvcsd = kzalloc(sizeof(*hvcsd), GFP_KERNEL);
+ hvcsd = kzalloc_obj(*hvcsd, GFP_KERNEL);
if (!hvcsd)
return -ENODEV;
@@ -1394,8 +1394,7 @@ static int hvcs_alloc_index_list(int n)
{
int i;
- hvcs_index_list = kmalloc_array(n, sizeof(hvcs_index_count),
- GFP_KERNEL);
+ hvcs_index_list = kmalloc_objs(hvcs_index_count, n, GFP_KERNEL);
if (!hvcs_index_list)
return -ENOMEM;
hvcs_index_count = n;
diff --git a/drivers/tty/ipwireless/hardware.c b/drivers/tty/ipwireless/hardware.c
index e18848267be4..6e6aa90b33ba 100644
--- a/drivers/tty/ipwireless/hardware.c
+++ b/drivers/tty/ipwireless/hardware.c
@@ -1618,7 +1618,7 @@ struct ipw_hardware *ipwireless_hardware_create(void)
{
int i;
struct ipw_hardware *hw =
- kzalloc(sizeof(struct ipw_hardware), GFP_KERNEL);
+ kzalloc_obj(struct ipw_hardware, GFP_KERNEL);
if (!hw)
return NULL;
diff --git a/drivers/tty/ipwireless/main.c b/drivers/tty/ipwireless/main.c
index 4c18bbfe1a92..3bf160d62a1e 100644
--- a/drivers/tty/ipwireless/main.c
+++ b/drivers/tty/ipwireless/main.c
@@ -267,7 +267,7 @@ static int ipwireless_attach(struct pcmcia_device *link)
struct ipw_dev *ipw;
int ret;
- ipw = kzalloc(sizeof(struct ipw_dev), GFP_KERNEL);
+ ipw = kzalloc_obj(struct ipw_dev, GFP_KERNEL);
if (!ipw)
return -ENOMEM;
diff --git a/drivers/tty/ipwireless/network.c b/drivers/tty/ipwireless/network.c
index fe569f6294a2..cb864142be09 100644
--- a/drivers/tty/ipwireless/network.c
+++ b/drivers/tty/ipwireless/network.c
@@ -257,7 +257,7 @@ static void do_go_online(struct work_struct *work_go_online)
struct ppp_channel *channel;
spin_unlock_irqrestore(&network->lock, flags);
- channel = kzalloc(sizeof(struct ppp_channel), GFP_KERNEL);
+ channel = kzalloc_obj(struct ppp_channel, GFP_KERNEL);
if (!channel) {
printk(KERN_ERR IPWIRELESS_PCCARD_NAME
": unable to allocate PPP channel\n");
@@ -416,7 +416,7 @@ void ipwireless_network_packet_received(struct ipw_network *network,
struct ipw_network *ipwireless_network_create(struct ipw_hardware *hw)
{
struct ipw_network *network =
- kzalloc(sizeof(struct ipw_network), GFP_KERNEL);
+ kzalloc_obj(struct ipw_network, GFP_KERNEL);
if (!network)
return NULL;
diff --git a/drivers/tty/ipwireless/tty.c b/drivers/tty/ipwireless/tty.c
index b6de40815fb9..79c01ff49c65 100644
--- a/drivers/tty/ipwireless/tty.c
+++ b/drivers/tty/ipwireless/tty.c
@@ -437,7 +437,7 @@ static int add_tty(int j,
struct ipw_network *network, int channel_idx,
int secondary_channel_idx, int tty_type)
{
- ttys[j] = kzalloc(sizeof(struct ipw_tty), GFP_KERNEL);
+ ttys[j] = kzalloc_obj(struct ipw_tty, GFP_KERNEL);
if (!ttys[j])
return -ENOMEM;
ttys[j]->index = j;
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 214abeb89aaa..815e35a24af9 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -2065,8 +2065,7 @@ static void gsm_control_retransmit(struct timer_list *t)
static struct gsm_control *gsm_control_send(struct gsm_mux *gsm,
unsigned int command, u8 *data, int clen)
{
- struct gsm_control *ctrl = kzalloc(sizeof(struct gsm_control),
- GFP_ATOMIC);
+ struct gsm_control *ctrl = kzalloc_obj(struct gsm_control, GFP_ATOMIC);
unsigned long flags;
if (ctrl == NULL)
return NULL;
@@ -2646,7 +2645,7 @@ static int gsm_dlci_config(struct gsm_dlci *dlci, struct gsm_dlci_config *dc, in
static struct gsm_dlci *gsm_dlci_alloc(struct gsm_mux *gsm, int addr)
{
- struct gsm_dlci *dlci = kzalloc(sizeof(struct gsm_dlci), GFP_ATOMIC);
+ struct gsm_dlci *dlci = kzalloc_obj(struct gsm_dlci, GFP_ATOMIC);
if (dlci == NULL)
return NULL;
spin_lock_init(&dlci->lock);
@@ -3276,7 +3275,7 @@ static inline unsigned int mux_line_to_num(unsigned int line)
static struct gsm_mux *gsm_alloc_mux(void)
{
int i;
- struct gsm_mux *gsm = kzalloc(sizeof(struct gsm_mux), GFP_KERNEL);
+ struct gsm_mux *gsm = kzalloc_obj(struct gsm_mux, GFP_KERNEL);
if (gsm == NULL)
return NULL;
gsm->buf = kmalloc(MAX_MRU + 1, GFP_KERNEL);
diff --git a/drivers/tty/n_hdlc.c b/drivers/tty/n_hdlc.c
index f242d73ee4e0..6c685a6d4ddb 100644
--- a/drivers/tty/n_hdlc.c
+++ b/drivers/tty/n_hdlc.c
@@ -388,8 +388,7 @@ static void n_hdlc_tty_receive(struct tty_struct *tty, const u8 *data,
* buffer unless the maximum count has been reached
*/
if (n_hdlc->rx_buf_list.count < MAX_RX_BUF_COUNT)
- buf = kmalloc(struct_size(buf, buf, maxframe),
- GFP_ATOMIC);
+ buf = kmalloc_flex(*buf, buf, maxframe, GFP_ATOMIC);
}
if (!buf) {
@@ -670,7 +669,7 @@ static void n_hdlc_alloc_buf(struct n_hdlc_buf_list *list, unsigned int count,
unsigned int i;
for (i = 0; i < count; i++) {
- buf = kmalloc(struct_size(buf, buf, maxframe), GFP_KERNEL);
+ buf = kmalloc_flex(*buf, buf, maxframe, GFP_KERNEL);
if (!buf) {
pr_debug("%s(), kmalloc() failed for %s buffer %u\n",
__func__, name, i);
@@ -687,7 +686,7 @@ static void n_hdlc_alloc_buf(struct n_hdlc_buf_list *list, unsigned int count,
*/
static struct n_hdlc *n_hdlc_alloc(void)
{
- struct n_hdlc *n_hdlc = kzalloc(sizeof(*n_hdlc), GFP_KERNEL);
+ struct n_hdlc *n_hdlc = kzalloc_obj(*n_hdlc, GFP_KERNEL);
if (!n_hdlc)
return NULL;
diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c
index e28a921c1637..b05f4a8553ac 100644
--- a/drivers/tty/nozomi.c
+++ b/drivers/tty/nozomi.c
@@ -1298,7 +1298,7 @@ static int nozomi_card_init(struct pci_dev *pdev,
goto err;
}
- dc = kzalloc(sizeof(struct nozomi), GFP_KERNEL);
+ dc = kzalloc_obj(struct nozomi, GFP_KERNEL);
if (unlikely(!dc)) {
dev_err(&pdev->dev, "Could not allocate memory\n");
ret = -ENOMEM;
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index 6120d827a797..ce58997dae93 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -364,8 +364,8 @@ static int pty_common_install(struct tty_driver *driver, struct tty_struct *tty,
if (driver->subtype != PTY_TYPE_MASTER)
return -EIO;
- ports[0] = kmalloc(sizeof **ports, GFP_KERNEL);
- ports[1] = kmalloc(sizeof **ports, GFP_KERNEL);
+ ports[0] = kmalloc_obj(**ports, GFP_KERNEL);
+ ports[1] = kmalloc_obj(**ports, GFP_KERNEL);
if (!ports[0] || !ports[1])
goto err;
if (!try_module_get(driver->other->owner)) {
diff --git a/drivers/tty/rpmsg_tty.c b/drivers/tty/rpmsg_tty.c
index 60a2915f5cfe..6ada8e92bbf2 100644
--- a/drivers/tty/rpmsg_tty.c
+++ b/drivers/tty/rpmsg_tty.c
@@ -134,7 +134,7 @@ static struct rpmsg_tty_port *rpmsg_tty_alloc_cport(void)
struct rpmsg_tty_port *cport;
int ret;
- cport = kzalloc(sizeof(*cport), GFP_KERNEL);
+ cport = kzalloc_obj(*cport, GFP_KERNEL);
if (!cport)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
index 40eedc15277c..aced9d895103 100644
--- a/drivers/tty/serdev/core.c
+++ b/drivers/tty/serdev/core.c
@@ -442,7 +442,7 @@ struct serdev_device *serdev_device_alloc(struct serdev_controller *ctrl)
{
struct serdev_device *serdev;
- serdev = kzalloc(sizeof(*serdev), GFP_KERNEL);
+ serdev = kzalloc_obj(*serdev, GFP_KERNEL);
if (!serdev)
return NULL;
diff --git a/drivers/tty/serial/8250/8250_acorn.c b/drivers/tty/serial/8250/8250_acorn.c
index 758c4aa203ab..84889bb952a2 100644
--- a/drivers/tty/serial/8250/8250_acorn.c
+++ b/drivers/tty/serial/8250/8250_acorn.c
@@ -44,7 +44,7 @@ serial_card_probe(struct expansion_card *ec, const struct ecard_id *id)
unsigned long bus_addr;
unsigned int i;
- info = kzalloc(sizeof(struct serial_card_info), GFP_KERNEL);
+ info = kzalloc_obj(struct serial_card_info, GFP_KERNEL);
if (!info)
return -ENOMEM;
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index 0e81f78c6063..74a358e7ae03 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -140,7 +140,7 @@ static struct irq_info *serial_get_or_create_irq_info(const struct uart_8250_por
if (i->irq == up->port.irq)
return i;
- i = kzalloc(sizeof(*i), GFP_KERNEL);
+ i = kzalloc_obj(*i, GFP_KERNEL);
if (i == NULL)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/tty/serial/8250/8250_hp300.c b/drivers/tty/serial/8250/8250_hp300.c
index 3012ea03d22c..732f1a158e62 100644
--- a/drivers/tty/serial/8250/8250_hp300.c
+++ b/drivers/tty/serial/8250/8250_hp300.c
@@ -240,7 +240,7 @@ static int __init hp300_8250_init(void)
#endif
/* Create new serial device */
- port = kmalloc(sizeof(struct hp300_port), GFP_KERNEL);
+ port = kmalloc_obj(struct hp300_port, GFP_KERNEL);
if (!port)
return -ENOMEM;
diff --git a/drivers/tty/serial/8250/8250_ni.c b/drivers/tty/serial/8250/8250_ni.c
index cb5b42b3609c..3f3dac694e20 100644
--- a/drivers/tty/serial/8250/8250_ni.c
+++ b/drivers/tty/serial/8250/8250_ni.c
@@ -285,7 +285,7 @@ static int ni16550_probe(struct platform_device *pdev)
bool rs232_property;
int ret;
- uart = kzalloc(sizeof(*uart), GFP_KERNEL);
+ uart = kzalloc_obj(*uart, GFP_KERNEL);
if (!uart)
return -ENOMEM;
diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c
index 9799356b65f7..9c721bafbe37 100644
--- a/drivers/tty/serial/8250/8250_of.c
+++ b/drivers/tty/serial/8250/8250_of.c
@@ -217,7 +217,7 @@ static int of_platform_serial_probe(struct platform_device *ofdev)
if (of_property_read_bool(ofdev->dev.of_node, "used-by-rtas"))
return -EBUSY;
- info = kzalloc(sizeof(*info), GFP_KERNEL);
+ info = kzalloc_obj(*info, GFP_KERNEL);
if (info == NULL)
return -ENOMEM;
diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
index 6589bb531cc6..643e5a620948 100644
--- a/drivers/tty/serial/8250/8250_pci.c
+++ b/drivers/tty/serial/8250/8250_pci.c
@@ -4148,7 +4148,7 @@ pciserial_init_ports(struct pci_dev *dev, const struct pciserial_board *board)
nr_ports = rc;
}
- priv = kzalloc(struct_size(priv, line, nr_ports), GFP_KERNEL);
+ priv = kzalloc_flex(*priv, line, nr_ports, GFP_KERNEL);
if (!priv) {
priv = ERR_PTR(-ENOMEM);
goto err_deinit;
diff --git a/drivers/tty/serial/8250/8250_platform.c b/drivers/tty/serial/8250/8250_platform.c
index 86d12d2b5907..37f3ef4d041d 100644
--- a/drivers/tty/serial/8250/8250_platform.c
+++ b/drivers/tty/serial/8250/8250_platform.c
@@ -111,7 +111,8 @@ static int serial8250_probe_acpi(struct platform_device *pdev)
struct resource *regs;
int ret, line;
- struct uart_8250_port *uart __free(kfree) = kzalloc(sizeof(*uart), GFP_KERNEL);
+ struct uart_8250_port *uart __free(kfree) = kzalloc_obj(*uart,
+ GFP_KERNEL);
if (!uart)
return -ENOMEM;
@@ -156,7 +157,8 @@ static int serial8250_probe_platform(struct platform_device *dev, struct plat_se
{
int ret, i;
- struct uart_8250_port *uart __free(kfree) = kzalloc(sizeof(*uart), GFP_KERNEL);
+ struct uart_8250_port *uart __free(kfree) = kzalloc_obj(*uart,
+ GFP_KERNEL);
if (!uart)
return -ENOMEM;
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index 719faf92aa8a..cc94af2d578a 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -553,7 +553,7 @@ static int serial8250_em485_init(struct uart_8250_port *p)
if (p->em485)
goto deassert_rts;
- p->em485 = kmalloc(sizeof(struct uart_8250_em485), GFP_ATOMIC);
+ p->em485 = kmalloc_obj(struct uart_8250_em485, GFP_ATOMIC);
if (!p->em485)
return -ENOMEM;
diff --git a/drivers/tty/serial/8250/serial_cs.c b/drivers/tty/serial/8250/serial_cs.c
index 58e279ea7ee0..5c372bd7f92a 100644
--- a/drivers/tty/serial/8250/serial_cs.c
+++ b/drivers/tty/serial/8250/serial_cs.c
@@ -305,7 +305,7 @@ static int serial_probe(struct pcmcia_device *link)
dev_dbg(&link->dev, "serial_attach()\n");
/* Create new serial device */
- info = kzalloc(sizeof(*info), GFP_KERNEL);
+ info = kzalloc_obj(*info, GFP_KERNEL);
if (!info)
return -ENOMEM;
info->p_dev = link;
diff --git a/drivers/tty/serial/icom.c b/drivers/tty/serial/icom.c
index b7e33a896589..c0a7f8a0ff55 100644
--- a/drivers/tty/serial/icom.c
+++ b/drivers/tty/serial/icom.c
@@ -1632,7 +1632,7 @@ static int icom_alloc_adapter(struct icom_adapter
struct icom_adapter *icom_adapter;
struct icom_adapter *cur_adapter_entry;
- icom_adapter = kzalloc(sizeof(struct icom_adapter), GFP_KERNEL);
+ icom_adapter = kzalloc_obj(struct icom_adapter, GFP_KERNEL);
if (!icom_adapter) {
return -ENOMEM;
diff --git a/drivers/tty/serial/jsm/jsm_driver.c b/drivers/tty/serial/jsm/jsm_driver.c
index 8d21373cae57..2a048dc62b96 100644
--- a/drivers/tty/serial/jsm/jsm_driver.c
+++ b/drivers/tty/serial/jsm/jsm_driver.c
@@ -66,7 +66,7 @@ static int jsm_probe_one(struct pci_dev *pdev, const struct pci_device_id *ent)
goto out_disable_device;
}
- brd = kzalloc(sizeof(*brd), GFP_KERNEL);
+ brd = kzalloc_obj(*brd, GFP_KERNEL);
if (!brd) {
rc = -ENOMEM;
goto out_release_regions;
diff --git a/drivers/tty/serial/jsm/jsm_tty.c b/drivers/tty/serial/jsm/jsm_tty.c
index be2f130696b3..8c665fc771dd 100644
--- a/drivers/tty/serial/jsm/jsm_tty.c
+++ b/drivers/tty/serial/jsm/jsm_tty.c
@@ -391,7 +391,8 @@ int jsm_tty_init(struct jsm_board *brd)
* Okay to malloc with GFP_KERNEL, we are not at
* interrupt context, and there are no locks held.
*/
- brd->channels[i] = kzalloc(sizeof(struct jsm_channel), GFP_KERNEL);
+ brd->channels[i] = kzalloc_obj(struct jsm_channel,
+ GFP_KERNEL);
if (!brd->channels[i]) {
jsm_dbg(CORE, &brd->pci_dev,
"%s:%d Unable to allocate memory for channel struct\n",
diff --git a/drivers/tty/serial/max3100.c b/drivers/tty/serial/max3100.c
index 3faa1b6aa3ee..68cef83de47d 100644
--- a/drivers/tty/serial/max3100.c
+++ b/drivers/tty/serial/max3100.c
@@ -708,7 +708,7 @@ static int max3100_probe(struct spi_device *spi)
return dev_err_probe(dev, -ENOSPC, "too many MAX3100 chips\n");
}
- max3100s[i] = kzalloc(sizeof(struct max3100_port), GFP_KERNEL);
+ max3100s[i] = kzalloc_obj(struct max3100_port, GFP_KERNEL);
if (!max3100s[i]) {
mutex_unlock(&max3100s_lock);
return -ENOMEM;
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index 884fefbfd5a1..2983d74a5cf1 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -909,7 +909,7 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv)
priv->tx_dma_use = 1;
- priv->sg_tx_p = kmalloc_array(num, sizeof(struct scatterlist), GFP_ATOMIC);
+ priv->sg_tx_p = kmalloc_objs(struct scatterlist, num, GFP_ATOMIC);
if (!priv->sg_tx_p) {
dev_err(priv->port.dev, "%s:kzalloc Failed\n", __func__);
return 0;
@@ -1651,7 +1651,7 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
board = &drv_dat[id->driver_data];
port_type = board->port_type;
- priv = kzalloc(sizeof(struct eg20t_port), GFP_KERNEL);
+ priv = kzalloc_obj(struct eg20t_port, GFP_KERNEL);
if (priv == NULL)
goto init_port_alloc_err;
diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c
index e395ff29c1a2..063720ed9716 100644
--- a/drivers/tty/serial/pxa.c
+++ b/drivers/tty/serial/pxa.c
@@ -811,7 +811,7 @@ static int serial_pxa_probe(struct platform_device *dev)
if (irq < 0)
return irq;
- sport = kzalloc(sizeof(struct uart_pxa_port), GFP_KERNEL);
+ sport = kzalloc_obj(struct uart_pxa_port, GFP_KERNEL);
if (!sport)
return -ENOMEM;
diff --git a/drivers/tty/serial/serial_base_bus.c b/drivers/tty/serial/serial_base_bus.c
index 1e1ad28d83fc..ffe331831e22 100644
--- a/drivers/tty/serial/serial_base_bus.c
+++ b/drivers/tty/serial/serial_base_bus.c
@@ -116,7 +116,7 @@ struct serial_ctrl_device *serial_base_ctrl_add(struct uart_port *port,
struct serial_ctrl_device *ctrl_dev;
int err;
- ctrl_dev = kzalloc(sizeof(*ctrl_dev), GFP_KERNEL);
+ ctrl_dev = kzalloc_obj(*ctrl_dev, GFP_KERNEL);
if (!ctrl_dev)
return ERR_PTR(-ENOMEM);
@@ -156,7 +156,7 @@ struct serial_port_device *serial_base_port_add(struct uart_port *port,
int min = 0, max = -1; /* Use -1 for max to apply IDA defaults */
int err;
- port_dev = kzalloc(sizeof(*port_dev), GFP_KERNEL);
+ port_dev = kzalloc_obj(*port_dev, GFP_KERNEL);
if (!port_dev)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 2805cad10511..2047d73858ec 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -2716,7 +2716,7 @@ int uart_register_driver(struct uart_driver *drv)
* Maybe we should be using a slab cache for this, especially if
* we have a large number of ports to handle.
*/
- drv->state = kcalloc(drv->nr, sizeof(struct uart_state), GFP_KERNEL);
+ drv->state = kzalloc_objs(struct uart_state, drv->nr, GFP_KERNEL);
if (!drv->state)
goto out;
@@ -3088,8 +3088,8 @@ static int serial_core_add_one_port(struct uart_driver *drv, struct uart_port *u
if (uport->attr_group)
num_groups++;
- uport->tty_groups = kcalloc(num_groups, sizeof(*uport->tty_groups),
- GFP_KERNEL);
+ uport->tty_groups = kzalloc_objs(*uport->tty_groups, num_groups,
+ GFP_KERNEL);
if (!uport->tty_groups)
return -ENOMEM;
diff --git a/drivers/tty/serial/sunhv.c b/drivers/tty/serial/sunhv.c
index 2b3ec65d595d..219588a8b1ee 100644
--- a/drivers/tty/serial/sunhv.c
+++ b/drivers/tty/serial/sunhv.c
@@ -529,7 +529,7 @@ static int hv_probe(struct platform_device *op)
if (op->archdata.irqs[0] == 0xffffffff)
return -ENODEV;
- port = kzalloc(sizeof(struct uart_port), GFP_KERNEL);
+ port = kzalloc_obj(struct uart_port, GFP_KERNEL);
if (unlikely(!port))
return -ENOMEM;
diff --git a/drivers/tty/serial/sunsab.c b/drivers/tty/serial/sunsab.c
index df906ccf2e8a..7c4cf6d02ece 100644
--- a/drivers/tty/serial/sunsab.c
+++ b/drivers/tty/serial/sunsab.c
@@ -1117,9 +1117,8 @@ static int __init sunsab_init(void)
}
if (num_channels) {
- sunsab_ports = kcalloc(num_channels,
- sizeof(struct uart_sunsab_port),
- GFP_KERNEL);
+ sunsab_ports = kzalloc_objs(struct uart_sunsab_port,
+ num_channels, GFP_KERNEL);
if (!sunsab_ports)
return -ENOMEM;
diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c
index 383141fe7ba0..884985346226 100644
--- a/drivers/tty/serial/sunsu.c
+++ b/drivers/tty/serial/sunsu.c
@@ -1398,7 +1398,7 @@ static int su_probe(struct platform_device *op)
return -EINVAL;
up = &sunsu_ports[nr_inst];
} else {
- up = kzalloc(sizeof(*up), GFP_KERNEL);
+ up = kzalloc_obj(*up, GFP_KERNEL);
if (!up)
return -ENOMEM;
}
diff --git a/drivers/tty/serial/timbuart.c b/drivers/tty/serial/timbuart.c
index 6fa93c3872a7..48f1ef5e9bac 100644
--- a/drivers/tty/serial/timbuart.c
+++ b/drivers/tty/serial/timbuart.c
@@ -412,7 +412,7 @@ static int timbuart_probe(struct platform_device *dev)
dev_dbg(&dev->dev, "%s\n", __func__);
- uart = kzalloc(sizeof(*uart), GFP_KERNEL);
+ uart = kzalloc_obj(*uart, GFP_KERNEL);
if (!uart) {
err = -EINVAL;
goto err_mem;
diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c
index 0613f8c11ab1..d7a39e36b53c 100644
--- a/drivers/tty/serial/ucc_uart.c
+++ b/drivers/tty/serial/ucc_uart.c
@@ -1247,7 +1247,7 @@ static int ucc_uart_probe(struct platform_device *ofdev)
if (ret)
return ret;
- qe_port = kzalloc(sizeof(struct uart_qe_port), GFP_KERNEL);
+ qe_port = kzalloc_obj(struct uart_qe_port, GFP_KERNEL);
if (!qe_port) {
dev_err(&ofdev->dev, "can't allocate QE port structure\n");
return -ENOMEM;
diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c
index 9d591fb291fd..06af5c4349ec 100644
--- a/drivers/tty/synclink_gt.c
+++ b/drivers/tty/synclink_gt.c
@@ -3477,7 +3477,7 @@ static struct slgt_info *alloc_dev(int adapter_num, int port_num, struct pci_dev
{
struct slgt_info *info;
- info = kzalloc(sizeof(struct slgt_info), GFP_KERNEL);
+ info = kzalloc_obj(struct slgt_info, GFP_KERNEL);
if (!info) {
DBGERR(("%s device alloc failed adapter=%d port=%d\n",
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index 1f78b0db3b25..4aaa3e04e035 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -971,7 +971,7 @@ static int sysrq_connect(struct input_handler *handler,
struct sysrq_state *sysrq;
int error;
- sysrq = kzalloc(sizeof(struct sysrq_state), GFP_KERNEL);
+ sysrq = kzalloc_obj(struct sysrq_state, GFP_KERNEL);
if (!sysrq)
return -ENOMEM;
diff --git a/drivers/tty/tty_audit.c b/drivers/tty/tty_audit.c
index 75542333c54a..e7964d319498 100644
--- a/drivers/tty/tty_audit.c
+++ b/drivers/tty/tty_audit.c
@@ -35,7 +35,7 @@ static struct tty_audit_buf *tty_audit_buf_alloc(void)
{
struct tty_audit_buf *buf;
- buf = kzalloc(sizeof(*buf), GFP_KERNEL);
+ buf = kzalloc_obj(*buf, GFP_KERNEL);
if (!buf)
goto err;
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index 1a5673acd9b1..79ec953824d5 100644
--- a/drivers/tty/tty_buffer.c
+++ b/drivers/tty/tty_buffer.c
@@ -177,7 +177,7 @@ static struct tty_buffer *tty_buffer_alloc(struct tty_port *port, size_t size)
*/
if (atomic_read(&port->buf.mem_used) > port->buf.mem_limit)
return NULL;
- p = kmalloc(struct_size(p, data, 2 * size), GFP_ATOMIC | __GFP_NOWARN);
+ p = kmalloc_flex(*p, data, 2 * size, GFP_ATOMIC | __GFP_NOWARN);
if (p == NULL)
return NULL;
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index e2d92cf70eb7..506b6c6329c2 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -183,7 +183,7 @@ int tty_alloc_file(struct file *file)
{
struct tty_file_private *priv;
- priv = kmalloc(sizeof(*priv), GFP_KERNEL);
+ priv = kmalloc_obj(*priv, GFP_KERNEL);
if (!priv)
return -ENOMEM;
@@ -1471,7 +1471,7 @@ void tty_save_termios(struct tty_struct *tty)
/* Stash the termios data */
tp = tty->driver->termios[idx];
if (tp == NULL) {
- tp = kmalloc(sizeof(*tp), GFP_KERNEL);
+ tp = kmalloc_obj(*tp, GFP_KERNEL);
if (tp == NULL)
return;
tty->driver->termios[idx] = tp;
@@ -3099,7 +3099,7 @@ struct tty_struct *alloc_tty_struct(struct tty_driver *driver, int idx)
{
struct tty_struct *tty;
- tty = kzalloc(sizeof(*tty), GFP_KERNEL_ACCOUNT);
+ tty = kzalloc_obj(*tty, GFP_KERNEL_ACCOUNT);
if (!tty)
return NULL;
@@ -3244,7 +3244,7 @@ struct device *tty_register_device_attr(struct tty_driver *driver,
else
tty_line_name(driver, index, name);
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ dev = kzalloc_obj(*dev, GFP_KERNEL);
if (!dev)
return ERR_PTR(-ENOMEM);
@@ -3333,7 +3333,7 @@ struct tty_driver *__tty_alloc_driver(unsigned int lines, struct module *owner,
if (!lines || (flags & TTY_DRIVER_UNNUMBERED_NODE && lines > 1))
return ERR_PTR(-EINVAL);
- driver = kzalloc(sizeof(*driver), GFP_KERNEL);
+ driver = kzalloc_obj(*driver, GFP_KERNEL);
if (!driver)
return ERR_PTR(-ENOMEM);
@@ -3343,10 +3343,9 @@ struct tty_driver *__tty_alloc_driver(unsigned int lines, struct module *owner,
driver->flags = flags;
if (!(flags & TTY_DRIVER_DEVPTS_MEM)) {
- driver->ttys = kcalloc(lines, sizeof(*driver->ttys),
- GFP_KERNEL);
- driver->termios = kcalloc(lines, sizeof(*driver->termios),
- GFP_KERNEL);
+ driver->ttys = kzalloc_objs(*driver->ttys, lines, GFP_KERNEL);
+ driver->termios = kzalloc_objs(*driver->termios, lines,
+ GFP_KERNEL);
if (!driver->ttys || !driver->termios) {
err = -ENOMEM;
goto err_free_all;
@@ -3354,8 +3353,7 @@ struct tty_driver *__tty_alloc_driver(unsigned int lines, struct module *owner,
}
if (!(flags & TTY_DRIVER_DYNAMIC_ALLOC)) {
- driver->ports = kcalloc(lines, sizeof(*driver->ports),
- GFP_KERNEL);
+ driver->ports = kzalloc_objs(*driver->ports, lines, GFP_KERNEL);
if (!driver->ports) {
err = -ENOMEM;
goto err_free_all;
@@ -3363,7 +3361,7 @@ struct tty_driver *__tty_alloc_driver(unsigned int lines, struct module *owner,
cdevs = lines;
}
- driver->cdevs = kcalloc(cdevs, sizeof(*driver->cdevs), GFP_KERNEL);
+ driver->cdevs = kzalloc_objs(*driver->cdevs, cdevs, GFP_KERNEL);
if (!driver->cdevs) {
err = -ENOMEM;
goto err_free_all;
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
index d80e9d4c974b..888f2f8f9481 100644
--- a/drivers/tty/tty_ldisc.c
+++ b/drivers/tty/tty_ldisc.c
@@ -162,7 +162,7 @@ static struct tty_ldisc *tty_ldisc_get(struct tty_struct *tty, int disc)
* There is no way to handle allocation failure of only 16 bytes.
* Let's simplify error handling and save more memory.
*/
- ld = kmalloc(sizeof(struct tty_ldisc), GFP_KERNEL | __GFP_NOFAIL);
+ ld = kmalloc_obj(struct tty_ldisc, GFP_KERNEL | __GFP_NOFAIL);
ld->ops = ldops;
ld->tty = tty;
diff --git a/drivers/tty/vcc.c b/drivers/tty/vcc.c
index 2960031ace72..cd741fbe6fbe 100644
--- a/drivers/tty/vcc.c
+++ b/drivers/tty/vcc.c
@@ -574,7 +574,7 @@ static int vcc_probe(struct vio_dev *vdev, const struct vio_device_id *id)
return -ENODEV;
}
- port = kzalloc(sizeof(struct vcc_port), GFP_KERNEL);
+ port = kzalloc_obj(struct vcc_port, GFP_KERNEL);
if (!port)
return -ENOMEM;
@@ -957,7 +957,7 @@ static int vcc_install(struct tty_driver *driver, struct tty_struct *tty)
if (ret)
return ret;
- port_tty = kzalloc(sizeof(struct tty_port), GFP_KERNEL);
+ port_tty = kzalloc_obj(struct tty_port, GFP_KERNEL);
if (!port_tty)
return -ENOMEM;
diff --git a/drivers/tty/vt/consolemap.c b/drivers/tty/vt/consolemap.c
index 7a11c3f2e875..97cf1ceb6709 100644
--- a/drivers/tty/vt/consolemap.c
+++ b/drivers/tty/vt/consolemap.c
@@ -539,7 +539,7 @@ static int con_allocate_new(struct vc_data *vc)
{
struct uni_pagedict *new, *old = *vc->uni_pagedict_loc;
- new = kzalloc(sizeof(*new), GFP_KERNEL);
+ new = kzalloc_obj(*new, GFP_KERNEL);
if (!new)
return -ENOMEM;
diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c
index 3538d54d6a6a..dba09eb91f38 100644
--- a/drivers/tty/vt/keyboard.c
+++ b/drivers/tty/vt/keyboard.c
@@ -1548,7 +1548,8 @@ static int kbd_connect(struct input_handler *handler, struct input_dev *dev,
{
int error;
- struct input_handle __free(kfree) *handle = kzalloc(sizeof(*handle), GFP_KERNEL);
+ struct input_handle __free(kfree) *handle = kzalloc_obj(*handle,
+ GFP_KERNEL);
if (!handle)
return -ENOMEM;
diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c
index c814644ef4ee..824a74626548 100644
--- a/drivers/tty/vt/vc_screen.c
+++ b/drivers/tty/vt/vc_screen.c
@@ -131,7 +131,7 @@ vcs_poll_data_get(struct file *file)
if (poll)
return poll;
- poll = kzalloc(sizeof(*poll), GFP_KERNEL);
+ poll = kzalloc_obj(*poll, GFP_KERNEL);
if (!poll)
return NULL;
poll->cons_num = console(file_inode(file));
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 3bdbd4c52c2f..cca7bdf8f2fe 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -1065,7 +1065,7 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */
/* although the numbers above are not valid since long ago, the
point is still up-to-date and the comment still has its value
even if only as a historical artifact. --mj, July 1998 */
- param.vc = vc = kzalloc(sizeof(struct vc_data), GFP_KERNEL);
+ param.vc = vc = kzalloc_obj(struct vc_data, GFP_KERNEL);
if (!vc)
return -ENOMEM;
@@ -3777,7 +3777,8 @@ static int __init con_init(void)
}
for (currcons = 0; currcons < MIN_NR_CONSOLES; currcons++) {
- vc_cons[currcons].d = vc = kzalloc(sizeof(struct vc_data), GFP_NOWAIT);
+ vc_cons[currcons].d = vc = kzalloc_obj(struct vc_data,
+ GFP_NOWAIT);
INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK);
tty_port_init(&vc->port);
visual_init(vc, currcons, true);