diff options
| author | Suma Hegde <[email protected]> | 2024-01-25 12:54:01 +0000 |
|---|---|---|
| committer | Ilpo Järvinen <[email protected]> | 2024-01-31 10:31:18 +0200 |
| commit | 2b703fbe4e3d4356195d604405825db1fcd08379 (patch) | |
| tree | 04eb2d81aedb2bfb95272ffe24d9539e9d2c54b3 | |
| parent | 202574971d81f26e7a966a6fdcb75913040923f6 (diff) | |
platform/x86/amd/hsmp: Change devm_kzalloc() to devm_kcalloc()
Use the standard array allocation variant of devm memory allocation
APIs.
Signed-off-by: Suma Hegde <[email protected]>
Signed-off-by: Naveen Krishna Chatradhi <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Ilpo Järvinen <[email protected]>
Signed-off-by: Ilpo Järvinen <[email protected]>
| -rw-r--r-- | drivers/platform/x86/amd/hsmp.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/platform/x86/amd/hsmp.c b/drivers/platform/x86/amd/hsmp.c index 4a12d7ab36c1..1927be901108 100644 --- a/drivers/platform/x86/amd/hsmp.c +++ b/drivers/platform/x86/amd/hsmp.c @@ -655,8 +655,9 @@ static int hsmp_create_attr_list(struct attribute_group *attr_grp, struct bin_attribute **hsmp_bin_attrs; /* Null terminated list of attributes */ - hsmp_bin_attrs = devm_kzalloc(dev, sizeof(struct bin_attribute *) * - (NUM_HSMP_ATTRS + 1), GFP_KERNEL); + hsmp_bin_attrs = devm_kcalloc(dev, NUM_HSMP_ATTRS + 1, + sizeof(*hsmp_bin_attrs), + GFP_KERNEL); if (!hsmp_bin_attrs) return -ENOMEM; @@ -671,8 +672,9 @@ static int hsmp_create_non_acpi_sysfs_if(struct device *dev) struct attribute_group *attr_grp; u16 i; - hsmp_attr_grps = devm_kzalloc(dev, sizeof(struct attribute_group *) * - (plat_dev.num_sockets + 1), GFP_KERNEL); + hsmp_attr_grps = devm_kcalloc(dev, plat_dev.num_sockets + 1, + sizeof(*hsmp_attr_grps), + GFP_KERNEL); if (!hsmp_attr_grps) return -ENOMEM; @@ -801,8 +803,8 @@ static int hsmp_pltdrv_probe(struct platform_device *pdev) * on each probe. */ if (!plat_dev.is_probed) { - plat_dev.sock = devm_kzalloc(&pdev->dev, - (plat_dev.num_sockets * sizeof(struct hsmp_socket)), + plat_dev.sock = devm_kcalloc(&pdev->dev, plat_dev.num_sockets, + sizeof(*plat_dev.sock), GFP_KERNEL); if (!plat_dev.sock) return -ENOMEM; |