* [patch] aoe: cleanup an allocation a bit
@ 2012-09-08 9:59 Dan Carpenter
2012-09-09 1:25 ` Ed Cashin
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2012-09-08 9:59 UTC (permalink / raw)
To: Ed L. Cashin; +Cc: linux-kernel, kernel-janitors
We changed this recently so we can just use kzalloc() here instead of
kcalloc(1, ...). Kernel style prefers sizeof(*t) over sizeof *t. The
kfree(t) is a no-op now as well so that can be removed.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Only applies to linux-next.
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index 5461faa..c0adbbd 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -1255,9 +1255,8 @@ addtgt(struct aoedev *d, char *addr, ulong nframes)
"aoe: device addtgt failure; too many targets\n");
return NULL;
}
- t = kcalloc(1, sizeof *t, GFP_ATOMIC);
+ t = kzalloc(sizeof(*t), GFP_ATOMIC);
if (!t) {
- kfree(t);
printk(KERN_INFO "aoe: cannot allocate memory to add target\n");
return NULL;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] aoe: cleanup an allocation a bit
2012-09-08 9:59 [patch] aoe: cleanup an allocation a bit Dan Carpenter
@ 2012-09-09 1:25 ` Ed Cashin
0 siblings, 0 replies; 2+ messages in thread
From: Ed Cashin @ 2012-09-09 1:25 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-kernel, kernel-janitors
Looks OK to me, thanks.
On Sep 7, 2012, at 11:59 PM, "Dan Carpenter" <dan.carpenter@oracle.com> wrote:
> We changed this recently so we can just use kzalloc() here instead of
> kcalloc(1, ...). Kernel style prefers sizeof(*t) over sizeof *t. The
> kfree(t) is a no-op now as well so that can be removed.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Only applies to linux-next.
>
> diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
> index 5461faa..c0adbbd 100644
> --- a/drivers/block/aoe/aoecmd.c
> +++ b/drivers/block/aoe/aoecmd.c
> @@ -1255,9 +1255,8 @@ addtgt(struct aoedev *d, char *addr, ulong nframes)
> "aoe: device addtgt failure; too many targets\n");
> return NULL;
> }
> - t = kcalloc(1, sizeof *t, GFP_ATOMIC);
> + t = kzalloc(sizeof(*t), GFP_ATOMIC);
> if (!t) {
> - kfree(t);
> printk(KERN_INFO "aoe: cannot allocate memory to add target\n");
> return NULL;
> }
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-09-09 1:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-08 9:59 [patch] aoe: cleanup an allocation a bit Dan Carpenter
2012-09-09 1:25 ` Ed Cashin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).