[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20241014060430.1533329-1-roheetchavan@gmail.com>
Date: Mon, 14 Oct 2024 11:34:30 +0530
From: Rohit Chavan <roheetchavan@...il.com>
To: Dave Penkler <dpenkler@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org
Cc: Rohit Chavan <roheetchavan@...il.com>
Subject: [PATCH] staging: gpib: Replace kmalloc + memset with kzalloc for zero initialization.
This change simplifies memory allocation by using `kzalloc`
for zero-initialization, improving readability and reducing
uninitialized memory errors.
Signed-off-by: Rohit Chavan <roheetchavan@...il.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
Powered by blists - more mailing lists