mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 21:38:32 +08:00
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: Vladimir Zapolskiy <vz@mleia.com>
Fixes: 3a9f595702
("pwm: Add Broadcom BCM7038 PWM controller support")
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
This commit is contained in:
parent
03d99531ae
commit
c5857e3f94
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user