mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
mtd: rawnand: meson: use of_property_count_elems_of_size helper
Use the of_property_count_elems_of_size() helper instead of open-coding it's logic. As a bonus this will now error out if the "reg" property values use an incorrect size (anything other than sizeof(u32)). Signed-off-by: Martin Blumenstingl <[email protected]> Tested-by:Liang Yang <[email protected]> Acked-by: Liang Yang <[email protected]> Signed-off-by: Miquel Raynal <[email protected]>
This commit is contained in:
parent
5f73f240a4
commit
2d8ffbf569
1 changed files with 1 additions and 4 deletions
|
|
@ -1233,10 +1233,7 @@ meson_nfc_nand_chip_init(struct device *dev,
|
|||
int ret, i;
|
||||
u32 tmp, nsels;
|
||||
|
||||
if (!of_get_property(np, "reg", &nsels))
|
||||
return -EINVAL;
|
||||
|
||||
nsels /= sizeof(u32);
|
||||
nsels = of_property_count_elems_of_size(np, "reg", sizeof(u32));
|
||||
if (!nsels || nsels > MAX_CE_NUM) {
|
||||
dev_err(dev, "invalid register property size\n");
|
||||
return -EINVAL;
|
||||
|
|
|
|||
Loading…
Reference in a new issue