linux/drivers/phy/samsung
Gustavo A. R. Silva c886ec0256 phy: samsung: Use struct_size() in devm_kzalloc()
One of the more common cases of allocation size calculations is finding
the size of a structure that has a zero-sized array at the end, along
with memory for some number of elements for that array. For example:

struct samsung_usb2_phy_driver {
	...
        struct samsung_usb2_phy_instance instances[0];
};

instance = devm_kzalloc(dev, sizeof(struct samsung_usb2_phy_driver) +
			count * sizeof(struct samsung_usb2_phy_instance),
			GFP_KERNEL);

Instead of leaving these open-coded and prone to type mistakes, we can
now use the new struct_size() helper:

instance = devm_kzalloc(dev, struct_size(instance, instances, count),
			GFP_KERNEL);

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
2019-06-20 14:13:57 +05:30
..
Kconfig phy: Remove SOC_EXYNOS4212 dep. from PHY_EXYNOS4X12_USB 2018-03-08 13:56:21 +05:30
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
phy-exynos4x12-usb2.c
phy-exynos5-usbdrd.c phy: exynos5-usbdrd: Calibrate LOS levels for exynos5420/5800 2017-12-29 13:00:35 +05:30
phy-exynos4210-usb2.c
phy-exynos5250-sata.c
phy-exynos5250-usb2.c
phy-exynos-dp-video.c
phy-exynos-mipi-video.c phy: exynos-mipi-video: Simplify code by using regmap_update_bits() 2018-04-25 10:52:59 +05:30
phy-exynos-pcie.c
phy-s5pv210-usb2.c
phy-samsung-usb2.c phy: samsung: Use struct_size() in devm_kzalloc() 2019-06-20 14:13:57 +05:30
phy-samsung-usb2.h