linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: jon@ringle.org
To: gregkh@linuxfoundation.org, linux-serial@vger.kernel.org,
	dan.carpenter@oracle.com
Cc: Jon Ringle <jringle@gridpoint.com>
Subject: [PATCH] serial: sc16is7xx: Correct initialization of s->clk
Date: Fri, 25 Jul 2014 13:53:36 -0400	[thread overview]
Message-ID: <1406310816-32094-1-git-send-email-jon@ringle.org> (raw)

From: Jon Ringle <jringle@gridpoint.com>

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: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jon Ringle <jringle@gridpoint.com>
---
 drivers/tty/serial/sc16is7xx.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index ed139f5..a0a2295 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -1061,7 +1061,6 @@ static int sc16is7xx_probe(struct device *dev,
 			   struct regmap *regmap, int irq, unsigned long flags)
 {
 	unsigned long freq, *pfreq = dev_get_platdata(dev);
-	struct clk *clk;
 	int i, ret;
 	struct sc16is7xx_port *s;
 
@@ -1077,14 +1076,14 @@ static int sc16is7xx_probe(struct device *dev,
 		return -ENOMEM;
 	}
 
-	clk = devm_clk_get(dev, NULL);
-	if (IS_ERR(clk)) {
+	s->clk = devm_clk_get(dev, NULL);
+	if (IS_ERR(s->clk)) {
 		if (pfreq)
 			freq = *pfreq;
 		else
-			return PTR_ERR(clk);
+			return PTR_ERR(s->clk);
 	} else {
-		freq = clk_get_rate(clk);
+		freq = clk_get_rate(s->clk);
 	}
 
 	s->regmap = regmap;
-- 
1.8.5.4


                 reply	other threads:[~2014-07-25 17:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1406310816-32094-1-git-send-email-jon@ringle.org \
    --to=jon@ringle.org \
    --cc=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jringle@gridpoint.com \
    --cc=linux-serial@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).