From patchwork Tue Jan 16 14:57:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10167319 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BEB09600CA for ; Tue, 16 Jan 2018 14:57:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF6D428567 for ; Tue, 16 Jan 2018 14:57:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A3C8F285B0; Tue, 16 Jan 2018 14:57:28 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham 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 0F07328567 for ; Tue, 16 Jan 2018 14:57:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9B63389C08; Tue, 16 Jan 2018 14:57:25 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.135]) by gabe.freedesktop.org (Postfix) with ESMTPS id BFE8C89C08 for ; Tue, 16 Jan 2018 14:57:23 +0000 (UTC) Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue002 [212.227.15.129]) with ESMTPA (Nemesis) id 0M0H6r-1eqFsC09uP-00ube0; Tue, 16 Jan 2018 15:57:21 +0100 From: Arnd Bergmann To: Patrik Jakobsson , David Airlie Subject: [PATCH] [RESEND] drm/gma500: initialize gma_clock_t structures Date: Tue, 16 Jan 2018 15:57:10 +0100 Message-Id: <20180116145720.2348043-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:P/KFwj9Gg650HWYC6sH5JDddZxLPAU9wzvF9otjaO0jWKmPmb0Y 0Om7MmJINY1UGm/QUqcAtPhMpfm1dvS4XYiIpDfr4C32oDX04FQ1r/M69G8DT3y6MWSV1I2 xxL88So0hnvEcxzTHhSvxTHCt0a6vif981ZUWyCf2dhg3ovBpcDSYqow6LpL1ZqFJTYGtSM hGC4D2Bh01LVBhKACY6Ng== X-UI-Out-Filterresults: notjunk:1; V01:K0:juOakUkU7Es=:37Mh6ANXWfxB4uV0S4nPBI GUnzqjMmArk+smCwkFLfgmfqidCqIbqlCo1E0EK2HPmoVcQLsp9RULo0IcdTbOjh85Ao0CkjV oc5uXBfAVEBueZGBtACkVJ4J1upn71yC+W2j5SnBl4VRmqfBwSmwFhP0sw7BDbhZ4KGjY+8WT PctlgTSrpoxPKKiMefjqiz7roIup4Lee2MVqoby4SN4j1DTYTdYNhQ64beeCQ9sp552SoE/my WnQ0Eyi0ZVNIoUI+c/kHvvmN9lkjinHyVkTlAf84B4sWHxRJbsEEfE/pHvMeki2GgTRJfjaQJ eDE+peg740R/hVTPvugb6MDjanlzdtI2wGexLXzX6ckffOpExa/3P9+9eAd18FyNDMY6tKqub Ba3v2sbKQRp3C21+T5/BWndDWzzK/fI+Chk0bcAbE28Nipn24o919ITUupUa2esuiPm8sL8TX wIWHrjWSDio8S8mk0azintJgGexzUr5HTT9YY7pR+nTQ6DeOONcwN2xKo39FbmhO0qM17aeLt yzAb6a4BJTJk11jl7+LEtFpJ6RwUIt2XFO4Ch/QlgeYYnFvINUf6SRcpccMdFHVrJf1g8T4HF hwyOvFPtC5/a8d0hd4b5FQpRBEMAh1yYYIsCmhcD7ScCFu1wTjZalORGGpHlaXCeZxfCs0TxN vNoMSzKZtEEbB4IUkk9D4Yp2Qy///d03MkQTkA4vDMXBKt2cIMsFKjp/Jmb1XsJ9iDi1z/OP1 WSDElG5ltTw1c/I5C/UaNhz9YjKmPUJNhZGtjg== Cc: dri-devel@lists.freedesktop.org, Arnd Bergmann , linux-kernel@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The two functions pass a partially initialized structure back to the caller after a memset() on the destination. This is not entirely well-defined, most compilers are sensible enough to either keep the zero-initialization for the uninitialized members, but gcc-4.4 does not, and it warns about this: drivers/gpu/drm/gma500/oaktrail_crtc.c: In function 'mrst_sdvo_find_best_pll': drivers/gpu/drm/gma500/oaktrail_crtc.c:175: warning: 'clock.vco' may be used uninitialized in this function drivers/gpu/drm/gma500/oaktrail_crtc.c:175: warning: 'clock.dot' may be used uninitialized in this function drivers/gpu/drm/gma500/oaktrail_crtc.c:175: warning: 'clock.p2' may be used uninitialized in this function drivers/gpu/drm/gma500/oaktrail_crtc.c:175: warning: 'clock.m2' may be used uninitialized in this function drivers/gpu/drm/gma500/oaktrail_crtc.c:175: warning: 'clock.m1' may be used uninitialized in this function drivers/gpu/drm/gma500/oaktrail_crtc.c: In function 'mrst_lvds_find_best_pll': drivers/gpu/drm/gma500/oaktrail_crtc.c:208: warning: 'clock.p' may be used uninitialized in this function drivers/gpu/drm/gma500/oaktrail_crtc.c:208: warning: 'clock.vco' may be used uninitialized in this function drivers/gpu/drm/gma500/oaktrail_crtc.c:208: warning: 'clock.p2' may be used uninitialized in this function drivers/gpu/drm/gma500/oaktrail_crtc.c:208: warning: 'clock.m2' may be used uninitialized in this function drivers/gpu/drm/gma500/oaktrail_crtc.c:208: warning: 'clock.m1' may be used uninitialized in this function drivers/gpu/drm/gma500/oaktrail_crtc.c:208: warning: 'clock.n' may be used uninitialized in this function This adds an initialization at declaration time to avoid the warning and make it well-defined on all compiler versions. Signed-off-by: Arnd Bergmann Reviewed-by: Patrik Jakobsson --- Originally submitted on Sep 15, 2017, but got no reply. Resending unchanged. --- drivers/gpu/drm/gma500/oaktrail_crtc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/gma500/oaktrail_crtc.c b/drivers/gpu/drm/gma500/oaktrail_crtc.c index 0fff269d3fe6..b49fe79c3f44 100644 --- a/drivers/gpu/drm/gma500/oaktrail_crtc.c +++ b/drivers/gpu/drm/gma500/oaktrail_crtc.c @@ -134,7 +134,7 @@ static bool mrst_sdvo_find_best_pll(const struct gma_limit_t *limit, struct drm_crtc *crtc, int target, int refclk, struct gma_clock_t *best_clock) { - struct gma_clock_t clock; + struct gma_clock_t clock = {}; u32 target_vco, actual_freq; s32 freq_error, min_error = 100000; @@ -191,7 +191,7 @@ static bool mrst_lvds_find_best_pll(const struct gma_limit_t *limit, struct drm_crtc *crtc, int target, int refclk, struct gma_clock_t *best_clock) { - struct gma_clock_t clock; + struct gma_clock_t clock = {}; int err = target; memset(best_clock, 0, sizeof(*best_clock));