Generated in 2.6.14-rc1-mm1 kernel version.
Signed-off-by: Jiri Slaby <[email protected]>
---
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;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
|
|