diff options
author | Julia Lawall <julia@diku.dk> | 2010-05-24 15:13:16 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2010-05-24 16:31:45 -0400 |
commit | b46fc5f235be04a7f77fb2af1d8cb809889c25c1 (patch) | |
tree | 0bd2e23d52a914a8d79ccc8dd772963ec519f42c /arch/x86/pci/acpi.c | |
parent | 8c3ba8d049247dc06b6dcee1711a11b26647aa44 (diff) |
arch/x86/pci: use kasprintf
kasprintf combines kmalloc and sprintf, and takes care of the size
calculation itself.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression a,flag;
expression list args;
statement S;
@@
a =
- \(kmalloc\|kzalloc\)(...,flag)
+ kasprintf(flag,args)
<... when != a
if (a == NULL || ...) S
...>
- sprintf(a,args);
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
LKML-Reference: <201005241913.o4OJDG3R010871@imap1.linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/pci/acpi.c')
-rw-r--r-- | arch/x86/pci/acpi.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c index 31930fd30ea9..7c0ad634694a 100644 --- a/arch/x86/pci/acpi.c +++ b/arch/x86/pci/acpi.c | |||
@@ -207,10 +207,9 @@ get_current_resources(struct acpi_device *device, int busnum, | |||
207 | if (!info.res) | 207 | if (!info.res) |
208 | goto res_alloc_fail; | 208 | goto res_alloc_fail; |
209 | 209 | ||
210 | info.name = kmalloc(16, GFP_KERNEL); | 210 | info.name = kasprintf(GFP_KERNEL, "PCI Bus %04x:%02x", domain, busnum); |
211 | if (!info.name) | 211 | if (!info.name) |
212 | goto name_alloc_fail; | 212 | goto name_alloc_fail; |
213 | sprintf(info.name, "PCI Bus %04x:%02x", domain, busnum); | ||
214 | 213 | ||
215 | info.res_num = 0; | 214 | info.res_num = 0; |
216 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, setup_resource, | 215 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, setup_resource, |