linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anders Roxell <anders.roxell@linaro.org>
To: airlied@linux.ie, wens@csie.org
Cc: dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Anders Roxell <anders.roxell@linaro.org>,
	Arnd Bergmann <arnd@arndb.de>
Subject: [PATCH] drm/sun4i: tcon: fix false-positive uninitialized build warning
Date: Fri, 30 Nov 2018 17:05:08 +0100	[thread overview]
Message-ID: <20181130160508.28230-1-anders.roxell@linaro.org> (raw)

With GCC version 5 and 6, this uninitialized warning can be seen.
GCC have been fixed in newer versions.

drivers/gpu/drm/sun4i/sun4i_tcon.c: In function ‘sun4i_tcon_bind’:
drivers/gpu/drm/sun4i/sun4i_tcon.c:1091:21: warning: ‘has_lvds_alt’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  bool has_lvds_rst, has_lvds_alt, can_lvds;
                     ^~~~~~~~~~~~

Reworked the code so it covers that false positive also.

Co-developed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index 0420f5c978b9..317d4fa3429c 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -1161,20 +1161,20 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
 		 */
 		if (tcon->quirks->has_lvds_alt) {
 			tcon->lvds_pll = devm_clk_get(dev, "lvds-alt");
-			if (IS_ERR(tcon->lvds_pll)) {
-				if (PTR_ERR(tcon->lvds_pll) == -ENOENT) {
-					has_lvds_alt = false;
-				} else {
-					dev_err(dev, "Couldn't get the LVDS PLL\n");
-					return PTR_ERR(tcon->lvds_pll);
-				}
+			ret = PTR_ERR_OR_ZERO(tcon->lvds_pll);
+			if (ret == -ENOENT) {
+				has_lvds_alt = false;
+			} else if (ret) {
+				dev_err(dev, "Couldn't get the LVDS PLL\n");
+				return ret;
 			} else {
 				has_lvds_alt = true;
 			}
+		} else  {
+			has_lvds_alt = false;
 		}
 
-		if (!has_lvds_rst ||
-		    (tcon->quirks->has_lvds_alt && !has_lvds_alt)) {
+		if (!has_lvds_rst || !has_lvds_alt) {
 			dev_warn(dev, "Missing LVDS properties, Please upgrade your DT\n");
 			dev_warn(dev, "LVDS output disabled\n");
 			can_lvds = false;
-- 
2.19.1


                 reply	other threads:[~2018-11-30 16:05 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=20181130160508.28230-1-anders.roxell@linaro.org \
    --to=anders.roxell@linaro.org \
    --cc=airlied@linux.ie \
    --cc=arnd@arndb.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wens@csie.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).