Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751965AbeAQI1R (ORCPT + 1 other); Wed, 17 Jan 2018 03:27:17 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:46340 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750806AbeAQI1Q (ORCPT ); Wed, 17 Jan 2018 03:27:16 -0500 X-Google-Smtp-Source: ACJfBosz9zyUhveaxV1sCBpoKkb5twBD2O/Gw8+OhHFL6Oxqg8G+WhUEcL/lcLDAMIIEmWII/bFliw== Date: Wed, 17 Jan 2018 09:27:12 +0100 From: Daniel Vetter To: Arnd Bergmann Cc: Patrik Jakobsson , David Airlie , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] [RESEND] drm/gma500: initialize gma_clock_t structures Message-ID: <20180117082712.GF2759@phenom.ffwll.local> Mail-Followup-To: Arnd Bergmann , Patrik Jakobsson , David Airlie , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20180116145720.2348043-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180116145720.2348043-1-arnd@arndb.de> X-Operating-System: Linux phenom 4.14.0-1-amd64 User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Tue, Jan 16, 2018 at 03:57:10PM +0100, Arnd Bergmann wrote: > 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 Applied to drm-misc-next-fixes for 4.16, thx for your patch. Aside: Still don't want commit rights? :-) Cheers, Daniel > --- > 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)); > -- > 2.9.0 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch