Commit 82348201 authored by Masahiro Yamada's avatar Masahiro Yamada Committed by Miquel Raynal
Browse files

mtd: rawnand: denali_dt: error out if platform has no associated data



denali->ecc_caps is a mandatory parameter. If it were left unset,
nand_ecc_choose_conf() would end up with NULL pointer access.

So, every compatible must be associated with proper denali_dt_data.
If of_device_get_match_data() returns NULL, let it fail immediately.

Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
parent 393947e5
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -118,11 +118,12 @@ static int denali_dt_probe(struct platform_device *pdev)
	denali = &dt->controller;

	data = of_device_get_match_data(dev);
	if (data) {
	if (WARN_ON(!data))
		return -EINVAL;

	denali->revision = data->revision;
	denali->caps = data->caps;
	denali->ecc_caps = data->ecc_caps;
	}

	denali->dev = dev;
	denali->irq = platform_get_irq(pdev, 0);