diff options
author | YueHaibing <yuehaibing@huawei.com> | 2018-09-27 02:52:21 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2018-10-02 17:04:40 -0400 |
commit | 74171e9dab62bd9ab616c1a8f9f1c13af71f4f5d (patch) | |
tree | a9c82bcc1f3f9e4936a45ad6f5eb93b01533651f | |
parent | 37f1c5868e457386950e7e27212bfdcd9f77f302 (diff) |
PCI: pnv_php: Use kmemdup()
Use kmemdup() rather than duplicating its implementation.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r-- | drivers/pci/hotplug/pnv_php.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c index 5070620a4f9f..ee54f5bacad1 100644 --- a/drivers/pci/hotplug/pnv_php.c +++ b/drivers/pci/hotplug/pnv_php.c | |||
@@ -275,14 +275,13 @@ static int pnv_php_add_devtree(struct pnv_php_slot *php_slot) | |||
275 | goto free_fdt1; | 275 | goto free_fdt1; |
276 | } | 276 | } |
277 | 277 | ||
278 | fdt = kzalloc(fdt_totalsize(fdt1), GFP_KERNEL); | 278 | fdt = kmemdup(fdt1, fdt_totalsize(fdt1), GFP_KERNEL); |
279 | if (!fdt) { | 279 | if (!fdt) { |
280 | ret = -ENOMEM; | 280 | ret = -ENOMEM; |
281 | goto free_fdt1; | 281 | goto free_fdt1; |
282 | } | 282 | } |
283 | 283 | ||
284 | /* Unflatten device tree blob */ | 284 | /* Unflatten device tree blob */ |
285 | memcpy(fdt, fdt1, fdt_totalsize(fdt1)); | ||
286 | dt = of_fdt_unflatten_tree(fdt, php_slot->dn, NULL); | 285 | dt = of_fdt_unflatten_tree(fdt, php_slot->dn, NULL); |
287 | if (!dt) { | 286 | if (!dt) { |
288 | ret = -EINVAL; | 287 | ret = -EINVAL; |