Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist/drm/amd/amdgpu Rearrange code in ...



details:   https://anonhg.NetBSD.org/src/rev/03279aac83c9
branches:  trunk
changeset: 997132:03279aac83c9
user:      kamil <kamil%NetBSD.org@localhost>
date:      Sat Feb 23 19:56:51 2019 +0000

description:
Rearrange code in amdgpu_display.c to prevent build error

GCC reports that stat can be uninitialized when used, prevent this with
changing the construction of the code a little bit.

Keep original indent in order to not generate diff with upstream.

Solution suggested by <mrg>

Detected with GCC7 when building NetBSD/i386 with kUBSan.

diffstat:

 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_display.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (36 lines):

diff -r af8ae71bc919 -r 03279aac83c9 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_display.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_display.c        Sat Feb 23 19:37:36 2019 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_display.c        Sat Feb 23 19:56:51 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_display.c,v 1.4 2018/08/27 15:22:54 riastradh Exp $     */
+/*     $NetBSD: amdgpu_display.c,v 1.5 2019/02/23 19:56:51 kamil Exp $ */
 
 /*
  * Copyright 2007-8 Advanced Micro Devices, Inc.
@@ -26,7 +26,7 @@
  *          Alex Deucher
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_display.c,v 1.4 2018/08/27 15:22:54 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_display.c,v 1.5 2019/02/23 19:56:51 kamil Exp $");
 
 #include <drm/drmP.h>
 #include <drm/amdgpu_drm.h>
@@ -101,7 +101,8 @@
         * In practice this won't execute very often unless on very fast
         * machines because the time window for this to happen is very small.
         */
-       while (amdgpuCrtc->enabled && --repcnt) {
+       if (amdgpuCrtc->enabled) {
+       while (--repcnt) {
                /* GET_DISTANCE_TO_VBLANKSTART returns distance to real vblank
                 * start in hpos, and to the "fudged earlier" vblank start in
                 * vpos.
@@ -134,6 +135,7 @@
                                 "hpos %d\n", work->crtc_id, min_udelay,
                                 vblank->framedur_ns / 1000,
                                 vblank->linedur_ns / 1000, stat, vpos, hpos);
+       }
 
        /* do the flip (mmio) */
        adev->mode_info.funcs->page_flip(adev, work->crtc_id, work->base);



Home | Main Index | Thread Index | Old Index