ia64: tioca: Use kmemdup rather than duplicating its implementation
authorThomas Meyer <thomas@m3y3r.de>
Sat, 19 Nov 2011 11:27:39 +0000 (12:27 +0100)
committerTony Luck <tony.luck@intel.com>
Fri, 9 Dec 2011 23:22:23 +0000 (15:22 -0800)
The semantic patch that makes this change is available
in scripts/coccinelle/api/memdup.cocci.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Tony Luck <tony.luck@intel.com>
arch/ia64/sn/pci/tioca_provider.c

index 642451e..e77c477 100644 (file)
@@ -600,11 +600,11 @@ tioca_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont
         * Allocate kernel bus soft and copy from prom.
         */
 
-       tioca_common = kzalloc(sizeof(struct tioca_common), GFP_KERNEL);
+       tioca_common = kmemdup(prom_bussoft, sizeof(struct tioca_common),
+                              GFP_KERNEL);
        if (!tioca_common)
                return NULL;
 
-       memcpy(tioca_common, prom_bussoft, sizeof(struct tioca_common));
        tioca_common->ca_common.bs_base = (unsigned long)
                ioremap(REGION_OFFSET(tioca_common->ca_common.bs_base),
                        sizeof(struct tioca_common));