diff options
author | Vladimir Zapolskiy <vz@mleia.com> | 2016-03-06 02:21:46 +0100 |
---|---|---|
committer | Thierry Reding <thierry.reding@gmail.com> | 2016-03-23 17:11:45 +0100 |
commit | c5857e3f94ab2719dfac649a146cb5dd6f21fcf3 (patch) | |
tree | e479810eace5b41648c2783aedf5a20383c5706c /drivers/pwm/pwm-brcmstb.c | |
parent | pwm: rcar: Depend on ARCH_RENESAS instead of ARCH_SHMOBILE (diff) | |
download | linux-c5857e3f94ab2719dfac649a146cb5dd6f21fcf3.tar.xz linux-c5857e3f94ab2719dfac649a146cb5dd6f21fcf3.zip |
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: 3a9f5957020f ("pwm: Add Broadcom BCM7038 PWM controller support")
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'drivers/pwm/pwm-brcmstb.c')
-rw-r--r-- | drivers/pwm/pwm-brcmstb.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pwm/pwm-brcmstb.c b/drivers/pwm/pwm-brcmstb.c index 423ce087cd9c..5d5adee16886 100644 --- a/drivers/pwm/pwm-brcmstb.c +++ b/drivers/pwm/pwm-brcmstb.c @@ -274,8 +274,8 @@ static int brcmstb_pwm_probe(struct platform_device *pdev) res = platform_get_resource(pdev, IORESOURCE_MEM, 0); p->base = devm_ioremap_resource(&pdev->dev, res); - if (!p->base) { - ret = -ENOMEM; + if (IS_ERR(p->base)) { + ret = PTR_ERR(p->base); goto out_clk; } |