usb: typec: qcom-pmic-typec: use kcalloc() instead of kzalloc()

Replace devm_kzalloc() with devm_kcalloc() in qcom_pmic_typec_pdphy_probe()
and qcom_pmic_typec_port_probe() for safer memory allocation with built-in
overflow protection.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Link: https://lore.kernel.org/r/20250819090125.540682-1-rongqianfeng@vivo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Qianfeng Rong 2025-08-19 17:01:24 +08:00 committed by Greg Kroah-Hartman
parent 956606bafb
commit 1f43a3401d
2 changed files with 2 additions and 2 deletions

View File

@ -567,7 +567,7 @@ int qcom_pmic_typec_pdphy_probe(struct platform_device *pdev,
if (!res->nr_irqs || res->nr_irqs > PMIC_PDPHY_MAX_IRQS)
return -EINVAL;
irq_data = devm_kzalloc(dev, sizeof(*irq_data) * res->nr_irqs,
irq_data = devm_kcalloc(dev, res->nr_irqs, sizeof(*irq_data),
GFP_KERNEL);
if (!irq_data)
return -ENOMEM;

View File

@ -713,7 +713,7 @@ int qcom_pmic_typec_port_probe(struct platform_device *pdev,
if (!res->nr_irqs || res->nr_irqs > PMIC_TYPEC_MAX_IRQS)
return -EINVAL;
irq_data = devm_kzalloc(dev, sizeof(*irq_data) * res->nr_irqs,
irq_data = devm_kcalloc(dev, res->nr_irqs, sizeof(*irq_data),
GFP_KERNEL);
if (!irq_data)
return -ENOMEM;