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: 10706693 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 EF1D513B0 for ; Fri, 30 Nov 2018 16:05:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEB942F952 for ; Fri, 30 Nov 2018 16:05:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D0FFB302F8; Fri, 30 Nov 2018 16:05:31 +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,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 75BF1301B7 for ; Fri, 30 Nov 2018 16:05:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=jkECi9u6NdN93kTQzw4lJgW8CzJZk5RRyHcAnFIPCdA=; b=sR6xxP4qMS3lFi Y1lBJitVtvTve38occq81Ng43n2lCtaczzjyzPtyXFzPPRmqMeCv0/m2KAAEyXd+znQclXSfVLKws lu8HRhea1I9bvLOKMG/d9gcFF6adpg4jvQXHJtvvEaE6y8YR+QREcaxrVlHSrdUzEsJN9juGpVw9R AAPOCRHqgDBogEsan6zujGLBAJQxhKaRNezM7ZeqhtJWyFeE+iLzoOwm4Fciu6o7pR+HZkQaYfSAW 3ofPMfz37ZD/a6/G1hSMdSFz9vv+59zjZYhKVhBxnczmn0aOir8AH2raT2qDGDzk99j3nQFVKTAZJ dExyXnrU3jUR/iaSaA9Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gSlIG-0005Vl-Ny; Fri, 30 Nov 2018 16:05:28 +0000 Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gSlIE-0005UU-3k for linux-arm-kernel@lists.infradead.org; Fri, 30 Nov 2018 16:05:27 +0000 Received: by mail-lj1-x243.google.com with SMTP id v15-v6so5420850ljh.13 for ; Fri, 30 Nov 2018 08:05:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=1Q6OpVlKGi2rNqRFLuocPd3nAs+AvtLdb1mSVpc1EnA=; b=IYtMXcvPk8+BDvFq2Q2tdfg9Rwd44S3kfp4mU1Z7O5P4HmDpKH50HnwftrxRChC9gr mcU1/XKs8lU+B9cy8BpheN343aEDbGBg/tacXx6uGRLOseXTUuY0b7lYcS0Fx+gVGlwL d/cW/S16Pw9BcKsfNY65nlIt7i8S53wbk7zoA= 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=nyRoiLir62UBB1Bg4o2vG89A2JUcdaCgtlVm6QuHZ4iPPyVn78eEk7/0JiGHh2/ppm MvOpK/cpTHcGt+4xalUY24S7ah1u09yyOU0DYCEJ17P877vLrjkm4vrr+LR9LtFnnwBe +fvUxEpXpaKR9D5nt8sW6H9T7Jv9gVDL2qXZp449iWLIOJ2gJi+dV9rDligjwiJ782km cWpIjYnNCtjBd2ienq7RUTcRzIJc/WioX4VLxFbatg1ZJz6PWjwpuTiEj7JMAEGwkRN5 f9AiXLTiiexXAtbJ5fdP2jJOxgC9LveHw5NpeWxOFdekae1zK/2jyV6rrB82VNJaAJGN yzTQ== X-Gm-Message-State: AA+aEWb0eWlSsD/rc1JNX5RiOx+tTBOEOcyX4MIaRsjVFG3WKjPBJrFT jTQNOMmUa8s/HTqDaMalPShfYwnc8zmUMg== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181130_080526_152826_78336AB4 X-CRM114-Status: GOOD ( 14.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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;