From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Ed L. Cashin" <ecashin@coraid.com>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] aoe: cleanup an allocation a bit
Date: Sat, 08 Sep 2012 09:59:21 +0000 [thread overview]
Message-ID: <20120908095921.GD608@elgon.mountain> (raw)
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;
}
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Ed L. Cashin" <ecashin@coraid.com>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] aoe: cleanup an allocation a bit
Date: Sat, 8 Sep 2012 12:59:21 +0300 [thread overview]
Message-ID: <20120908095921.GD608@elgon.mountain> (raw)
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;
}
next reply other threads:[~2012-09-08 9:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-08 9:59 Dan Carpenter [this message]
2012-09-08 9:59 ` [patch] aoe: cleanup an allocation a bit Dan Carpenter
2012-09-09 1:25 ` Ed Cashin
2012-09-09 1:25 ` Ed Cashin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120908095921.GD608@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=ecashin@coraid.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.