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] staging: gpib: Replace kmalloc + memset with kzalloc for zero initialization.
Date: Mon, 14 Oct 2024 11:34:30 +0530 [thread overview]
Message-ID: <20241014060430.1533329-1-roheetchavan@gmail.com> (raw)
This change simplifies memory allocation by using `kzalloc`
for zero-initialization, improving readability and reducing
uninitialized memory errors.
Signed-off-by: Rohit Chavan <roheetchavan@gmail.com>
---
drivers/staging/gpib/tnt4882/mite.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/staging/gpib/tnt4882/mite.c b/drivers/staging/gpib/tnt4882/mite.c
index adb656a5eb2c..54d80f89195f 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;
--
2.34.1
reply other threads:[~2024-10-14 6:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20241014060430.1533329-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