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) ...@@ -100,7 +100,7 @@ static int altera_ps2_probe(struct platform_device *pdev)
return error; return error;
} }
serio = kzalloc(sizeof(struct serio), GFP_KERNEL); serio = kzalloc(sizeof(*serio), GFP_KERNEL);
if (!serio) if (!serio)
return -ENOMEM; return -ENOMEM;
......
...@@ -114,8 +114,8 @@ static int amba_kmi_probe(struct amba_device *dev, ...@@ -114,8 +114,8 @@ static int amba_kmi_probe(struct amba_device *dev,
if (ret) if (ret)
return ret; return ret;
kmi = kzalloc(sizeof(struct amba_kmi_port), GFP_KERNEL); kmi = kzalloc(sizeof(*kmi), GFP_KERNEL);
io = kzalloc(sizeof(struct serio), GFP_KERNEL); io = kzalloc(sizeof(*io), GFP_KERNEL);
if (!kmi || !io) { if (!kmi || !io) {
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
......
...@@ -165,7 +165,7 @@ static int apbps2_of_probe(struct platform_device *ofdev) ...@@ -165,7 +165,7 @@ static int apbps2_of_probe(struct platform_device *ofdev)
/* Set reload register to core freq in kHz/10 */ /* Set reload register to core freq in kHz/10 */
iowrite32be(freq_hz / 10000, &priv->regs->reload); 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) if (!priv->io)
return -ENOMEM; return -ENOMEM;
......
...@@ -155,7 +155,7 @@ static int arc_ps2_create_port(struct platform_device *pdev, ...@@ -155,7 +155,7 @@ static int arc_ps2_create_port(struct platform_device *pdev,
struct arc_ps2_port *port = &arc_ps2->port[index]; struct arc_ps2_port *port = &arc_ps2->port[index];
struct serio *io; struct serio *io;
io = kzalloc(sizeof(struct serio), GFP_KERNEL); io = kzalloc(sizeof(*io), GFP_KERNEL);
if (!io) if (!io)
return -ENOMEM; return -ENOMEM;
......
...@@ -158,7 +158,7 @@ static int __init ct82c710_detect(void) ...@@ -158,7 +158,7 @@ static int __init ct82c710_detect(void)
static int ct82c710_probe(struct platform_device *dev) 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) if (!ct82c710_port)
return -ENOMEM; return -ENOMEM;
......
...@@ -338,8 +338,8 @@ static int __init gscps2_probe(struct parisc_device *dev) ...@@ -338,8 +338,8 @@ static int __init gscps2_probe(struct parisc_device *dev)
if (dev->id.sversion == 0x96) if (dev->id.sversion == 0x96)
hpa += GSC_DINO_OFFSET; hpa += GSC_DINO_OFFSET;
ps2port = kzalloc(sizeof(struct gscps2port), GFP_KERNEL); ps2port = kzalloc(sizeof(*ps2port), GFP_KERNEL);
serio = kzalloc(sizeof(struct serio), GFP_KERNEL); serio = kzalloc(sizeof(*serio), GFP_KERNEL);
if (!ps2port || !serio) { if (!ps2port || !serio) {
ret = -ENOMEM; ret = -ENOMEM;
goto fail_nomem; goto fail_nomem;
......
...@@ -318,8 +318,8 @@ static int hv_kbd_probe(struct hv_device *hv_dev, ...@@ -318,8 +318,8 @@ static int hv_kbd_probe(struct hv_device *hv_dev,
struct serio *hv_serio; struct serio *hv_serio;
int error; int error;
kbd_dev = kzalloc(sizeof(struct hv_kbd_dev), GFP_KERNEL); kbd_dev = kzalloc(sizeof(*kbd_dev), GFP_KERNEL);
hv_serio = kzalloc(sizeof(struct serio), GFP_KERNEL); hv_serio = kzalloc(sizeof(*hv_serio), GFP_KERNEL);
if (!kbd_dev || !hv_serio) { if (!kbd_dev || !hv_serio) {
error = -ENOMEM; error = -ENOMEM;
goto err_free_mem; goto err_free_mem;
......
...@@ -1329,7 +1329,7 @@ static int i8042_create_kbd_port(void) ...@@ -1329,7 +1329,7 @@ static int i8042_create_kbd_port(void)
struct serio *serio; struct serio *serio;
struct i8042_port *port = &i8042_ports[I8042_KBD_PORT_NO]; 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) if (!serio)
return -ENOMEM; return -ENOMEM;
...@@ -1359,7 +1359,7 @@ static int i8042_create_aux_port(int idx) ...@@ -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; int port_no = idx < 0 ? I8042_AUX_PORT_NO : I8042_MUX_PORT_NO + idx;
struct i8042_port *port = &i8042_ports[port_no]; struct i8042_port *port = &i8042_ports[port_no];
serio = kzalloc(sizeof(struct serio), GFP_KERNEL); serio = kzalloc(sizeof(*serio), GFP_KERNEL);
if (!serio) if (!serio)
return -ENOMEM; return -ENOMEM;
......
...@@ -117,7 +117,7 @@ static struct serio *maceps2_allocate_port(int idx) ...@@ -117,7 +117,7 @@ static struct serio *maceps2_allocate_port(int idx)
{ {
struct serio *serio; struct serio *serio;
serio = kzalloc(sizeof(struct serio), GFP_KERNEL); serio = kzalloc(sizeof(*serio), GFP_KERNEL);
if (serio) { if (serio) {
serio->id.type = SERIO_8042; serio->id.type = SERIO_8042;
serio->write = maceps2_write; serio->write = maceps2_write;
......
...@@ -188,7 +188,7 @@ static int olpc_apsp_probe(struct platform_device *pdev) ...@@ -188,7 +188,7 @@ static int olpc_apsp_probe(struct platform_device *pdev)
return priv->irq; return priv->irq;
/* KEYBOARD */ /* KEYBOARD */
kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL); kb_serio = kzalloc(sizeof(*kb_serio), GFP_KERNEL);
if (!kb_serio) if (!kb_serio)
return -ENOMEM; return -ENOMEM;
kb_serio->id.type = SERIO_8042_XL; kb_serio->id.type = SERIO_8042_XL;
...@@ -203,7 +203,7 @@ static int olpc_apsp_probe(struct platform_device *pdev) ...@@ -203,7 +203,7 @@ static int olpc_apsp_probe(struct platform_device *pdev)
serio_register_port(kb_serio); serio_register_port(kb_serio);
/* TOUCHPAD */ /* TOUCHPAD */
pad_serio = kzalloc(sizeof(struct serio), GFP_KERNEL); pad_serio = kzalloc(sizeof(*pad_serio), GFP_KERNEL);
if (!pad_serio) { if (!pad_serio) {
error = -ENOMEM; error = -ENOMEM;
goto err_pad; goto err_pad;
......
...@@ -165,7 +165,7 @@ static struct serio *parkbd_allocate_serio(void) ...@@ -165,7 +165,7 @@ static struct serio *parkbd_allocate_serio(void)
{ {
struct serio *serio; struct serio *serio;
serio = kzalloc(sizeof(struct serio), GFP_KERNEL); serio = kzalloc(sizeof(*serio), GFP_KERNEL);
if (serio) { if (serio) {
serio->id.type = parkbd_mode; serio->id.type = parkbd_mode;
serio->write = parkbd_write; serio->write = parkbd_write;
......
...@@ -137,8 +137,8 @@ static int pcips2_probe(struct pci_dev *dev, const struct pci_device_id *id) ...@@ -137,8 +137,8 @@ static int pcips2_probe(struct pci_dev *dev, const struct pci_device_id *id)
if (ret) if (ret)
goto disable; goto disable;
ps2if = kzalloc(sizeof(struct pcips2_data), GFP_KERNEL); ps2if = kzalloc(sizeof(*ps2if), GFP_KERNEL);
serio = kzalloc(sizeof(struct serio), GFP_KERNEL); serio = kzalloc(sizeof(*serio), GFP_KERNEL);
if (!ps2if || !serio) { if (!ps2if || !serio) {
ret = -ENOMEM; ret = -ENOMEM;
goto release; goto release;
......
...@@ -404,8 +404,8 @@ static int ps2_gpio_probe(struct platform_device *pdev) ...@@ -404,8 +404,8 @@ static int ps2_gpio_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
int error; int error;
drvdata = devm_kzalloc(dev, sizeof(struct ps2_gpio_data), GFP_KERNEL); drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
serio = kzalloc(sizeof(struct serio), GFP_KERNEL); serio = kzalloc(sizeof(*serio), GFP_KERNEL);
if (!drvdata || !serio) { if (!drvdata || !serio) {
error = -ENOMEM; error = -ENOMEM;
goto err_free_serio; goto err_free_serio;
......
...@@ -127,7 +127,7 @@ static int ps2mult_create_port(struct ps2mult *psm, int i) ...@@ -127,7 +127,7 @@ static int ps2mult_create_port(struct ps2mult *psm, int i)
struct serio *mx_serio = psm->mx_serio; struct serio *mx_serio = psm->mx_serio;
struct serio *serio; struct serio *serio;
serio = kzalloc(sizeof(struct serio), GFP_KERNEL); serio = kzalloc(sizeof(*serio), GFP_KERNEL);
if (!serio) if (!serio)
return -ENOMEM; return -ENOMEM;
......
...@@ -108,8 +108,8 @@ static int q40kbd_probe(struct platform_device *pdev) ...@@ -108,8 +108,8 @@ static int q40kbd_probe(struct platform_device *pdev)
struct serio *port; struct serio *port;
int error; int error;
q40kbd = kzalloc(sizeof(struct q40kbd), GFP_KERNEL); q40kbd = kzalloc(sizeof(*q40kbd), GFP_KERNEL);
port = kzalloc(sizeof(struct serio), GFP_KERNEL); port = kzalloc(sizeof(*port), GFP_KERNEL);
if (!q40kbd || !port) { if (!q40kbd || !port) {
error = -ENOMEM; error = -ENOMEM;
goto err_free_mem; goto err_free_mem;
......
...@@ -108,7 +108,7 @@ static int rpckbd_probe(struct platform_device *dev) ...@@ -108,7 +108,7 @@ static int rpckbd_probe(struct platform_device *dev)
if (tx_irq < 0) if (tx_irq < 0)
return tx_irq; return tx_irq;
serio = kzalloc(sizeof(struct serio), GFP_KERNEL); serio = kzalloc(sizeof(*serio), GFP_KERNEL);
rpckbd = kzalloc(sizeof(*rpckbd), GFP_KERNEL); rpckbd = kzalloc(sizeof(*rpckbd), GFP_KERNEL);
if (!serio || !rpckbd) { if (!serio || !rpckbd) {
kfree(rpckbd); kfree(rpckbd);
......
...@@ -256,8 +256,8 @@ static int ps2_probe(struct sa1111_dev *dev) ...@@ -256,8 +256,8 @@ static int ps2_probe(struct sa1111_dev *dev)
struct serio *serio; struct serio *serio;
int ret; int ret;
ps2if = kzalloc(sizeof(struct ps2if), GFP_KERNEL); ps2if = kzalloc(sizeof(*ps2if), GFP_KERNEL);
serio = kzalloc(sizeof(struct serio), GFP_KERNEL); serio = kzalloc(sizeof(*serio), GFP_KERNEL);
if (!ps2if || !serio) { if (!ps2if || !serio) {
ret = -ENOMEM; ret = -ENOMEM;
goto free; goto free;
......
...@@ -258,7 +258,7 @@ static int serio_queue_event(void *object, struct module *owner, ...@@ -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) { if (!event) {
pr_err("Not enough memory to queue event %d\n", event_type); pr_err("Not enough memory to queue event %d\n", event_type);
retval = -ENOMEM; retval = -ENOMEM;
......
...@@ -92,7 +92,7 @@ static int serio_raw_open(struct inode *inode, struct file *file) ...@@ -92,7 +92,7 @@ static int serio_raw_open(struct inode *inode, struct file *file)
goto out; goto out;
} }
client = kzalloc(sizeof(struct serio_raw_client), GFP_KERNEL); client = kzalloc(sizeof(*client), GFP_KERNEL);
if (!client) { if (!client) {
retval = -ENOMEM; retval = -ENOMEM;
goto out; goto out;
...@@ -293,7 +293,7 @@ static int serio_raw_connect(struct serio *serio, struct serio_driver *drv) ...@@ -293,7 +293,7 @@ static int serio_raw_connect(struct serio *serio, struct serio_driver *drv)
struct serio_raw *serio_raw; struct serio_raw *serio_raw;
int err; int err;
serio_raw = kzalloc(sizeof(struct serio_raw), GFP_KERNEL); serio_raw = kzalloc(sizeof(*serio_raw), GFP_KERNEL);
if (!serio_raw) { if (!serio_raw) {
dev_dbg(&serio->dev, "can't allocate memory for a device\n"); dev_dbg(&serio->dev, "can't allocate memory for a device\n");
return -ENOMEM; return -ENOMEM;
......
...@@ -82,7 +82,7 @@ static int serport_ldisc_open(struct tty_struct *tty) ...@@ -82,7 +82,7 @@ static int serport_ldisc_open(struct tty_struct *tty)
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
serport = kzalloc(sizeof(struct serport), GFP_KERNEL); serport = kzalloc(sizeof(*serport), GFP_KERNEL);
if (!serport) if (!serport)
return -ENOMEM; return -ENOMEM;
...@@ -167,7 +167,7 @@ static ssize_t serport_ldisc_read(struct tty_struct * tty, struct file * file, ...@@ -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)) if (test_and_set_bit(SERPORT_BUSY, &serport->flags))
return -EBUSY; return -EBUSY;
serport->serio = serio = kzalloc(sizeof(struct serio), GFP_KERNEL); serport->serio = serio = kzalloc(sizeof(*serio), GFP_KERNEL);
if (!serio) if (!serio)
return -ENOMEM; return -ENOMEM;
......
...@@ -213,8 +213,8 @@ static int sun4i_ps2_probe(struct platform_device *pdev) ...@@ -213,8 +213,8 @@ static int sun4i_ps2_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
int error; int error;
drvdata = kzalloc(sizeof(struct sun4i_ps2data), GFP_KERNEL); drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL);
serio = kzalloc(sizeof(struct serio), GFP_KERNEL); serio = kzalloc(sizeof(*serio), GFP_KERNEL);
if (!drvdata || !serio) { if (!drvdata || !serio) {
error = -ENOMEM; error = -ENOMEM;
goto err_free_mem; goto err_free_mem;
......
...@@ -77,7 +77,7 @@ static int userio_char_open(struct inode *inode, struct file *file) ...@@ -77,7 +77,7 @@ static int userio_char_open(struct inode *inode, struct file *file)
{ {
struct userio_device *userio; struct userio_device *userio;
userio = kzalloc(sizeof(struct userio_device), GFP_KERNEL); userio = kzalloc(sizeof(*userio), GFP_KERNEL);
if (!userio) if (!userio)
return -ENOMEM; return -ENOMEM;
...@@ -85,7 +85,7 @@ static int userio_char_open(struct inode *inode, struct file *file) ...@@ -85,7 +85,7 @@ static int userio_char_open(struct inode *inode, struct file *file)
spin_lock_init(&userio->buf_lock); spin_lock_init(&userio->buf_lock);
init_waitqueue_head(&userio->waitq); init_waitqueue_head(&userio->waitq);
userio->serio = kzalloc(sizeof(struct serio), GFP_KERNEL); userio->serio = kzalloc(sizeof(*userio->serio), GFP_KERNEL);
if (!userio->serio) { if (!userio->serio) {
kfree(userio); kfree(userio);
return -ENOMEM; return -ENOMEM;
......
...@@ -252,8 +252,8 @@ static int xps2_of_probe(struct platform_device *ofdev) ...@@ -252,8 +252,8 @@ static int xps2_of_probe(struct platform_device *ofdev)
return -ENODEV; return -ENODEV;
} }
drvdata = kzalloc(sizeof(struct xps2data), GFP_KERNEL); drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL);
serio = kzalloc(sizeof(struct serio), GFP_KERNEL); serio = kzalloc(sizeof(*serio), GFP_KERNEL);
if (!drvdata || !serio) { if (!drvdata || !serio) {
error = -ENOMEM; error = -ENOMEM;
goto failed1; 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