Commit 06b449d7 authored by Erick Archer's avatar Erick Archer Committed by Dmitry Torokhov

Input: serio - use sizeof(*pointer) instead of sizeof(type)

It is preferred to use sizeof(*pointer) instead of sizeof(type)
due to the type of the variable can change and one needs not
change the former (unlike the latter). This patch has no effect
on runtime behavior.
Signed-off-by: default avatarErick Archer <erick.archer@outlook.com>
Link: https://lore.kernel.org/r/AS8PR02MB7237D3D898CCC9C50C18DE078BFB2@AS8PR02MB7237.eurprd02.prod.outlook.comSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 18547925
......@@ -100,7 +100,7 @@ static int altera_ps2_probe(struct platform_device *pdev)
return error;
}
serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
serio = kzalloc(sizeof(*serio), GFP_KERNEL);
if (!serio)
return -ENOMEM;
......
......@@ -114,8 +114,8 @@ static int amba_kmi_probe(struct amba_device *dev,
if (ret)
return ret;
kmi = kzalloc(sizeof(struct amba_kmi_port), GFP_KERNEL);
io = kzalloc(sizeof(struct serio), GFP_KERNEL);
kmi = kzalloc(sizeof(*kmi), GFP_KERNEL);
io = kzalloc(sizeof(*io), GFP_KERNEL);
if (!kmi || !io) {
ret = -ENOMEM;
goto out;
......
......@@ -165,7 +165,7 @@ static int apbps2_of_probe(struct platform_device *ofdev)
/* Set reload register to core freq in kHz/10 */
iowrite32be(freq_hz / 10000, &priv->regs->reload);
priv->io = kzalloc(sizeof(struct serio), GFP_KERNEL);
priv->io = kzalloc(sizeof(*priv->io), GFP_KERNEL);
if (!priv->io)
return -ENOMEM;
......
......@@ -155,7 +155,7 @@ static int arc_ps2_create_port(struct platform_device *pdev,
struct arc_ps2_port *port = &arc_ps2->port[index];
struct serio *io;
io = kzalloc(sizeof(struct serio), GFP_KERNEL);
io = kzalloc(sizeof(*io), GFP_KERNEL);
if (!io)
return -ENOMEM;
......
......@@ -158,7 +158,7 @@ static int __init ct82c710_detect(void)
static int ct82c710_probe(struct platform_device *dev)
{
ct82c710_port = kzalloc(sizeof(struct serio), GFP_KERNEL);
ct82c710_port = kzalloc(sizeof(*ct82c710_port), GFP_KERNEL);
if (!ct82c710_port)
return -ENOMEM;
......
......@@ -338,8 +338,8 @@ static int __init gscps2_probe(struct parisc_device *dev)
if (dev->id.sversion == 0x96)
hpa += GSC_DINO_OFFSET;
ps2port = kzalloc(sizeof(struct gscps2port), GFP_KERNEL);
serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
ps2port = kzalloc(sizeof(*ps2port), GFP_KERNEL);
serio = kzalloc(sizeof(*serio), GFP_KERNEL);
if (!ps2port || !serio) {
ret = -ENOMEM;
goto fail_nomem;
......
......@@ -318,8 +318,8 @@ static int hv_kbd_probe(struct hv_device *hv_dev,
struct serio *hv_serio;
int error;
kbd_dev = kzalloc(sizeof(struct hv_kbd_dev), GFP_KERNEL);
hv_serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
kbd_dev = kzalloc(sizeof(*kbd_dev), GFP_KERNEL);
hv_serio = kzalloc(sizeof(*hv_serio), GFP_KERNEL);
if (!kbd_dev || !hv_serio) {
error = -ENOMEM;
goto err_free_mem;
......
......@@ -1329,7 +1329,7 @@ static int i8042_create_kbd_port(void)
struct serio *serio;
struct i8042_port *port = &i8042_ports[I8042_KBD_PORT_NO];
serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
serio = kzalloc(sizeof(*serio), GFP_KERNEL);
if (!serio)
return -ENOMEM;
......@@ -1359,7 +1359,7 @@ static int i8042_create_aux_port(int idx)
int port_no = idx < 0 ? I8042_AUX_PORT_NO : I8042_MUX_PORT_NO + idx;
struct i8042_port *port = &i8042_ports[port_no];
serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
serio = kzalloc(sizeof(*serio), GFP_KERNEL);
if (!serio)
return -ENOMEM;
......
......@@ -117,7 +117,7 @@ static struct serio *maceps2_allocate_port(int idx)
{
struct serio *serio;
serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
serio = kzalloc(sizeof(*serio), GFP_KERNEL);
if (serio) {
serio->id.type = SERIO_8042;
serio->write = maceps2_write;
......
......@@ -188,7 +188,7 @@ static int olpc_apsp_probe(struct platform_device *pdev)
return priv->irq;
/* KEYBOARD */
kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
kb_serio = kzalloc(sizeof(*kb_serio), GFP_KERNEL);
if (!kb_serio)
return -ENOMEM;
kb_serio->id.type = SERIO_8042_XL;
......@@ -203,7 +203,7 @@ static int olpc_apsp_probe(struct platform_device *pdev)
serio_register_port(kb_serio);
/* TOUCHPAD */
pad_serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
pad_serio = kzalloc(sizeof(*pad_serio), GFP_KERNEL);
if (!pad_serio) {
error = -ENOMEM;
goto err_pad;
......
......@@ -165,7 +165,7 @@ static struct serio *parkbd_allocate_serio(void)
{
struct serio *serio;
serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
serio = kzalloc(sizeof(*serio), GFP_KERNEL);
if (serio) {
serio->id.type = parkbd_mode;
serio->write = parkbd_write;
......
......@@ -137,8 +137,8 @@ static int pcips2_probe(struct pci_dev *dev, const struct pci_device_id *id)
if (ret)
goto disable;
ps2if = kzalloc(sizeof(struct pcips2_data), GFP_KERNEL);
serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
ps2if = kzalloc(sizeof(*ps2if), GFP_KERNEL);
serio = kzalloc(sizeof(*serio), GFP_KERNEL);
if (!ps2if || !serio) {
ret = -ENOMEM;
goto release;
......
......@@ -404,8 +404,8 @@ static int ps2_gpio_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
int error;
drvdata = devm_kzalloc(dev, sizeof(struct ps2_gpio_data), GFP_KERNEL);
serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
serio = kzalloc(sizeof(*serio), GFP_KERNEL);
if (!drvdata || !serio) {
error = -ENOMEM;
goto err_free_serio;
......
......@@ -127,7 +127,7 @@ static int ps2mult_create_port(struct ps2mult *psm, int i)
struct serio *mx_serio = psm->mx_serio;
struct serio *serio;
serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
serio = kzalloc(sizeof(*serio), GFP_KERNEL);
if (!serio)
return -ENOMEM;
......
......@@ -108,8 +108,8 @@ static int q40kbd_probe(struct platform_device *pdev)
struct serio *port;
int error;
q40kbd = kzalloc(sizeof(struct q40kbd), GFP_KERNEL);
port = kzalloc(sizeof(struct serio), GFP_KERNEL);
q40kbd = kzalloc(sizeof(*q40kbd), GFP_KERNEL);
port = kzalloc(sizeof(*port), GFP_KERNEL);
if (!q40kbd || !port) {
error = -ENOMEM;
goto err_free_mem;
......
......@@ -108,7 +108,7 @@ static int rpckbd_probe(struct platform_device *dev)
if (tx_irq < 0)
return tx_irq;
serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
serio = kzalloc(sizeof(*serio), GFP_KERNEL);
rpckbd = kzalloc(sizeof(*rpckbd), GFP_KERNEL);
if (!serio || !rpckbd) {
kfree(rpckbd);
......
......@@ -256,8 +256,8 @@ static int ps2_probe(struct sa1111_dev *dev)
struct serio *serio;
int ret;
ps2if = kzalloc(sizeof(struct ps2if), GFP_KERNEL);
serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
ps2if = kzalloc(sizeof(*ps2if), GFP_KERNEL);
serio = kzalloc(sizeof(*serio), GFP_KERNEL);
if (!ps2if || !serio) {
ret = -ENOMEM;
goto free;
......
......@@ -258,7 +258,7 @@ static int serio_queue_event(void *object, struct module *owner,
}
}
event = kmalloc(sizeof(struct serio_event), GFP_ATOMIC);
event = kmalloc(sizeof(*event), GFP_ATOMIC);
if (!event) {
pr_err("Not enough memory to queue event %d\n", event_type);
retval = -ENOMEM;
......
......@@ -92,7 +92,7 @@ static int serio_raw_open(struct inode *inode, struct file *file)
goto out;
}
client = kzalloc(sizeof(struct serio_raw_client), GFP_KERNEL);
client = kzalloc(sizeof(*client), GFP_KERNEL);
if (!client) {
retval = -ENOMEM;
goto out;
......@@ -293,7 +293,7 @@ static int serio_raw_connect(struct serio *serio, struct serio_driver *drv)
struct serio_raw *serio_raw;
int err;
serio_raw = kzalloc(sizeof(struct serio_raw), GFP_KERNEL);
serio_raw = kzalloc(sizeof(*serio_raw), GFP_KERNEL);
if (!serio_raw) {
dev_dbg(&serio->dev, "can't allocate memory for a device\n");
return -ENOMEM;
......
......@@ -82,7 +82,7 @@ static int serport_ldisc_open(struct tty_struct *tty)
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
serport = kzalloc(sizeof(struct serport), GFP_KERNEL);
serport = kzalloc(sizeof(*serport), GFP_KERNEL);
if (!serport)
return -ENOMEM;
......@@ -167,7 +167,7 @@ static ssize_t serport_ldisc_read(struct tty_struct * tty, struct file * file,
if (test_and_set_bit(SERPORT_BUSY, &serport->flags))
return -EBUSY;
serport->serio = serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
serport->serio = serio = kzalloc(sizeof(*serio), GFP_KERNEL);
if (!serio)
return -ENOMEM;
......
......@@ -213,8 +213,8 @@ static int sun4i_ps2_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
int error;
drvdata = kzalloc(sizeof(struct sun4i_ps2data), GFP_KERNEL);
serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL);
serio = kzalloc(sizeof(*serio), GFP_KERNEL);
if (!drvdata || !serio) {
error = -ENOMEM;
goto err_free_mem;
......
......@@ -77,7 +77,7 @@ static int userio_char_open(struct inode *inode, struct file *file)
{
struct userio_device *userio;
userio = kzalloc(sizeof(struct userio_device), GFP_KERNEL);
userio = kzalloc(sizeof(*userio), GFP_KERNEL);
if (!userio)
return -ENOMEM;
......@@ -85,7 +85,7 @@ static int userio_char_open(struct inode *inode, struct file *file)
spin_lock_init(&userio->buf_lock);
init_waitqueue_head(&userio->waitq);
userio->serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
userio->serio = kzalloc(sizeof(*userio->serio), GFP_KERNEL);
if (!userio->serio) {
kfree(userio);
return -ENOMEM;
......
......@@ -252,8 +252,8 @@ static int xps2_of_probe(struct platform_device *ofdev)
return -ENODEV;
}
drvdata = kzalloc(sizeof(struct xps2data), GFP_KERNEL);
serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL);
serio = kzalloc(sizeof(*serio), GFP_KERNEL);
if (!drvdata || !serio) {
error = -ENOMEM;
goto failed1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment