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

Miquel Raynal miquel.raynal at bootlin.com
Wed Apr 22 01:08:10 PDT 2026


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



More information about the linux-mtd mailing list