Эх сурвалжийг харах

phy: miphy365x: Convert to devm_kcalloc and fix wrong sizeof

Prefer devm_kcalloc over devm_kzalloc with multiply.
In additional, use sizeof(phy) is incorrect, fix it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Axel Lin 10 жил өмнө
parent
commit
d8d52948a0

+ 2 - 3
drivers/phy/phy-miphy365x.c

@@ -549,9 +549,8 @@ static int miphy365x_probe(struct platform_device *pdev)
 		return -ENOMEM;
 		return -ENOMEM;
 
 
 	miphy_dev->nphys = of_get_child_count(np);
 	miphy_dev->nphys = of_get_child_count(np);
-	miphy_dev->phys = devm_kzalloc(&pdev->dev,
-				       sizeof(phy) * miphy_dev->nphys,
-				       GFP_KERNEL);
+	miphy_dev->phys = devm_kcalloc(&pdev->dev, miphy_dev->nphys,
+				       sizeof(*miphy_dev->phys), GFP_KERNEL);
 	if (!miphy_dev->phys)
 	if (!miphy_dev->phys)
 		return -ENOMEM;
 		return -ENOMEM;