Re: [PATCH v9 2/3] mtd: spi-nand: Add support for randomizer

From: Miquel Raynal

Date: Wed Apr 22 2026 - 04:08:32 EST


Hi Cheng Ming,

> +static int spinand_randomizer_init(struct spinand_device *spinand)
> +{
> + struct device_node *np = spinand->spimem->spi->dev.of_node;
> + u32 rand_val;
> + int ret;
> +
> + if (!spinand->set_randomizer)
> + return 0;
> +
> + ret = of_property_read_u32(np, "nand-randomizer", &rand_val);
> + if (ret)
> + return 0;
> +
> + return spinand->set_randomizer(spinand, rand_val == 1);

You do not need the "== 1" part. rand_val is cast into a boolean, so any
non zero value will be taken understood as an "enable" and zero will be
treated as "disable", which is fine.

The rest looks fine.

Thanks,
Miquèl