aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Potyra <Stefan.Potyra@elektrobit.com>2018-04-24 12:03:47 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-04-25 08:56:12 -0400
commite76785d092ab8356d24996754f0ff1917021fcb6 (patch)
tree185bd4d2e19b1ea151c9786d5b9edac8ef277a11
parent2468b3e4aa7b2a45443c43fced850965ee8118bd (diff)
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 <Stefan.Potyra@elektrobit.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/serial/sc16is7xx.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index 65792a3539d0..243c96025053 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -1168,7 +1168,10 @@ static int sc16is7xx_probe(struct device *dev,
1168 else 1168 else
1169 return PTR_ERR(s->clk); 1169 return PTR_ERR(s->clk);
1170 } else { 1170 } else {
1171 clk_prepare_enable(s->clk); 1171 ret = clk_prepare_enable(s->clk);
1172 if (ret)
1173 return ret;
1174
1172 freq = clk_get_rate(s->clk); 1175 freq = clk_get_rate(s->clk);
1173 } 1176 }
1174 1177