Skip to contentSkip to conversation

serial8250-em: clk_get() IS_ERR() error handling fix

PATCH New Magnus Damm 1 participant 1 message May 9, 2012

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

PATCH 1/1 serial8250-em: clk_get() IS_ERR() error handling fix

From: Magnus Damm <[email protected]>

Update the 8250_em driver to correctly handle the case where no clock is associated with the device.

The return value of clk_get() needs to be checked with IS_ERR() to avoid NULL pointer referencing.

---

Applies of top of "[PATCH] serial8250-em: Emma Mobile UART driver V2" included in linux-next 20120508.

 drivers/tty/serial/8250/8250_em.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/tty/serial/8250/8250_em.c +2 -1
@@ -110,8 +110,9 @@ static int __devinit serial8250_em_probe
 	}
 
 	priv->sclk = clk_get(&pdev->dev, "sclk");
-	if (!priv->sclk) {
+	if (IS_ERR(priv->sclk)) {
 		dev_err(&pdev->dev, "unable to get clock\n");
+		ret = PTR_ERR(priv->sclk);
 		goto err1;
 	}