mirror of
https://github.com/torvalds/linux.git
synced 2024-12-04 01:51:34 +00:00
mtd: rawnand: Add a check in of_get_nand_secure_regions()
Check for whether of_property_count_elems_of_size() returns a negative
error code.
Fixes: 13b8976827
("mtd: rawnand: Add support for secure regions in NAND memory")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/YMtQFXE0F1w7mUh+@mwanda
This commit is contained in:
parent
2b6d2833cd
commit
14f97f0b8e
@ -5231,8 +5231,8 @@ static int of_get_nand_secure_regions(struct nand_chip *chip)
|
||||
int nr_elem, i, j;
|
||||
|
||||
nr_elem = of_property_count_elems_of_size(dn, "secure-regions", sizeof(u64));
|
||||
if (!nr_elem)
|
||||
return 0;
|
||||
if (nr_elem <= 0)
|
||||
return nr_elem;
|
||||
|
||||
chip->nr_secure_regions = nr_elem / 2;
|
||||
chip->secure_regions = kcalloc(chip->nr_secure_regions, sizeof(*chip->secure_regions),
|
||||
|
Loading…
Reference in New Issue
Block a user