Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Erick Archer <erick.archer@outlook.com>
Link: https://lore.kernel.org/r/AS8PR02MB7237D3D898CCC9C50C18DE078BFB2@AS8PR02MB7237.eurprd02.prod.outlook.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Erick Archer and committed by
Dmitry Torokhov
06b449d7 18547925

+37 -37
+1 -1
drivers/input/serio/altera_ps2.c
··· 100 100 return error; 101 101 } 102 102 103 - serio = kzalloc(sizeof(struct serio), GFP_KERNEL); 103 + serio = kzalloc(sizeof(*serio), GFP_KERNEL); 104 104 if (!serio) 105 105 return -ENOMEM; 106 106
+2 -2
drivers/input/serio/ambakmi.c
··· 114 114 if (ret) 115 115 return ret; 116 116 117 - kmi = kzalloc(sizeof(struct amba_kmi_port), GFP_KERNEL); 118 - io = kzalloc(sizeof(struct serio), GFP_KERNEL); 117 + kmi = kzalloc(sizeof(*kmi), GFP_KERNEL); 118 + io = kzalloc(sizeof(*io), GFP_KERNEL); 119 119 if (!kmi || !io) { 120 120 ret = -ENOMEM; 121 121 goto out;
+1 -1
drivers/input/serio/apbps2.c
··· 165 165 /* Set reload register to core freq in kHz/10 */ 166 166 iowrite32be(freq_hz / 10000, &priv->regs->reload); 167 167 168 - priv->io = kzalloc(sizeof(struct serio), GFP_KERNEL); 168 + priv->io = kzalloc(sizeof(*priv->io), GFP_KERNEL); 169 169 if (!priv->io) 170 170 return -ENOMEM; 171 171
+1 -1
drivers/input/serio/arc_ps2.c
··· 155 155 struct arc_ps2_port *port = &arc_ps2->port[index]; 156 156 struct serio *io; 157 157 158 - io = kzalloc(sizeof(struct serio), GFP_KERNEL); 158 + io = kzalloc(sizeof(*io), GFP_KERNEL); 159 159 if (!io) 160 160 return -ENOMEM; 161 161
+1 -1
drivers/input/serio/ct82c710.c
··· 158 158 159 159 static int ct82c710_probe(struct platform_device *dev) 160 160 { 161 - ct82c710_port = kzalloc(sizeof(struct serio), GFP_KERNEL); 161 + ct82c710_port = kzalloc(sizeof(*ct82c710_port), GFP_KERNEL); 162 162 if (!ct82c710_port) 163 163 return -ENOMEM; 164 164
+2 -2
drivers/input/serio/gscps2.c
··· 338 338 if (dev->id.sversion == 0x96) 339 339 hpa += GSC_DINO_OFFSET; 340 340 341 - ps2port = kzalloc(sizeof(struct gscps2port), GFP_KERNEL); 342 - serio = kzalloc(sizeof(struct serio), GFP_KERNEL); 341 + ps2port = kzalloc(sizeof(*ps2port), GFP_KERNEL); 342 + serio = kzalloc(sizeof(*serio), GFP_KERNEL); 343 343 if (!ps2port || !serio) { 344 344 ret = -ENOMEM; 345 345 goto fail_nomem;
+2 -2
drivers/input/serio/hyperv-keyboard.c
··· 318 318 struct serio *hv_serio; 319 319 int error; 320 320 321 - kbd_dev = kzalloc(sizeof(struct hv_kbd_dev), GFP_KERNEL); 322 - hv_serio = kzalloc(sizeof(struct serio), GFP_KERNEL); 321 + kbd_dev = kzalloc(sizeof(*kbd_dev), GFP_KERNEL); 322 + hv_serio = kzalloc(sizeof(*hv_serio), GFP_KERNEL); 323 323 if (!kbd_dev || !hv_serio) { 324 324 error = -ENOMEM; 325 325 goto err_free_mem;
+2 -2
drivers/input/serio/i8042.c
··· 1329 1329 struct serio *serio; 1330 1330 struct i8042_port *port = &i8042_ports[I8042_KBD_PORT_NO]; 1331 1331 1332 - serio = kzalloc(sizeof(struct serio), GFP_KERNEL); 1332 + serio = kzalloc(sizeof(*serio), GFP_KERNEL); 1333 1333 if (!serio) 1334 1334 return -ENOMEM; 1335 1335 ··· 1359 1359 int port_no = idx < 0 ? I8042_AUX_PORT_NO : I8042_MUX_PORT_NO + idx; 1360 1360 struct i8042_port *port = &i8042_ports[port_no]; 1361 1361 1362 - serio = kzalloc(sizeof(struct serio), GFP_KERNEL); 1362 + serio = kzalloc(sizeof(*serio), GFP_KERNEL); 1363 1363 if (!serio) 1364 1364 return -ENOMEM; 1365 1365
+1 -1
drivers/input/serio/maceps2.c
··· 117 117 { 118 118 struct serio *serio; 119 119 120 - serio = kzalloc(sizeof(struct serio), GFP_KERNEL); 120 + serio = kzalloc(sizeof(*serio), GFP_KERNEL); 121 121 if (serio) { 122 122 serio->id.type = SERIO_8042; 123 123 serio->write = maceps2_write;
+2 -2
drivers/input/serio/olpc_apsp.c
··· 188 188 return priv->irq; 189 189 190 190 /* KEYBOARD */ 191 - kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL); 191 + kb_serio = kzalloc(sizeof(*kb_serio), GFP_KERNEL); 192 192 if (!kb_serio) 193 193 return -ENOMEM; 194 194 kb_serio->id.type = SERIO_8042_XL; ··· 203 203 serio_register_port(kb_serio); 204 204 205 205 /* TOUCHPAD */ 206 - pad_serio = kzalloc(sizeof(struct serio), GFP_KERNEL); 206 + pad_serio = kzalloc(sizeof(*pad_serio), GFP_KERNEL); 207 207 if (!pad_serio) { 208 208 error = -ENOMEM; 209 209 goto err_pad;
+1 -1
drivers/input/serio/parkbd.c
··· 165 165 { 166 166 struct serio *serio; 167 167 168 - serio = kzalloc(sizeof(struct serio), GFP_KERNEL); 168 + serio = kzalloc(sizeof(*serio), GFP_KERNEL); 169 169 if (serio) { 170 170 serio->id.type = parkbd_mode; 171 171 serio->write = parkbd_write;
+2 -2
drivers/input/serio/pcips2.c
··· 137 137 if (ret) 138 138 goto disable; 139 139 140 - ps2if = kzalloc(sizeof(struct pcips2_data), GFP_KERNEL); 141 - serio = kzalloc(sizeof(struct serio), GFP_KERNEL); 140 + ps2if = kzalloc(sizeof(*ps2if), GFP_KERNEL); 141 + serio = kzalloc(sizeof(*serio), GFP_KERNEL); 142 142 if (!ps2if || !serio) { 143 143 ret = -ENOMEM; 144 144 goto release;
+2 -2
drivers/input/serio/ps2-gpio.c
··· 404 404 struct device *dev = &pdev->dev; 405 405 int error; 406 406 407 - drvdata = devm_kzalloc(dev, sizeof(struct ps2_gpio_data), GFP_KERNEL); 408 - serio = kzalloc(sizeof(struct serio), GFP_KERNEL); 407 + drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); 408 + serio = kzalloc(sizeof(*serio), GFP_KERNEL); 409 409 if (!drvdata || !serio) { 410 410 error = -ENOMEM; 411 411 goto err_free_serio;
+1 -1
drivers/input/serio/ps2mult.c
··· 127 127 struct serio *mx_serio = psm->mx_serio; 128 128 struct serio *serio; 129 129 130 - serio = kzalloc(sizeof(struct serio), GFP_KERNEL); 130 + serio = kzalloc(sizeof(*serio), GFP_KERNEL); 131 131 if (!serio) 132 132 return -ENOMEM; 133 133
+2 -2
drivers/input/serio/q40kbd.c
··· 108 108 struct serio *port; 109 109 int error; 110 110 111 - q40kbd = kzalloc(sizeof(struct q40kbd), GFP_KERNEL); 112 - port = kzalloc(sizeof(struct serio), GFP_KERNEL); 111 + q40kbd = kzalloc(sizeof(*q40kbd), GFP_KERNEL); 112 + port = kzalloc(sizeof(*port), GFP_KERNEL); 113 113 if (!q40kbd || !port) { 114 114 error = -ENOMEM; 115 115 goto err_free_mem;
+1 -1
drivers/input/serio/rpckbd.c
··· 108 108 if (tx_irq < 0) 109 109 return tx_irq; 110 110 111 - serio = kzalloc(sizeof(struct serio), GFP_KERNEL); 111 + serio = kzalloc(sizeof(*serio), GFP_KERNEL); 112 112 rpckbd = kzalloc(sizeof(*rpckbd), GFP_KERNEL); 113 113 if (!serio || !rpckbd) { 114 114 kfree(rpckbd);
+2 -2
drivers/input/serio/sa1111ps2.c
··· 256 256 struct serio *serio; 257 257 int ret; 258 258 259 - ps2if = kzalloc(sizeof(struct ps2if), GFP_KERNEL); 260 - serio = kzalloc(sizeof(struct serio), GFP_KERNEL); 259 + ps2if = kzalloc(sizeof(*ps2if), GFP_KERNEL); 260 + serio = kzalloc(sizeof(*serio), GFP_KERNEL); 261 261 if (!ps2if || !serio) { 262 262 ret = -ENOMEM; 263 263 goto free;
+1 -1
drivers/input/serio/serio.c
··· 258 258 } 259 259 } 260 260 261 - event = kmalloc(sizeof(struct serio_event), GFP_ATOMIC); 261 + event = kmalloc(sizeof(*event), GFP_ATOMIC); 262 262 if (!event) { 263 263 pr_err("Not enough memory to queue event %d\n", event_type); 264 264 retval = -ENOMEM;
+2 -2
drivers/input/serio/serio_raw.c
··· 92 92 goto out; 93 93 } 94 94 95 - client = kzalloc(sizeof(struct serio_raw_client), GFP_KERNEL); 95 + client = kzalloc(sizeof(*client), GFP_KERNEL); 96 96 if (!client) { 97 97 retval = -ENOMEM; 98 98 goto out; ··· 293 293 struct serio_raw *serio_raw; 294 294 int err; 295 295 296 - serio_raw = kzalloc(sizeof(struct serio_raw), GFP_KERNEL); 296 + serio_raw = kzalloc(sizeof(*serio_raw), GFP_KERNEL); 297 297 if (!serio_raw) { 298 298 dev_dbg(&serio->dev, "can't allocate memory for a device\n"); 299 299 return -ENOMEM;
+2 -2
drivers/input/serio/serport.c
··· 82 82 if (!capable(CAP_SYS_ADMIN)) 83 83 return -EPERM; 84 84 85 - serport = kzalloc(sizeof(struct serport), GFP_KERNEL); 85 + serport = kzalloc(sizeof(*serport), GFP_KERNEL); 86 86 if (!serport) 87 87 return -ENOMEM; 88 88 ··· 167 167 if (test_and_set_bit(SERPORT_BUSY, &serport->flags)) 168 168 return -EBUSY; 169 169 170 - serport->serio = serio = kzalloc(sizeof(struct serio), GFP_KERNEL); 170 + serport->serio = serio = kzalloc(sizeof(*serio), GFP_KERNEL); 171 171 if (!serio) 172 172 return -ENOMEM; 173 173
+2 -2
drivers/input/serio/sun4i-ps2.c
··· 213 213 struct device *dev = &pdev->dev; 214 214 int error; 215 215 216 - drvdata = kzalloc(sizeof(struct sun4i_ps2data), GFP_KERNEL); 217 - serio = kzalloc(sizeof(struct serio), GFP_KERNEL); 216 + drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL); 217 + serio = kzalloc(sizeof(*serio), GFP_KERNEL); 218 218 if (!drvdata || !serio) { 219 219 error = -ENOMEM; 220 220 goto err_free_mem;
+2 -2
drivers/input/serio/userio.c
··· 77 77 { 78 78 struct userio_device *userio; 79 79 80 - userio = kzalloc(sizeof(struct userio_device), GFP_KERNEL); 80 + userio = kzalloc(sizeof(*userio), GFP_KERNEL); 81 81 if (!userio) 82 82 return -ENOMEM; 83 83 ··· 85 85 spin_lock_init(&userio->buf_lock); 86 86 init_waitqueue_head(&userio->waitq); 87 87 88 - userio->serio = kzalloc(sizeof(struct serio), GFP_KERNEL); 88 + userio->serio = kzalloc(sizeof(*userio->serio), GFP_KERNEL); 89 89 if (!userio->serio) { 90 90 kfree(userio); 91 91 return -ENOMEM;
+2 -2
drivers/input/serio/xilinx_ps2.c
··· 252 252 return -ENODEV; 253 253 } 254 254 255 - drvdata = kzalloc(sizeof(struct xps2data), GFP_KERNEL); 256 - serio = kzalloc(sizeof(struct serio), GFP_KERNEL); 255 + drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL); 256 + serio = kzalloc(sizeof(*serio), GFP_KERNEL); 257 257 if (!drvdata || !serio) { 258 258 error = -ENOMEM; 259 259 goto failed1;