Skip to content

Commit

Permalink
mtd: rawnand: denali_dt: error out if platform has no associated data
Browse files Browse the repository at this point in the history
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: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
  • Loading branch information
Masahiro Yamada authored and Miquel Raynal committed Jan 21, 2020
1 parent 393947e commit 8234820
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions drivers/mtd/nand/raw/denali_dt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
denali->revision = data->revision;
denali->caps = data->caps;
denali->ecc_caps = data->ecc_caps;
}
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);
Expand Down

0 comments on commit 8234820

Please sign in to comment.