Commit 3c0e3ca6 authored by Julia Lawall's avatar Julia Lawall Committed by Kalle Valo

zd1201: use kzalloc

Use kzalloc instead of kmalloc + memset.

The semantic patch that makes this change is:
(https://coccinelle.gitlabpages.inria.fr/website/)

//<smpl>
@@
expression res, size, flag;
@@
- res = kmalloc(size, flag);
+ res = kzalloc(size, flag);
  ...
- memset(res, 0, size);
//</smpl>
Signed-off-by: default avatarJulia Lawall <Julia.Lawall@inria.fr>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220312102705.71413-6-Julia.Lawall@inria.fr
parent e7d1fc0b
...@@ -521,7 +521,7 @@ static int zd1201_setconfig(struct zd1201 *zd, int rid, const void *buf, int len ...@@ -521,7 +521,7 @@ static int zd1201_setconfig(struct zd1201 *zd, int rid, const void *buf, int len
zd->rxdatas = 0; zd->rxdatas = 0;
zd->rxlen = 0; zd->rxlen = 0;
for (seq=0; len > 0; seq++) { for (seq=0; len > 0; seq++) {
request = kmalloc(16, gfp_mask); request = kzalloc(16, gfp_mask);
if (!request) if (!request)
return -ENOMEM; return -ENOMEM;
urb = usb_alloc_urb(0, gfp_mask); urb = usb_alloc_urb(0, gfp_mask);
...@@ -529,7 +529,6 @@ static int zd1201_setconfig(struct zd1201 *zd, int rid, const void *buf, int len ...@@ -529,7 +529,6 @@ static int zd1201_setconfig(struct zd1201 *zd, int rid, const void *buf, int len
kfree(request); kfree(request);
return -ENOMEM; return -ENOMEM;
} }
memset(request, 0, 16);
reqlen = len>12 ? 12 : len; reqlen = len>12 ? 12 : len;
request[0] = ZD1201_USB_RESREQ; request[0] = ZD1201_USB_RESREQ;
request[1] = seq; request[1] = seq;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment