Skip to contentSkip to conversation

mfd: Fix allocation size of tps65217 platform data

PATCH In review Matthias Kaehlcke 2 participants 2 messages Aug 8, 2012 – Aug 13, 2012

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

PATCH 1/1 mfd: Fix allocation size of tps65217 platform data

tps65217_parse_dt() allocates a struct tps65217_board for each regulator specified in the device tree. the structure itself provides arrays for the pointers to the regulator init data and the regulator device tree node, so only one instance of it is needed

This patch is based on the mfd tree

---
 drivers/mfd/tps65217.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/tps65217.c +1 -1
index 61c097a..cf908ac 100644
@@ -162,7 +162,7 @@ static struct tps65217_board *tps65217_parse_dt(struct i2c_client *client)
 		return NULL;
 
 	count = ret;
-	pdata = devm_kzalloc(&client->dev, count * sizeof(*pdata), GFP_KERNEL);
+	pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
 	if (!pdata)
 		return NULL;
 
Signature · 1 line
1.7.10
#1 lore raw

Hi Matthias,

Can you comment on my latest patch? So that I can fix this issue on the same.

https://patchwork.kernel.org/patch/1220151/

Thanks
AnilKumar

Quoted 29 lines · Matthias Kaehlcke

tps65217_parse_dt() allocates a struct tps65217_board for each regulator specified in the device tree. the structure itself provides arrays for the pointers to the regulator init data and the regulator device tree node, so only one instance of it is needed

This patch is based on the mfd tree

---
 drivers/mfd/tps65217.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/tps65217.c +1 -1
index 61c097a..cf908ac 100644
@@ -162,7 +162,7 @@ static struct tps65217_board *tps65217_parse_dt(struct i2c_client *client)
 		return NULL;
 
 	count = ret;
-	pdata = devm_kzalloc(&client->dev, count * sizeof(*pdata), GFP_KERNEL);
+	pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
 	if (!pdata)
 		return NULL;
 
Signature · 1 line
1.7.10