From: Jiri Slaby <jirislaby@gmail.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] drivers/base: a little speedup and cleanup
Date: Fri, 16 Sep 2005 14:20:31 +0200 [thread overview]
Message-ID: <200509161220.j8GCKV37002454@localhost.localdomain> (raw)
In-Reply-To: <20050916022319.12bf53f3.akpm@osdl.org>
Generated in 2.6.14-rc1-mm1 kernel version.
Signed-off-by: Jiri Slaby <xslaby@fi.muni.cz>
---
platform.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
Performance improvement -- we don't need to zero all allocated memory, only a
few bytes from the beginning.
sizeof cleanup -- we want struct a *b; sizeof(*b) rather than sizeof(struct a).
---
commit 0173dea2b934339a62947115081483278c289d1d
tree 3fb8fcd0afa14f636972d2fa7d0a6d136a12654e
parent ee677410285dd60b28e9a5503365e7f0c961f01e
author root <root@bellona.(none)> Fri, 16 Sep 2005 14:16:10 +0200
committer root <root@bellona.(none)> Fri, 16 Sep 2005 14:16:10 +0200
drivers/base/platform.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -225,18 +225,19 @@ struct platform_device *platform_device_
struct platform_object *pobj;
int retval;
- pobj = kzalloc(sizeof(*pobj) + sizeof(struct resource) * num, GFP_KERNEL);
+ pobj = kmalloc(sizeof(*pobj) + sizeof(*res) * num, GFP_KERNEL);
if (!pobj) {
retval = -ENOMEM;
goto error;
}
+ memset(pobj, 0, sizeof(*pobj));
pobj->pdev.name = name;
pobj->pdev.id = id;
pobj->pdev.dev.release = platform_device_release_simple;
if (num) {
- memcpy(pobj->resources, res, sizeof(struct resource) * num);
+ memcpy(pobj->resources, res, sizeof(*res) * num);
pobj->pdev.resource = pobj->resources;
pobj->pdev.num_resources = num;
}
next prev parent reply other threads:[~2005-09-16 12:20 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-16 9:23 2.6.14-rc1-mm1 Andrew Morton
2005-09-16 9:45 ` 2.6.14-rc1-mm1 Pekka Enberg
2005-09-16 10:17 ` 2.6.14-rc1-mm1 Anton Blanchard
2005-09-16 20:55 ` 2.6.14-rc1-mm1 Sonny Rao
2005-09-19 20:01 ` 2.6.14-rc1-mm1 Sonny Rao
2005-09-16 12:20 ` Jiri Slaby [this message]
2005-09-16 15:48 ` [PATCH] drivers/base: a little speedup and cleanup Dmitry Torokhov
2005-09-16 17:49 ` 2.6.14-rc1-mm1 Serge E. Hallyn
2005-09-16 18:41 ` 2.6.14-rc1-mm1 Dominik Karall
2005-09-16 19:46 ` 2.6.14-rc1-mm1 Jiri Slaby
2005-09-16 19:59 ` 2.6.14-rc1-mm1 Kay Sievers
2005-09-16 20:04 ` 2.6.14-rc1-mm1 Jiri Slaby
2005-09-16 21:30 ` 2.6.14-rc1-mm1 Greg KH
2005-09-16 23:53 ` 2.6.14-rc1-mm1 Valdis.Kletnieks
2005-09-17 0:10 ` 2.6.14-rc1-mm1 Greg KH
2005-09-17 1:18 ` 2.6.14-rc1-mm1 Dr.Dre
2005-09-17 1:29 ` 2.6.14-rc1-mm1 Kay Sievers
2005-09-17 0:15 ` 2.6.14-rc1-mm1 Andrew Morton
2005-09-17 4:09 ` 2.6.14-rc1-mm1 Valdis.Kletnieks
2005-09-17 1:22 ` 2.6.14-rc1-mm1 Avuton Olrich
2005-09-17 4:41 ` 2.6.14-rc1-mm1 Andrew Morton
2005-09-17 10:10 ` 2.6.14-rc1-mm1 Neil Brown
2005-09-17 1:51 ` 2.6.14-rc1-mm1 Martin J. Bligh
2005-09-17 4:22 ` 2.6.14-rc1-mm1 Martin J. Bligh
2005-09-17 4:25 ` [PATCH] mips: Fixed build error Yoichi Yuasa
2005-09-17 4:33 ` Andrew Morton
2005-09-17 5:27 ` Yoichi Yuasa
2005-09-20 22:42 ` one more oops on sensor modules removal J.A. Magallon
2005-09-21 5:56 ` Andrew Morton
2005-09-21 8:52 ` Grant Coady
2005-10-01 11:39 ` Jean Delvare
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=200509161220.j8GCKV37002454@localhost.localdomain \
--to=jirislaby@gmail.com \
--cc=akpm@osdl.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®