Skip to content

Commit

Permalink
mtd: physmap_of: Correct the size argument to kzalloc
Browse files Browse the repository at this point in the history
mtd_list has type struct mtd_info **, not struct mtd_info *, so the
elements of the array should have pointer type, not structure type.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@disable sizeof_type_expr@
type T;
T **x;
@@

  x =
  <+...sizeof(
- T
+ *x
  )...+>
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
Julia Lawall authored and David Woodhouse committed Jan 2, 2010
1 parent bb6a775 commit e026255
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/mtd/maps/physmap_of.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ static int __devinit of_flash_probe(struct of_device *dev,

dev_set_drvdata(&dev->dev, info);

mtd_list = kzalloc(sizeof(struct mtd_info) * count, GFP_KERNEL);
mtd_list = kzalloc(sizeof(*mtd_list) * count, GFP_KERNEL);
if (!mtd_list)
goto err_flash_remove;

Expand Down

0 comments on commit e026255

Please sign in to comment.