From patchwork Fri Nov 30 16:05:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 10708329 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3A92414E2 for ; Sun, 2 Dec 2018 21:23:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DAAA29DE0 for ; Sun, 2 Dec 2018 21:23:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 218B029FD9; Sun, 2 Dec 2018 21:23:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CE46529DE0 for ; Sun, 2 Dec 2018 21:23:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 716EA89D7F; Sun, 2 Dec 2018 21:23:30 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 919626E625 for ; Fri, 30 Nov 2018 16:05:15 +0000 (UTC) Received: by mail-lj1-x244.google.com with SMTP id e5-v6so5462165lja.4 for ; Fri, 30 Nov 2018 08:05:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=1Q6OpVlKGi2rNqRFLuocPd3nAs+AvtLdb1mSVpc1EnA=; b=EGSpXLsky69Uz7gU1ofI4IYPuwoTkPmXomK/IaFMmjnOK2PNItJqfSsnXraxvmwLEn G7gLOlUOQfsiZc0N4ygC8Q3YTzckXeE0EXGnvT8L8PV9uwwu5Zr/DLEFbPI4s3HiRgO0 fxA34PyP467piwB01iPKE/YmXedYW7VLIgH8hSA9OwIvsSOOVk6v7HcmEjdW7Wy/sInj rh7yAHtMB3KFIeqczoKOg7iudeIQPslilXIJ4fA6goSqZ2XlTosLXBSOx6cDsJw6wLfv A6mHUBXqrJXSwn1NDz6n3OFuaI+C66/UxvjH62jImzGV7NT6kbgTpgIU9fdTrEm00k2g 8CTA== X-Gm-Message-State: AA+aEWYohq5//Cw5CmrP0IO5QsIbGAF8m6ZRYKTfvzzbZxiIEqUXskK/ eSvd9F5oJITq2LYro6+UQQt6dg== X-Google-Smtp-Source: AFSGD/X6Lm1WS5hC8lqISP4G+FznzWxMvIBnP2h2EOCLz3/i4IaSqq3+7YUOt1dFf9VbYgX8c4dB4Q== X-Received: by 2002:a2e:5418:: with SMTP id i24-v6mr4603769ljb.51.1543593913761; Fri, 30 Nov 2018 08:05:13 -0800 (PST) Received: from localhost (c-732171d5.07-21-73746f28.bbcust.telenor.se. [213.113.33.115]) by smtp.gmail.com with ESMTPSA id d82sm889847lfd.82.2018.11.30.08.05.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 08:05:13 -0800 (PST) From: Anders Roxell To: airlied@linux.ie, wens@csie.org Subject: [PATCH] drm/sun4i: tcon: fix false-positive uninitialized build warning Date: Fri, 30 Nov 2018 17:05:08 +0100 Message-Id: <20181130160508.28230-1-anders.roxell@linaro.org> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 02 Dec 2018 21:23:01 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , Anders Roxell , linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Arnd Bergmann Signed-off-by: Anders Roxell --- 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;