From patchwork Fri Mar 8 01:20:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 10844107 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 558EF14DE for ; Fri, 8 Mar 2019 02:38:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 428002F2FD for ; Fri, 8 Mar 2019 02:38:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 25FF42F309; Fri, 8 Mar 2019 02:38:18 +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_ADSP_CUSTOM_MED, FREEMAIL_FROM,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 E363F2F2FD for ; Fri, 8 Mar 2019 02:38:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 862BD6E281; Fri, 8 Mar 2019 02:38:04 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by gabe.freedesktop.org (Postfix) with ESMTPS id 632146E244; Fri, 8 Mar 2019 01:21:38 +0000 (UTC) Received: by mail-ed1-x544.google.com with SMTP id g9so15100974eds.3; Thu, 07 Mar 2019 17:21:38 -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=3e8r997SVj6Bk98fluLQ6Q9vfMzZl7RrRmp0X+vjVzU=; b=FfmCW01RMwyrAm7CNh5fpu+LP+BGw2qIhCsBMtL0cOzzISgLXs+Dq4MALzvMdQ+isi EoDGhIZXVML29rKQDio+lSHmijhxC45bk+2pIATngP/9KnN7or5dtPnGYrJiibA1DbDf N2zGPmyL5XH1daGbdiOhrzQ8cBZBaQ0++nEtdAyHv1m4362BAFjumJVhThWGqtteQflT 4l8ir3Pq/A7GKeWGYYZHFBtRaD4M41JwBm6oMIekTRArwx7v0jbHebVTkmywpn1XBamD 0wUBNPW3L53WIeyVELFFLbnXVkQLWF88Iildz15cBAJr+Dvu338BKWNiX34DV5S8RKQa ReZg== X-Gm-Message-State: APjAAAXNgubRfO0DmTCB5VGAAnevg8nr0ty3rnSAFLfwKDysQq3O+if0 QSoTx4YrcXeJ/n7kxHJKvTo= X-Google-Smtp-Source: APXvYqxf+zp1nno8wAmnvDbzj8mMrJ/KVm6GzTIdbm4o0QRFtEMNErFxFGoSg/uZBTxEBCqLH0GBWg== X-Received: by 2002:a17:906:6c93:: with SMTP id s19mr9875481ejr.155.1552008096785; Thu, 07 Mar 2019 17:21:36 -0800 (PST) Received: from localhost.localdomain ([2a01:4f9:2a:1fae::2]) by smtp.gmail.com with ESMTPSA id z42sm1813862edd.29.2019.03.07.17.21.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Mar 2019 17:21:36 -0800 (PST) From: Nathan Chancellor To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi Subject: [PATCH] drm/i915: Zero initialize this_cpu in busywait_stop Date: Thu, 7 Mar 2019 18:20:24 -0700 Message-Id: <20190308012023.5709-1-natechancellor@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Patchwork-Bot: notify X-Mailman-Approved-At: Fri, 08 Mar 2019 02:37:58 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3e8r997SVj6Bk98fluLQ6Q9vfMzZl7RrRmp0X+vjVzU=; b=KYa66Co4GwvcTRTys0OiuDHP7xrLPX7fW76XpBeNr3jRv4gpJWq/5gmAlDTWQec2kw 9t+hDL7OTpvagXdWHAIi0zvvBSQxWY7DjSL5xkVegjWv+qLAGJAVsDGS4pgP6RCU1mDw YG3z25M4YLUMuVEgtFFgC8kxltLCMk4FiWzdlmgquqvO9NRX0yHyOF2fwERVVeqNAMLj vyKutxCQ/1tY/hy8PrfmJaP/oFx9FcJv1AizMNjMShAzmC8KEP9m30rb98AEHMyjiCmE VDwN5cR3PYJooewThPaKWFDoAR+e+cAQ0LULbknfIS2/t084SFGNjBXK97vncj600JNW tA7g== 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: intel-gfx@lists.freedesktop.org, Nick Desaulniers , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, clang-built-linux@googlegroups.com, Nathan Chancellor Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP When building with -Wsometimes-uninitialized, Clang warns: drivers/gpu/drm/i915/i915_request.c:1032:6: warning: variable 'this_cpu' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized] time_after expands to use two typecheck with logical ANDs between them. typecheck evaluates to 1 but Clang clearly gets confused with the logic that as semantic analysis happens early in the pipeline. Fix this by just zero initializing this_cpu as it will always be properly initialized before the comparison below. Link: https://github.com/ClangBuiltLinux/linux/issues/415 Signed-off-by: Nathan Chancellor --- Alternatively, this can be solved by having the return value of local_clock_us(&this_cpu) be a local variable but this seems less controversial. drivers/gpu/drm/i915/i915_request.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c index c2a5c48c7541..06c0c952191f 100644 --- a/drivers/gpu/drm/i915/i915_request.c +++ b/drivers/gpu/drm/i915/i915_request.c @@ -1027,7 +1027,7 @@ static unsigned long local_clock_us(unsigned int *cpu) static bool busywait_stop(unsigned long timeout, unsigned int cpu) { - unsigned int this_cpu; + unsigned int this_cpu = 0; if (time_after(local_clock_us(&this_cpu), timeout)) return true;