9
0
Fork 0

cfi_flash: fix NULL pointer dereference

We need to setup the info->dev pointer before flash_get_size() since it
might use it for dev_dbg().
This fix a crash on boot when debug output is enabled.

Signed-off-by: Philippe Rétornaz <philippe.retornaz@epfl.ch>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Philippe Rétornaz 2014-02-25 19:05:16 +01:00 committed by Sascha Hauer
parent 8383a659d3
commit fb7836ebf6
1 changed files with 1 additions and 1 deletions

View File

@ -978,8 +978,8 @@ static int cfi_probe (struct device_d *dev)
info->flash_id = FLASH_UNKNOWN;
info->cmd_reset = FLASH_CMD_RESET;
info->base = dev_request_mem_region(dev, 0);
info->size = flash_get_size(info);
info->dev = dev;
info->size = flash_get_size(info);
if (info->flash_id == FLASH_UNKNOWN) {
dev_warn(dev, "## Unknown FLASH on Bank at 0x%08x - Size = 0x%08lx = %ld MB\n",