Commit dc824ebe authored by Jon Ringle's avatar Jon Ringle Committed by Greg Kroah-Hartman

serial: sc16is7xx: Correct initialization of s->clk

The s->clk never gets setup in sc16is7xx_probe() and instead was using a
local clk variable, but then testing the uninitialized s->clk during
teardown
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarJon Ringle <jringle@gridpoint.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c8ed99d4
...@@ -1060,7 +1060,6 @@ static int sc16is7xx_probe(struct device *dev, ...@@ -1060,7 +1060,6 @@ static int sc16is7xx_probe(struct device *dev,
struct regmap *regmap, int irq, unsigned long flags) struct regmap *regmap, int irq, unsigned long flags)
{ {
unsigned long freq, *pfreq = dev_get_platdata(dev); unsigned long freq, *pfreq = dev_get_platdata(dev);
struct clk *clk;
int i, ret; int i, ret;
struct sc16is7xx_port *s; struct sc16is7xx_port *s;
...@@ -1076,14 +1075,14 @@ static int sc16is7xx_probe(struct device *dev, ...@@ -1076,14 +1075,14 @@ static int sc16is7xx_probe(struct device *dev,
return -ENOMEM; return -ENOMEM;
} }
clk = devm_clk_get(dev, NULL); s->clk = devm_clk_get(dev, NULL);
if (IS_ERR(clk)) { if (IS_ERR(s->clk)) {
if (pfreq) if (pfreq)
freq = *pfreq; freq = *pfreq;
else else
return PTR_ERR(clk); return PTR_ERR(s->clk);
} else { } else {
freq = clk_get_rate(clk); freq = clk_get_rate(s->clk);
} }
s->regmap = regmap; s->regmap = regmap;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment