Skip to contentSkip to conversation

serial: 8250_bcm7271: Fix return value check in brcmuart_probe()

PATCH In review Wei Yongjun 2 participants 2 messages Mar 29, 2021 – Mar 30, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 serial: 8250_bcm7271: Fix return value check in brcmuart_probe()

In case of error, the function devm_ioremap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test.

Fixes 41a469482de2 ("serial: 8250: Add new 8250-core based Broadcom STB driver")
---
 drivers/tty/serial/8250/8250_bcm7271.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/8250/8250_bcm7271.c +2 -2
index 63883185fccd..a4f3f6301d4f 100644
@@ -974,8 +974,8 @@ static int brcmuart_probe(struct platform_device *pdev)
 			break;
 		priv->regs[x] =	devm_ioremap(dev, regs->start,
 					     resource_size(regs));
-		if (IS_ERR(priv->regs[x]))
-			return PTR_ERR(priv->regs[x]);
+		if (!priv->regs[x])
+			return -ENOMEM;
 		if (x == REGS_8250) {
 			mapbase = regs->start;
 			membase = priv->regs[x];
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Wei Yongjun

In case of error, the function devm_ioremap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test.

Fixes 41a469482de2 ("serial: 8250: Add new 8250-core based Broadcom STB driver")
---
 drivers/tty/serial/8250/8250_bcm7271.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)