Skip to contentSkip to conversation

Patch "pwm: brcmstb: Fix check of devm_ioremap_resource() return code" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message May 1, 2016

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

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

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
pwm-brcmstb-fix-check-of-devm_ioremap_resource-return-code.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From c5857e3f94ab2719dfac649a146cb5dd6f21fcf3 Mon Sep 17 00:00:00 2001

From: Vladimir Zapolskiy <[email protected]>
Date: Sun, 6 Mar 2016 03:21:46 +0200
Subject: pwm: brcmstb: Fix check of devm_ioremap_resource() return code

From: Vladimir Zapolskiy <[email protected]>

commit c5857e3f94ab2719dfac649a146cb5dd6f21fcf3 upstream.

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.

Fixes 3a9f5957020f ("pwm: Add Broadcom BCM7038 PWM controller support")
---
 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 plat
 
 	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;
 	}
 

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/pwm-brcmstb-fix-check-of-devm_ioremap_resource-return-code.patch