staging: gpib: Replace kmalloc/memset with kzalloc.
PATCH v2 1/1 staging: gpib: Replace kmalloc/memset with kzalloc.
This patch replaces kmalloc + memset with kzalloc in the GPIB driver.
Signed-off-by Rohit Chavan <[email protected]>
---
Changes since v1:
- Merge similar patches in single one
- Make commit message concise
--- drivers/staging/gpib/agilent_82350b/agilent_82350b.c | 3 +-- drivers/staging/gpib/cb7210/cb7210.c | 3 +-- drivers/staging/gpib/gpio/gpib_bitbang.c | 3 +-- drivers/staging/gpib/hp_82335/hp82335.c | 3 +-- drivers/staging/gpib/hp_82341/hp_82341.c | 3 +-- drivers/staging/gpib/ines/ines_gpib.c | 3 +-- drivers/staging/gpib/tnt4882/mite.c | 4 +--- drivers/staging/gpib/tnt4882/tnt4882_gpib.c | 3 +-- 8 files changed, 8 insertions(+), 17 deletions(-)
drivers/staging/gpib/agilent_82350b/agilent_82350b.c +1 -2
@@ -518,10 +518,9 @@ void agilent_82350b_return_to_local(gpib_board_t *board)int agilent_82350b_allocate_private (gpib_board_t *board) { - board->private_data =kmalloc (sizeof (struct agilent_82350b_priv ),GFP_KERNEL ); + board->private_data =kzalloc (sizeof (struct agilent_82350b_priv ),GFP_KERNEL );if (!board->private_data)return -ENOMEM ; -memset (board->private_data,0 ,sizeof (struct agilent_82350b_priv ));return 0 ; }
drivers/staging/gpib/cb7210/cb7210.c +1 -2
@@ -1199,10 +1199,9 @@ static int cb_gpib_probe(struct pcmcia_device *link)DEBUG (0 ,"%s(0x%p)\n" , __func__, link);/* Allocate space for private device-specific data */ - info =kmalloc (sizeof (*info),GFP_KERNEL ); + info =kzalloc (sizeof (*info),GFP_KERNEL );if (!info)return -ENOMEM ; -memset (info,0 ,sizeof (*info)); info->p_dev = link; link->priv = info;
drivers/staging/gpib/gpio/gpib_bitbang.c +1 -2
@@ -1105,10 +1105,9 @@ static int bb_line_status(const gpib_board_t *board)static int allocate_private (gpib_board_t *board) { - board->private_data =kmalloc (sizeof (struct bb_priv ),GFP_KERNEL ); + board->private_data =kzalloc (sizeof (struct bb_priv ),GFP_KERNEL );if (!board->private_data)return -1 ; -memset (board->private_data,0 ,sizeof (struct bb_priv ));return 0 ; }
drivers/staging/gpib/hp_82335/hp82335.c +1 -2
@@ -201,10 +201,9 @@ return_to_local : hp82335_return_to_local,int hp82335_allocate_private (gpib_board_t *board) { - board->private_data =kmalloc (sizeof (struct hp82335_priv ),GFP_KERNEL ); + board->private_data =kzalloc (sizeof (struct hp82335_priv ),GFP_KERNEL );if (!board->private_data)return -1 ; -memset (board->private_data,0 ,sizeof (struct hp82335_priv ));return 0 ; }
drivers/staging/gpib/hp_82341/hp_82341.c +1 -2
@@ -459,10 +459,9 @@ return_to_local : hp_82341_return_to_local,int hp_82341_allocate_private (gpib_board_t *board) { - board->private_data =kmalloc (sizeof (struct hp_82341_priv ),GFP_KERNEL ); + board->private_data =kzalloc (sizeof (struct hp_82341_priv ),GFP_KERNEL );if (!board->private_data)return -ENOMEM ; -memset (board->private_data,0 ,sizeof (struct hp_82341_priv ));return 0 ; }
drivers/staging/gpib/ines/ines_gpib.c +1 -2
@@ -1063,10 +1063,9 @@ static int ines_gpib_probe(struct pcmcia_device *link) DEBUG(0, "%s(0x%p)\n", __func__ link);/* Allocate space for private device-specific data */ - info =kmalloc (sizeof (*info),GFP_KERNEL ); + info =kzalloc (sizeof (*info),GFP_KERNEL );if (!info)return -ENOMEM ; -memset (info,0 ,sizeof (*info)); info->p_dev = link; link->priv = info;
drivers/staging/gpib/tnt4882/mite.c +1 -3
@@ -57,12 +57,10 @@ void mite_init(void)for (pcidev =pci_get_device (PCI_VENDOR_ID_NATINST ,PCI_ANY_ID ,NULL ); pcidev; pcidev =pci_get_device (PCI_VENDOR_ID_NATINST ,PCI_ANY_ID , pcidev)) { - mite =kmalloc (sizeof (*mite),GFP_KERNEL ); + mite =kzalloc (sizeof (*mite),GFP_KERNEL );if (!mite)return ; -memset (mite,0 ,sizeof (*mite)); - mite->pcidev = pcidev;pci_dev_get (mite->pcidev); mite->next = mite_devices;
drivers/staging/gpib/tnt4882/tnt4882_gpib.c +1 -2
@@ -1644,10 +1644,9 @@ static int ni_gpib_probe(struct pcmcia_device *link)DEBUG (0 ,"%s(0x%p)\n" , __func__, link);/* Allocate space for private device-specific data */ - info =kmalloc (sizeof (*info),GFP_KERNEL ); + info =kzalloc (sizeof (*info),GFP_KERNEL );if (!info)return -ENOMEM ; -memset (info,0 ,sizeof (*info)); info->p_dev = link; link->priv = info;
Signature · 1 line
2.34.1
Quoted 7 lines · Rohit Chavan
This patch replaces kmalloc + memset with kzalloc in the GPIB driver.
Signed-off-by Rohit Chavan <[email protected]>---
Changes since v1:
- Merge similar patches in single one
- Make commit message concise
Quoted 11 lines
--- drivers/staging/gpib/agilent_82350b/agilent_82350b.c | 3 +-- drivers/staging/gpib/cb7210/cb7210.c | 3 +-- drivers/staging/gpib/gpio/gpib_bitbang.c | 3 +-- drivers/staging/gpib/hp_82335/hp82335.c | 3 +-- drivers/staging/gpib/hp_82341/hp_82341.c | 3 +-- drivers/staging/gpib/ines/ines_gpib.c | 3 +-- drivers/staging/gpib/tnt4882/mite.c | 4 +--- drivers/staging/gpib/tnt4882/tnt4882_gpib.c | 3 +-- 8 files changed, 8 insertions(+), 17 deletions(-)
Reviewed-by Dave Penkler <[email protected]>