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

staging: gpib: Replace kmalloc/memset with kzalloc.

This patch replaces kmalloc + memset with kzalloc in the GPIB driver.

Signed-off-by: Rohit Chavan <roheetchavan@gmail.com>
Reviewed-by: Dave Penkler <dpenkler@gmail.com>
Link: https://lore.kernel.org/r/20241016103406.1618448-1-roheetchavan@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Rohit Chavan and committed by
Greg Kroah-Hartman
c47adc2d 0dee2811

+8 -17
+1 -2
drivers/staging/gpib/agilent_82350b/agilent_82350b.c
··· 518 518 int agilent_82350b_allocate_private(gpib_board_t *board) 519 519 520 520 { 521 - board->private_data = kmalloc(sizeof(struct agilent_82350b_priv), GFP_KERNEL); 521 + board->private_data = kzalloc(sizeof(struct agilent_82350b_priv), GFP_KERNEL); 522 522 if (!board->private_data) 523 523 return -ENOMEM; 524 - memset(board->private_data, 0, sizeof(struct agilent_82350b_priv)); 525 524 return 0; 526 525 } 527 526
+1 -2
drivers/staging/gpib/cb7210/cb7210.c
··· 1199 1199 DEBUG(0, "%s(0x%p)\n", __func__, link); 1200 1200 1201 1201 /* Allocate space for private device-specific data */ 1202 - info = kmalloc(sizeof(*info), GFP_KERNEL); 1202 + info = kzalloc(sizeof(*info), GFP_KERNEL); 1203 1203 if (!info) 1204 1204 return -ENOMEM; 1205 - memset(info, 0, sizeof(*info)); 1206 1205 1207 1206 info->p_dev = link; 1208 1207 link->priv = info;
+1 -2
drivers/staging/gpib/gpio/gpib_bitbang.c
··· 1105 1105 1106 1106 static int allocate_private(gpib_board_t *board) 1107 1107 { 1108 - board->private_data = kmalloc(sizeof(struct bb_priv), GFP_KERNEL); 1108 + board->private_data = kzalloc(sizeof(struct bb_priv), GFP_KERNEL); 1109 1109 if (!board->private_data) 1110 1110 return -1; 1111 - memset(board->private_data, 0, sizeof(struct bb_priv)); 1112 1111 return 0; 1113 1112 } 1114 1113
+1 -2
drivers/staging/gpib/hp_82335/hp82335.c
··· 201 201 202 202 int hp82335_allocate_private(gpib_board_t *board) 203 203 { 204 - board->private_data = kmalloc(sizeof(struct hp82335_priv), GFP_KERNEL); 204 + board->private_data = kzalloc(sizeof(struct hp82335_priv), GFP_KERNEL); 205 205 if (!board->private_data) 206 206 return -1; 207 - memset(board->private_data, 0, sizeof(struct hp82335_priv)); 208 207 return 0; 209 208 } 210 209
+1 -2
drivers/staging/gpib/hp_82341/hp_82341.c
··· 459 459 460 460 int hp_82341_allocate_private(gpib_board_t *board) 461 461 { 462 - board->private_data = kmalloc(sizeof(struct hp_82341_priv), GFP_KERNEL); 462 + board->private_data = kzalloc(sizeof(struct hp_82341_priv), GFP_KERNEL); 463 463 if (!board->private_data) 464 464 return -ENOMEM; 465 - memset(board->private_data, 0, sizeof(struct hp_82341_priv)); 466 465 return 0; 467 466 } 468 467
+1 -2
drivers/staging/gpib/ines/ines_gpib.c
··· 1063 1063 DEBUG(0, "%s(0x%p)\n", __func__ link); 1064 1064 1065 1065 /* Allocate space for private device-specific data */ 1066 - info = kmalloc(sizeof(*info), GFP_KERNEL); 1066 + info = kzalloc(sizeof(*info), GFP_KERNEL); 1067 1067 if (!info) 1068 1068 return -ENOMEM; 1069 - memset(info, 0, sizeof(*info)); 1070 1069 1071 1070 info->p_dev = link; 1072 1071 link->priv = info;
+1 -3
drivers/staging/gpib/tnt4882/mite.c
··· 57 57 for (pcidev = pci_get_device(PCI_VENDOR_ID_NATINST, PCI_ANY_ID, NULL); 58 58 pcidev; 59 59 pcidev = pci_get_device(PCI_VENDOR_ID_NATINST, PCI_ANY_ID, pcidev)) { 60 - mite = kmalloc(sizeof(*mite), GFP_KERNEL); 60 + mite = kzalloc(sizeof(*mite), GFP_KERNEL); 61 61 if (!mite) 62 62 return; 63 - 64 - memset(mite, 0, sizeof(*mite)); 65 63 66 64 mite->pcidev = pcidev; 67 65 pci_dev_get(mite->pcidev);
+1 -2
drivers/staging/gpib/tnt4882/tnt4882_gpib.c
··· 1644 1644 DEBUG(0, "%s(0x%p)\n", __func__, link); 1645 1645 1646 1646 /* Allocate space for private device-specific data */ 1647 - info = kmalloc(sizeof(*info), GFP_KERNEL); 1647 + info = kzalloc(sizeof(*info), GFP_KERNEL); 1648 1648 if (!info) 1649 1649 return -ENOMEM; 1650 - memset(info, 0, sizeof(*info)); 1651 1650 1652 1651 info->p_dev = link; 1653 1652 link->priv = info;