Skip to contentSkip to conversation

usb: phy: tegra: Avoid use of sizeof(void)

PATCH New Thierry Reding 1 participant 1 message Jul 21, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: phy: tegra: Avoid use of sizeof(void)

From: Thierry Reding <[email protected]>

The PHY configuration is stored in an opaque "config" field, but when allocating the structure, its proper size needs to be known. In the case of UTMI, the proper structure is tegra_utmip_config of which a local variable already exists, so we can use that to obtain the size from.

Fixes the following warning from the sparse checker:

drivers/usb/phy/phy-tegra-usb.c:882:17: warning: expression using sizeof(void)

Fixes 81d5dfe6d8b3 (usb: phy: tegra: Read UTMIP parameters from device tree)
---
 drivers/usb/phy/phy-tegra-usb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/phy/phy-tegra-usb.c +2 -2
index 13b4fa287da8..886f1807a67b 100644
@@ -878,8 +878,8 @@ static int utmi_phy_probe(struct tegra_usb_phy *tegra_phy,
 		return -ENOMEM;
 	}
 
-	tegra_phy->config = devm_kzalloc(&pdev->dev,
-		sizeof(*tegra_phy->config), GFP_KERNEL);
+	tegra_phy->config = devm_kzalloc(&pdev->dev, sizeof(*config),
+					 GFP_KERNEL);
 	if (!tegra_phy->config) {
 		dev_err(&pdev->dev,
 			"unable to allocate memory for USB UTMIP config\n");
Signature · 1 line
2.0.1