mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 19:43:40 +02:00
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:
parent
956606bafb
commit
1f43a3401d
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user