Skip to contentSkip to conversation

staging: r8188eu: Prefer kcalloc over kzalloc

PATCH In review Kang Minchul 3 participants 3 messages Dec 16, 2022 – Dec 18, 2022 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: r8188eu: Prefer kcalloc over kzalloc

Fixed following checkpatch.pl warning:
* WARNING: Prefer kcalloc over kzalloc with multiply

Instead of specifying (number of bytes) * (size) as arugment in kzalloc, prefer kcalloc.

---
 drivers/staging/r8188eu/core/rtw_xmit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/r8188eu/core/rtw_xmit.c +1 -1
index 34494f08c0cd..36ce1e3f9c81 100644
@@ -1564,7 +1564,7 @@ int rtw_alloc_hwxmits(struct adapter *padapter)
 
 	pxmitpriv->hwxmit_entry = HWXMIT_ENTRY;
 
-	pxmitpriv->hwxmits = kzalloc(sizeof(struct hw_xmit) * pxmitpriv->hwxmit_entry, GFP_KERNEL);
+	pxmitpriv->hwxmits = kcalloc(pxmitpriv->hwxmit_entry, sizeof(struct hw_xmit), GFP_KERNEL);
 	if (!pxmitpriv->hwxmits)
 		return -ENOMEM;
 
Signature · 1 line
2.34.1
Tested-by on v1 1/1
#1 lore raw
Quoted 16 lines · Kang Minchul

Fixed following checkpatch.pl warning:
* WARNING: Prefer kcalloc over kzalloc with multiply

Instead of specifying (number of bytes) * (size) as arugment in kzalloc, prefer kcalloc.

---
  drivers/staging/r8188eu/core/rtw_xmit.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/r8188eu/core/rtw_xmit.c +0 -0
index 34494f08c0cd..36ce1e3f9c81 100644

drivers/staging/r8188eu/core/rtw_xmit.c int rtw_alloc_hwxmits(struct adapter *padapter) · line 1570

Quoted 8 lines
drivers/staging/r8188eu/core/rtw_xmit.c +1 -1
@@ -1564,7 +1564,7 @@ int rtw_alloc_hwxmits(struct adapter *padapter)
 
  	pxmitpriv->hwxmit_entry = HWXMIT_ENTRY;
 
-	pxmitpriv->hwxmits = kzalloc(sizeof(struct hw_xmit) * pxmitpriv->hwxmit_entry, GFP_KERNEL);
+	pxmitpriv->hwxmits = kcalloc(pxmitpriv->hwxmit_entry, sizeof(struct hw_xmit), GFP_KERNEL);
  	if (!pxmitpriv->hwxmits)
  		return -ENOMEM;
 
Reviewed-by on v1 1/1
#2 lore raw
In reply to Kang Minchul

Thus wrote Kang Minchul ([email protected]):

Quoted 26 lines

Fixed following checkpatch.pl warning:
* WARNING: Prefer kcalloc over kzalloc with multiply

Instead of specifying (number of bytes) * (size) as arugment in kzalloc, prefer kcalloc.

---
 drivers/staging/r8188eu/core/rtw_xmit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/r8188eu/core/rtw_xmit.c +1 -1
index 34494f08c0cd..36ce1e3f9c81 100644
@@ -1564,7 +1564,7 @@ int rtw_alloc_hwxmits(struct adapter *padapter)
 
 	pxmitpriv->hwxmit_entry = HWXMIT_ENTRY;
 
-	pxmitpriv->hwxmits = kzalloc(sizeof(struct hw_xmit) * pxmitpriv->hwxmit_entry, GFP_KERNEL);
+	pxmitpriv->hwxmits = kcalloc(pxmitpriv->hwxmit_entry, sizeof(struct hw_xmit), GFP_KERNEL);
 	if (!pxmitpriv->hwxmits)
 		return -ENOMEM;
 
Signature · 1 line
2.34.1