Skip to contentSkip to conversation

staging: gpib: Replace kmalloc + memset with kzalloc for zero initialization.

PATCH New Rohit Chavan 1 participant 1 message Oct 14, 2024 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/staging/gpib/tnt4882/mite.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/gpib/tnt4882/mite.c +1 -3
index adb656a5eb2c..54d80f89195f 100644
@@ -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;
Signature · 1 line
2.34.1