Skip to contentSkip to conversation

serial: fsl_lpuart: Remove unneeded check for 'res'

PATCH In review Fabio Estevam 2 participants 4 messages Nov 7, 2014 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 serial: fsl_lpuart: Remove unneeded check for 'res'

From: Fabio Estevam <[email protected]>

'res' will be automatically checked inside devm_ioremap_resource(), so there is no need to explicitly perform a NULL check.

---
 drivers/tty/serial/fsl_lpuart.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/tty/serial/fsl_lpuart.c +2 -4
index 6dd53af..567d0ad 100644
@@ -1786,15 +1786,13 @@ static int lpuart_probe(struct platform_device *pdev)
 	}
 	sport->port.line = ret;
 	sport->lpuart32 = of_device_is_compatible(np, "fsl,ls1021a-lpuart");
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res)
-		return -ENODEV;
 
-	sport->port.mapbase = res->start;
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	sport->port.membase = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(sport->port.membase))
 		return PTR_ERR(sport->port.membase);
 
+	sport->port.mapbase = res->start;
 	sport->port.dev = &pdev->dev;
 	sport->port.type = PORT_LPUART;
 	sport->port.iotype = UPIO_MEM;
Signature · 1 line
1.9.1
#1 lore raw

PATCH 2/2 serial: fsl_lpuart: Remove unneeded registration message

From: Fabio Estevam <[email protected]>

There is no real value in displaying "serial: Freescale lpuart driver" in every boot.

The uart_register_driver() can fail and even so the "serial: Freescale lpuart driver" will be displayed, which is not really helpful.

This is particularly annoying when booting multi_v7_defconfig kernel on a SoC that is not a Vybrid/Layerscape and even though this message gets displayed.

---
 drivers/tty/serial/fsl_lpuart.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/tty/serial/fsl_lpuart.c +1 -4
index 567d0ad..08c8651 100644
@@ -1882,11 +1882,8 @@ static struct platform_driver lpuart_driver = {
 
 static int __init lpuart_serial_init(void)
 {
-	int ret;
-
-	pr_info("serial: Freescale lpuart driver\n");
+	int ret = uart_register_driver(&lpuart_reg);
 
-	ret = uart_register_driver(&lpuart_reg);
 	if (ret)
 		return ret;
 
Signature · 1 line
1.9.1
Acked-by on v1 2/2
#2 lore raw

RE: [PATCH 2/2] serial: fsl_lpuart: Remove unneeded registration message

Quoted 14 lines

-----Original Message-----
From: Fabio Estevam [mailto:[email protected]]
Sent: Friday, November 07, 2014 10:23 AM
To: [email protected]
Cc: Lu Jingchang-B35083; [email protected]; Estevam Fabio- R49496
Subject: [PATCH 2/2] serial: fsl_lpuart: Remove unneeded registration message

From: Fabio Estevam <[email protected]>

There is no real value in displaying "serial: Freescale lpuart driver" in every boot.

Quoted 8 lines

The uart_register_driver() can fail and even so the "serial: Freescale lpuart driver" will be displayed, which is not really helpful.

This is particularly annoying when booting multi_v7_defconfig kernel on a SoC that is not a Vybrid/Layerscape and even though this message gets displayed.

Quoted 22 lines

---
drivers/tty/serial/fsl_lpuart.c | 5 +----

1 file changed, 1 insertion(+), 4 deletions(-)
(quoted diff) +0 -0

b/drivers/tty/serial/fsl_lpuart.c index 567d0ad..08c8651 100644

drivers/tty/serial/fsl_lpuart.c +1 -5
@@ -1882,11 +1882,8 @@ static struct platform_driver lpuart_driver = {
 
 static int __init lpuart_serial_init(void)  {
-	int ret;
-
-	pr_info("serial: Freescale lpuart driver\n");
+	int ret = uart_register_driver(&lpuart_reg);
 
-	ret = uart_register_driver(&lpuart_reg);
 	if (ret)
 		return ret;
 
--

1.9.1

Acked-by on v1 1/2
#3 lore raw
In reply to Fabio Estevam
Quoted 8 lines

-----Original Message-----
From: Fabio Estevam [mailto:[email protected]]
Sent: Friday, November 07, 2014 10:23 AM
To: [email protected]
Cc: Lu Jingchang-B35083; [email protected]; Estevam Fabio- R49496
Subject: [PATCH 1/2] serial: fsl_lpuart: Remove unneeded check for 'res'

Quoted 7 lines

From: Fabio Estevam <[email protected]>

'res' will be automatically checked inside devm_ioremap_resource(), so there is
no need to explicitly perform a NULL check.

Quoted 30 lines

---
drivers/tty/serial/fsl_lpuart.c | 6 ++----

1 file changed, 2 insertions(+), 4 deletions(-)
drivers/tty/serial/fsl_lpuart.c +2 -4
index 6dd53af..567d0ad 100644
@@ -1786,15 +1786,13 @@ static int lpuart_probe(struct platform_device
 *pdev)
 	}
 	sport->port.line = ret;
 	sport->lpuart32 = of_device_is_compatible(np, "fsl,ls1021a-lpuart");
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res)
-		return -ENODEV;
 
-	sport->port.mapbase = res->start;
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	sport->port.membase = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(sport->port.membase))
 		return PTR_ERR(sport->port.membase);
 
+	sport->port.mapbase = res->start;
 	sport->port.dev = &pdev->dev;
 	sport->port.type = PORT_LPUART;
	sport->port.iotype = UPIO_MEM;

--
1.9.1