xserver master warning fixes

Peter Hutterer peter.hutterer at who-t.net
Wed Dec 3 16:04:42 PST 2008

On Wed, Dec 03, 2008 at 01:29:09PM -0800, Eric Anholt wrote:
> Here's a series of compile warning fixes I came up with while looking at them
> trying to figure out if anything was wrong that broke GLX (fix for that is
> already pushed).  The ddxDevBtn.c one looks like a real bugfix.
> There are a few more that look important
> xf86Xinput.c:654: warning: ‘idev’ may be used uninitialized in this function
> xf86Xinput.c:653: warning: ‘drv’ may be used uninitialized in this function
> I couldn't convince myself that this was just the compiler getting it wrong.

>From 630826662d930a1782a958094cd416fd6355166c Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer at redhat.com>
Date: Thu, 4 Dec 2008 09:47:25 +1000
Subject: [PATCH] xfree86: fix compiler warning (use of uninitialized variable)

drv and idev are only set for SDs, but are only dereferenced for SDs too, so
initializing them to NULL is safe.

Signed-off-by: Peter Hutterer <peter.hutterer at redhat.com>
 hw/xfree86/common/xf86Xinput.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 38fd1ec..6b92acb 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -650,8 +650,8 @@ void
 DeleteInputDeviceRequest(DeviceIntPtr pDev)
     LocalDevicePtr pInfo = (LocalDevicePtr) pDev->public.devicePrivate;
-    InputDriverPtr drv;
-    IDevRec *idev;
+    InputDriverPtr drv = NULL;
+    IDevRec *idev = NULL;
     IDevPtr *it;
     Bool isMaster = pDev->isMaster;


More information about the xorg mailing list