From: Elizaveta Gorina <s02220065@xxxxxxxxxxxxx> If the device is unavailable, of_reserved_mem_device_init_by_name returns 0, and emc->nominal is not initialized and the null pointer is dereferenced. Make a return from the tegra210_emc_probe function when emc->nominal is equal to the null pointer. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 0553d7b204ef ("memory: tegra: Support derated timings on Tegra210") Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Elizaveta Gorina <s02220065@xxxxxxxxxxxxx> --- drivers/memory/tegra/tegra210-emc-core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/memory/tegra/tegra210-emc-core.c b/drivers/memory/tegra/tegra210-emc-core.c index 78ca1d6c0977..a49a5e36ba34 100644 --- a/drivers/memory/tegra/tegra210-emc-core.c +++ b/drivers/memory/tegra/tegra210-emc-core.c @@ -1865,6 +1865,9 @@ static int tegra210_emc_probe(struct platform_device *pdev) emc->num_timings); if (err < 0) goto release; + } else { + err = -ENODEV; + goto release; } if (emc->derated) { -- 2.25.1