Skip to contentSkip to conversation

drivers: tty: serial: use devm_ioremap_resource()

PATCH In review Silviu-Mihai Popescu 2 participants 2 messages Apr 11, 2013

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

PATCH 1/1 drivers: tty: serial: use devm_ioremap_resource()

Convert use of devm_request_and_ioremap() to the newly introduced devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit error messages can be removed from the failure code paths.

This was found with coccinelle.

---
 drivers/tty/serial/serial-tegra.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/tty/serial/serial-tegra.c +3 -5
index 372de8a..2080fd7 100644
@@ -1301,11 +1301,9 @@ static int tegra_uart_probe(struct platform_device *pdev)
 	}
 
 	u->mapbase = resource->start;
-	u->membase = devm_request_and_ioremap(&pdev->dev, resource);
-	if (!u->membase) {
-		dev_err(&pdev->dev, "memregion/iomap address req failed\n");
-		return -EADDRNOTAVAIL;
-	}
+	u->membase = devm_ioremap_resource(&pdev->dev, resource);
+	if (IS_ERR(u->membase))
+		return PTR_ERR(u->membase);
 
 	tup->uart_clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(tup->uart_clk)) {
Signature · 1 line
1.7.9.5
#1 lore raw

Re: [PATCH] drivers: tty: serial: tegra: use devm_ioremap_resource()

Quoted 7 lines · Silviu-Mihai Popescu

Convert use of devm_request_and_ioremap() to the newly introduced devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit error messages can be removed from the failure code paths.

This was found with coccinelle.

And it's already in my tree, please always work off of linux-next to avoid doing the same thing that others have done.

sorry,

greg k-h