mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
mtd: rawnand: atmel: use struct_size
The comment above makes it clear that this is a single element for legacy handling. Clarify that with struct_size and avoid manual pointer math. Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
This commit is contained in:
parent
d5a5c9eb2e
commit
591b5ac173
|
|
@ -1799,8 +1799,7 @@ atmel_nand_controller_legacy_add_nands(struct atmel_nand_controller *nc)
|
|||
* Legacy bindings only allow connecting a single NAND with a unique CS
|
||||
* line to the controller.
|
||||
*/
|
||||
nand = devm_kzalloc(nc->dev, sizeof(*nand) + sizeof(*nand->cs),
|
||||
GFP_KERNEL);
|
||||
nand = devm_kzalloc(nc->dev, struct_size(nand, cs, 1), GFP_KERNEL);
|
||||
if (!nand)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user