Skip to contentSkip to conversation

tty: serial: vt8500: fix return value check in vt8500_serial_probe()

PATCH New Wei Yongjun 2 participants 2 messages Dec 2, 2012

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

PATCH 1/1 tty: serial: vt8500: fix return value check in vt8500_serial_probe()

From: Wei Yongjun <[email protected]>

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

---
 drivers/tty/serial/vt8500_serial.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/vt8500_serial.c +1 -1
index 205d4cf..f528cc2 100644
@@ -604,7 +604,7 @@ static int __devinit vt8500_serial_probe(struct platform_device *pdev)
 	vt8500_port->uart.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF;
 
 	vt8500_port->clk = of_clk_get(pdev->dev.of_node, 0);
-	if (vt8500_port->clk) {
+	if (!IS_ERR(vt8500_port->clk)) {
 		vt8500_port->uart.uartclk = clk_get_rate(vt8500_port->clk);
 	} else {
 		/* use the default of 24Mhz if not specified and warn */
#1 lore raw

PATCH 1/1 tty: serial: vt8500: fix return value check in vt8500_serial_probe()

Quoted 17 lines · Wei Yongjun

From: Wei Yongjun <[email protected]>

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

---
 drivers/tty/serial/vt8500_serial.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/vt8500_serial.c +0 -0
index 205d4cf..f528cc2 100644

drivers/tty/serial/vt8500_serial.c static int __devinit vt8500_serial_probe(struct platform_device *pdev) · line 610

Quoted 8 lines
drivers/tty/serial/vt8500_serial.c +1 -1
@@ -604,7 +604,7 @@ static int __devinit vt8500_serial_probe(struct platform_device *pdev)
 	vt8500_port->uart.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF;
 
 	vt8500_port->clk = of_clk_get(pdev->dev.of_node, 0);
-	if (vt8500_port->clk) {
+	if (!IS_ERR(vt8500_port->clk)) {
 		vt8500_port->uart.uartclk = clk_get_rate(vt8500_port->clk);
 	} else {
 		/* use the default of 24Mhz if not specified and warn */