Skip to contentSkip to conversation

spi: size of a pointer to determine the size of the pointed-to type

PATCH New Roel Kluin 1 participant 1 message Jun 8, 2009 SPI

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 spi: size of a pointer to determine the size of the pointed-to type

Do not take the size of a pointer to determine the size of the pointed-to type

---
This wasn't tested, please review.

drivers/spi/spi_mpc83xx.c +3 -3
index f4573a9..a32ccb4 100644
@@ -711,12 +711,12 @@ static int of_mpc83xx_spi_get_chipselects(struct device *dev)
 		return 0;
 	}
 
-	pinfo->gpios = kmalloc(ngpios * sizeof(pinfo->gpios), GFP_KERNEL);
+	pinfo->gpios = kmalloc(ngpios * sizeof(*pinfo->gpios), GFP_KERNEL);
 	if (!pinfo->gpios)
 		return -ENOMEM;
-	memset(pinfo->gpios, -1, ngpios * sizeof(pinfo->gpios));
+	memset(pinfo->gpios, -1, ngpios * sizeof(*pinfo->gpios));
 
-	pinfo->alow_flags = kzalloc(ngpios * sizeof(pinfo->alow_flags),
+	pinfo->alow_flags = kzalloc(ngpios * sizeof(*pinfo->alow_flags),
 				    GFP_KERNEL);
 	if (!pinfo->alow_flags) {
 		ret = -ENOMEM;

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects