intel: Clear structs for valgrind
When probing the module, clear structs passed into unknown ioctls to keep valgrind quiet. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
d27c948a43
commit
d6240d197b
|
|
@ -34,6 +34,10 @@ AM_CFLAGS = \
|
|||
@NOWARNFLAGS@ \
|
||||
$(NULL)
|
||||
|
||||
if VALGRIND
|
||||
AM_CFLAGS += $(VALGRIND_CFLAGS)
|
||||
endif
|
||||
|
||||
intel_drv_la_LTLIBRARIES = intel_drv.la
|
||||
intel_drv_la_LDFLAGS = -module -avoid-version
|
||||
intel_drv_ladir = $(moduledir)/drivers
|
||||
|
|
|
|||
|
|
@ -37,8 +37,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <pciaccess.h>
|
||||
|
||||
#include <xorg-server.h>
|
||||
|
|
@ -52,6 +50,16 @@
|
|||
#include <xf86platformBus.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VALGRIND
|
||||
#include <valgrind.h>
|
||||
#include <memcheck.h>
|
||||
#define VG(x) x
|
||||
#else
|
||||
#define VG(x)
|
||||
#endif
|
||||
|
||||
#define VG_CLEAR(s) VG(memset(&s, 0, sizeof(s)))
|
||||
|
||||
#include "intel_driver.h"
|
||||
#include "fd.h"
|
||||
|
||||
|
|
@ -70,11 +78,11 @@ static int __intel_get_device_id(int fd)
|
|||
struct drm_i915_getparam gp;
|
||||
int devid = 0;
|
||||
|
||||
memset(&gp, 0, sizeof(gp));
|
||||
VG_CLEAR(gp);
|
||||
gp.param = I915_PARAM_CHIPSET_ID;
|
||||
gp.value = &devid;
|
||||
|
||||
if (ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp, sizeof(gp)))
|
||||
if (drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp))
|
||||
return 0;
|
||||
|
||||
return devid;
|
||||
|
|
@ -126,6 +134,7 @@ static int is_i915_gem(int fd)
|
|||
if (ret) {
|
||||
struct drm_i915_getparam gp;
|
||||
|
||||
VG_CLEAR(gp);
|
||||
gp.param = I915_PARAM_HAS_GEM;
|
||||
gp.value = &ret;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue