watchdog: Orion: Fix possible null-deference in orion_wdt_probe

If the DT does not include a regs parameter then the null res
would be dereferenced.

Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
This commit is contained in:
Jason Gunthorpe 2012-12-07 15:44:46 -07:00 committed by Wim Van Sebroeck
parent 740fbddf5c
commit 8c4c419ca3
1 changed files with 2 additions and 0 deletions

View File

@ -156,6 +156,8 @@ static int orion_wdt_probe(struct platform_device *pdev)
wdt_tclk = clk_get_rate(clk);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
return -ENODEV;
wdt_reg = devm_ioremap(&pdev->dev, res->start, resource_size(res));
if (!wdt_reg)
return -ENOMEM;