* [PATCH -next] aoe: Use kzalloc for allocating only one thing
@ 2020-12-29 13:51 Zheng Yongjun
2020-12-29 23:42 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Zheng Yongjun @ 2020-12-29 13:51 UTC (permalink / raw)
To: axboe, linux-block, linux-kernel; +Cc: justin, Zheng Yongjun
Use kzalloc rather than kcalloc(1,...)
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
@@
- kcalloc(1,
+ kzalloc(
...)
// </smpl>
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
---
drivers/block/aoe/aoedev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/block/aoe/aoedev.c b/drivers/block/aoe/aoedev.c
index e2ea2356da06..4d508dddc5ac 100644
--- a/drivers/block/aoe/aoedev.c
+++ b/drivers/block/aoe/aoedev.c
@@ -460,7 +460,7 @@ aoedev_by_aoeaddr(ulong maj, int min, int do_alloc)
}
if (d || !do_alloc || minor_get(&sysminor, maj, min) < 0)
goto out;
- d = kcalloc(1, sizeof *d, GFP_ATOMIC);
+ d = kzalloc(sizeof *d, GFP_ATOMIC);
if (!d)
goto out;
d->targets = kcalloc(NTARGETS, sizeof(*d->targets), GFP_ATOMIC);
--
2.22.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] aoe: Use kzalloc for allocating only one thing
2020-12-29 13:51 [PATCH -next] aoe: Use kzalloc for allocating only one thing Zheng Yongjun
@ 2020-12-29 23:42 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2020-12-29 23:42 UTC (permalink / raw)
To: Zheng Yongjun, linux-block, linux-kernel; +Cc: justin
On 12/29/20 6:51 AM, Zheng Yongjun wrote:
> Use kzalloc rather than kcalloc(1,...)
>
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @@
> @@
>
> - kcalloc(1,
> + kzalloc(
> ...)
> // </smpl>
Should probably fix up that missing set of () while at it.
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-12-29 23:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-29 13:51 [PATCH -next] aoe: Use kzalloc for allocating only one thing Zheng Yongjun
2020-12-29 23:42 ` Jens Axboe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.