From: Rohit Chavan <roheetchavan@gmail.com>
To: Dave Penkler <dpenkler@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Cc: Rohit Chavan <roheetchavan@gmail.com>
Subject: [PATCH v2] staging: gpib: Replace kmalloc/memset with kzalloc.
Date: Wed, 16 Oct 2024 16:04:06 +0530 [thread overview]
Message-ID: <20241016103406.1618448-1-roheetchavan@gmail.com> (raw)
This patch replaces kmalloc + memset with kzalloc in the GPIB driver.
Signed-off-by: Rohit Chavan <roheetchavan@gmail.com>
---
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(-)
diff --git a/drivers/staging/gpib/agilent_82350b/agilent_82350b.c b/drivers/staging/gpib/agilent_82350b/agilent_82350b.c
index 1296db4d47c6..cff555447ee9 100644
--- a/drivers/staging/gpib/agilent_82350b/agilent_82350b.c
+++ b/drivers/staging/gpib/agilent_82350b/agilent_82350b.c
@@ -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;
}
diff --git a/drivers/staging/gpib/cb7210/cb7210.c b/drivers/staging/gpib/cb7210/cb7210.c
index 59f6dde3d966..d32576c21988 100644
--- a/drivers/staging/gpib/cb7210/cb7210.c
+++ b/drivers/staging/gpib/cb7210/cb7210.c
@@ -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;
diff --git a/drivers/staging/gpib/gpio/gpib_bitbang.c b/drivers/staging/gpib/gpio/gpib_bitbang.c
index 81a952beee0d..847e4bea2cb1 100644
--- a/drivers/staging/gpib/gpio/gpib_bitbang.c
+++ b/drivers/staging/gpib/gpio/gpib_bitbang.c
@@ -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;
}
diff --git a/drivers/staging/gpib/hp_82335/hp82335.c b/drivers/staging/gpib/hp_82335/hp82335.c
index 4e277997684b..cf92fc0b3337 100644
--- a/drivers/staging/gpib/hp_82335/hp82335.c
+++ b/drivers/staging/gpib/hp_82335/hp82335.c
@@ -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;
}
diff --git a/drivers/staging/gpib/hp_82341/hp_82341.c b/drivers/staging/gpib/hp_82341/hp_82341.c
index d37dd8335523..8ad1c885a9fb 100644
--- a/drivers/staging/gpib/hp_82341/hp_82341.c
+++ b/drivers/staging/gpib/hp_82341/hp_82341.c
@@ -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;
}
diff --git a/drivers/staging/gpib/ines/ines_gpib.c b/drivers/staging/gpib/ines/ines_gpib.c
index 9dbbdb048b9f..87f9d3789c5f 100644
--- a/drivers/staging/gpib/ines/ines_gpib.c
+++ b/drivers/staging/gpib/ines/ines_gpib.c
@@ -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;
diff --git a/drivers/staging/gpib/tnt4882/mite.c b/drivers/staging/gpib/tnt4882/mite.c
index 882cc4bc122e..0edf34d243e9 100644
--- a/drivers/staging/gpib/tnt4882/mite.c
+++ b/drivers/staging/gpib/tnt4882/mite.c
@@ -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;
diff --git a/drivers/staging/gpib/tnt4882/tnt4882_gpib.c b/drivers/staging/gpib/tnt4882/tnt4882_gpib.c
index ef4b9ce36741..0a850926c118 100644
--- a/drivers/staging/gpib/tnt4882/tnt4882_gpib.c
+++ b/drivers/staging/gpib/tnt4882/tnt4882_gpib.c
@@ -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;
--
2.34.1
next reply other threads:[~2024-10-16 10:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-16 10:34 Rohit Chavan [this message]
2024-10-16 12:49 ` [PATCH v2] staging: gpib: Replace kmalloc/memset with kzalloc Dave Penkler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241016103406.1618448-1-roheetchavan@gmail.com \
--to=roheetchavan@gmail.com \
--cc=dpenkler@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox