From: Stefan Potyra Date: Tue, 24 Apr 2018 16:03:47 +0000 (+0200) Subject: sc16is7xx: Check for an error when the clock is enabled. X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=e76785d092ab8356d24996754f0ff1917021fcb6;p=linux.git sc16is7xx: Check for an error when the clock is enabled. When the clock is enabled, check if there is an error. Otherwise clk_get_rate() can be called without enabled clock. Found by Linux Driver Verification project (linuxtesting.org). Fixes: 0814e8d5da2b ("sc16is7xx: enable the clock") Signed-off-by: Stefan Potyra Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 65792a3539d0c..243c960250530 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1168,7 +1168,10 @@ static int sc16is7xx_probe(struct device *dev, else return PTR_ERR(s->clk); } else { - clk_prepare_enable(s->clk); + ret = clk_prepare_enable(s->clk); + if (ret) + return ret; + freq = clk_get_rate(s->clk); }