Commit c5857e3f authored by Vladimir Zapolskiy's avatar Vladimir Zapolskiy Committed by Thierry Reding

pwm: brcmstb: Fix check of devm_ioremap_resource() return code

The change fixes potential oops while accessing iomem on invalid address
if devm_ioremap_resource() fails due to some reason.

The devm_ioremap_resource() function returns ERR_PTR() and never returns
NULL, which makes useless a following check for NULL.
Signed-off-by: default avatarVladimir Zapolskiy <vz@mleia.com>
Fixes: 3a9f5957 ("pwm: Add Broadcom BCM7038 PWM controller support")
Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
parent 03d99531
...@@ -274,8 +274,8 @@ static int brcmstb_pwm_probe(struct platform_device *pdev) ...@@ -274,8 +274,8 @@ static int brcmstb_pwm_probe(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
p->base = devm_ioremap_resource(&pdev->dev, res); p->base = devm_ioremap_resource(&pdev->dev, res);
if (!p->base) { if (IS_ERR(p->base)) {
ret = -ENOMEM; ret = PTR_ERR(p->base);
goto out_clk; goto out_clk;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment