pwm: bcm7038: fix check of error code returned by devm_ioremap_resource()
Subsystems (2)
PATCH 1/1 pwm: bcm7038: fix check of error code returned by devm_ioremap_resource()
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.
--- drivers/pwm/pwm-brcmstb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pwm/pwm-brcmstb.c +2 -2
@@ -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; }
Signature · 1 line
2.1.4
PATCH 1/1 pwm: bcm7038: fix check of error code returned by devm_ioremap_resource()
Le 05/03/2016 17:21, Vladimir Zapolskiy a ?crit :
Quoted 8 lines
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 returnsERR_PTR()and never returns NULL, which makes useless a following check for NULL.Signed-off-by Vladimir Zapolskiy <[email protected]>Fixes 3a9f5957020f ("pwm: Add Broadcom BCM7038 PWM controller support")
Using pwm: brcmstb for the subject might be a better fit to match the filename, but this is bike shedding.
Signature · 1 line
Florian
Thierry Reding
AppliedPATCH 1/1 pwm: bcm7038: fix check of error code returned by devm_ioremap_resource()
In reply to Vladimir ZapolskiyQuoted 11 lines · Vladimir Zapolskiy
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 returnsERR_PTR()and never returns NULL, which makes useless a following check for NULL.Signed-off-by Vladimir Zapolskiy <[email protected]>Fixes 3a9f5957020f ("pwm: Add Broadcom BCM7038 PWM controller support")--- drivers/pwm/pwm-brcmstb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Applied, thanks.
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160307/c15a84f9/attachment.sig>