mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 12:52:29 -04: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:
committed by
Miquel Raynal
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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user