OSDN Git Service

platform/x86: hp-bioscfg: Use kmemdup() to replace kmalloc + memcpy
authorLi Zetao <lizetao1@huawei.com>
Thu, 3 Aug 2023 03:20:27 +0000 (11:20 +0800)
committerHans de Goede <hdegoede@redhat.com>
Mon, 7 Aug 2023 11:36:20 +0000 (13:36 +0200)
commit6f8972a02a6c103b67dc3a0ed9b1722943f65276
tree14344355b64ea8b3a91b9f0df1dbf0a0c8b85bbc
parentbfecbcb5713c6c602fae3b987478d135c46b4dc5
platform/x86: hp-bioscfg: Use kmemdup() to replace kmalloc + memcpy

There are some warnings reported by coccinelle:

./drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c:317:35-42:
WARNING opportunity for kmemdup
./drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c:270:40-47:
WARNING opportunity for kmemdup
./drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c:233:36-43:
WARNING opportunity for kmemdup

Use kmemdup rather than duplicating its implementation.

Signed-off-by: Li Zetao <lizetao1@huawei.com>
Reviewed-by: Jorge Lopez <jorge.lopez2@hp.com>
Link: https://lore.kernel.org/r/20230803032027.3044851-1-lizetao1@huawei.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c