Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

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.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Magnus Damm and committed by
Greg Kroah-Hartman
94e792ab 64218087

+2 -1
+2 -1
drivers/tty/serial/8250/8250_em.c
··· 110 110 } 111 111 112 112 priv->sclk = clk_get(&pdev->dev, "sclk"); 113 - if (!priv->sclk) { 113 + if (IS_ERR(priv->sclk)) { 114 114 dev_err(&pdev->dev, "unable to get clock\n"); 115 + ret = PTR_ERR(priv->sclk); 115 116 goto err1; 116 117 } 117 118