Silence function defined but not used warning
PATCH 1/8 Silence function defined but not used warning
--- radeon/radeon_cs_gem.c | 2 ++ 1 file changed, 2 insertions(+)
radeon/radeon_cs_gem.c +2 -0
@@ -330,6 +330,7 @@ static int cs_gem_end(struct radeon_cs_int *cs,return 0 ; } +#if CS_BOF_DUMP static void cs_gem_dump_bof (struct radeon_cs_int *cs) {struct cs_gem *csg = (struct cs_gem *)cs;
@@ -415,6 +416,7 @@ out_err:bof_decref (device_id); bof_decref(root); } +#endif static int cs_gem_emit (struct radeon_cs_int *cs) {
Signature · 1 line
1.7.10.4
PATCH 2/8 Remove unused variables
--- intel/intel_bufmgr_gem.c | 3 +-- tests/lock.c | 2 +- tests/name_from_fd.c | 3 +-- tests/ttmtest/src/ttmtest.c | 2 +- tests/updatedraw.c | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-)
intel/intel_bufmgr_gem.c +1 -2
@@ -2845,9 +2845,8 @@ drm_intel_gem_context_create(drm_intel_bufmgr *bufmgr) {drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bufmgr;struct drm_i915_gem_context_create create; -drm_i915_getparam_t gp;drm_intel_context *context =NULL ; -int tmp =0 , ret; +int ret; ret =drmIoctl (bufmgr_gem->fd,DRM_IOCTL_I915_GEM_CONTEXT_CREATE , &create);if (ret !=0 ) {
tests/lock.c +1 -1
@@ -205,7 +205,7 @@ static void client()static void server () { -int drmfd, tempfd, ret; +int drmfd, ret;unsigned int client_time, unlock_time; drmfd =drm_open_any_master ();
tests/name_from_fd.c +1 -2
@@ -39,8 +39,7 @@*/ int main (int argc,char **argv) { -int fd, ret; -drm_set_version_t sv, version; +int fd;const char *name ="/dev/dri/card0" ;char *v;
tests/ttmtest/src/ttmtest.c +1 -1
@@ -347,7 +347,7 @@ testAGP(TinyDRIContext * ctx)int main () { -int ret, screen, isCapable; +int ret, isCapable;char *displayName =":0" ;TinyDRIContext ctx;unsigned magic;
tests/updatedraw.c +1 -1
@@ -121,7 +121,7 @@ static int rm_drawable(int fd, int drawable, int fail)*/ int main (int argc,char **argv) { -int fd, ret, d1, d2; +int fd, d1, d2;if (getuid () !=0 ) {fprintf (stderr,"updatedraw test requires root, skipping\n" );
Signature · 1 line
1.7.10.4
PATCH 3/8 Cleanup includes
In reply to Tim Wiederhake--- intel/intel_bufmgr_gem.c | 4 ++-- tests/kmstest/main.c | 3 ++- tests/modetest/modetest.c | 2 +- tests/ttmtest/src/ttmtest.c | 6 +++--- 4 files changed, 8 insertions(+), 7 deletions(-)
intel/intel_bufmgr_gem.c +2 -2
@@ -40,6 +40,7 @@#include <xf86drm.h> #include <xf86atomic.h> +#include <errno.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h>
@@ -53,13 +54,12 @@#include <sys/types.h> #include <stdbool.h> -#include "errno.h" #include "libdrm_lists.h" #include "intel_bufmgr.h" #include "intel_bufmgr_priv.h" #include "intel_chipset.h" #include "intel_aub.h" -#include "string.h" +#include "i915_drm.h"
tests/kmstest/main.c +2 -1
@@ -26,10 +26,11 @@**************************************************************************/ +#include <libkms.h> #include <stdio.h> #include <string.h> #include "xf86drm.h" -#include "libkms.h" +#define CHECK_RET_RETURN (ret, str) \ if (ret < 0) { \
tests/modetest/modetest.c +1 -1
@@ -40,6 +40,7 @@#include "config.h" #include <assert.h> +#include <libkms.h> #include <stdio.h> #include <stdlib.h> #include <stdint.h>
@@ -53,7 +54,6 @@#include "xf86drm.h" #include "xf86drmMode.h" #include "drm_fourcc.h" -#include "libkms.h" #ifdef HAVE_CAIRO #include <math.h>
tests/ttmtest/src/ttmtest.c +3 -3
@@ -39,13 +39,13 @@#include <drm/drm.h> #include "xf86dri.h" #include "xf86drm.h" -#include "stdio.h" -#include "sys/types.h" +#include <stdio.h> +#include <sys/types.h> #include <unistd.h> #include <string.h> #include <errno.h> #include <stdlib.h> -#include "sys/mman.h" +#include <sys/mman.h> typedef struct {
Signature · 1 line
1.7.10.4
PATCH 4/8 Fix memory leaks
In reply to Tim Wiederhake--- libkms/intel.c | 3 ++- libkms/nouveau.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
libkms/intel.c +2 -1
@@ -101,7 +101,8 @@ intel_bo_create(struct kms_driver *kms, pitch = (pitch +512 -1 ) & ~(512 -1 ); size = pitch * ((height +4 -1 ) & ~(4 -1 )); }else { -return -EINVAL ; + ret = -EINVAL ; + goto err_free; }memset (&arg,0 ,sizeof (arg));
libkms/nouveau.c +2 -1
@@ -102,7 +102,8 @@ nouveau_bo_create(struct kms_driver *kms, pitch = (pitch +512 -1 ) & ~(512 -1 ); size = pitch * height; }else { -return -EINVAL ; + ret = -EINVAL ; + goto err_free; }memset (&arg,0 ,sizeof (arg));
Signature · 1 line
1.7.10.4
PATCH 5/8 Fix possible null pointer dereferences
In reply to Tim Wiederhake--- intel/intel_bufmgr_gem.c | 3 ++- intel/intel_decode.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
intel/intel_bufmgr_gem.c +2 -1
@@ -1338,13 +1338,14 @@ int drm_intel_gem_bo_map_unsynchronized(drm_intel_bo *bo)static int drm_intel_gem_bo_unmap (drm_intel_bo *bo) { -drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr;drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo; +drm_intel_bufmgr_gem *bufmgr_gem;int ret =0 ;if (bo ==NULL )return 0 ; + bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr;pthread_mutex_lock (&bufmgr_gem->lock);if (bo_gem->map_count <=0 ) {
intel/intel_decode.c +2 -1
@@ -3893,7 +3893,7 @@ drm_intel_decode(struct drm_intel_decode *ctx)int ret;unsigned int index =0 ;uint32_t devid; -int size = ctx->base_count *4 ; +int size;void *temp;if (!ctx)
@@ -3903,6 +3903,7 @@ drm_intel_decode(struct drm_intel_decode *ctx)* the batchbuffer. This lets us avoid a bunch of length * checking in statically sized packets. */ + size = ctx->base_count *4 ; temp =malloc (size +4096 );memcpy (temp, ctx->base_data, size);memset ((char *)temp + size,0xd0 ,4096 );
Signature · 1 line
1.7.10.4
PATCH 6/8 Remove never used assignments
In reply to Tim Wiederhake--- xf86drm.c | 2 ++ xf86drmSL.c | 1 - 2 files changed, 2 insertions(+), 1 deletion(-)
xf86drm.c +2 -0
@@ -304,7 +304,9 @@ static int drmOpenDevice(long dev, int minor, int type)char buf[64 ];int fd;mode_t devmode =DRM_DEV_MODE , serv_mode; +#if !defined(UDEV )int isroot = !geteuid (); +#endif uid_t user =DRM_DEV_UID ;gid_t group =DRM_DEV_GID , serv_group;
xf86drmSL.c +0 -1
@@ -263,7 +263,6 @@ int drmSLLookupNeighbors(void *l, unsigned long key, unsigned long *prev_key, void **prev_value, unsigned long *next_key, void **next_value) { - SkipListPtr list = (SkipListPtr)l; SLEntryPtr update[SL_MAX_LEVEL + 1];int retcode =0 ;
Signature · 1 line
1.7.10.4
PATCH 7/8 Always use width in scanf
In reply to Tim Wiederhake--- tests/modetest/modetest.c | 8 ++++---- xf86drm.c | 8 ++++---- xf86drmMode.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-)
tests/modetest/modetest.c +4 -4
@@ -1215,10 +1215,10 @@ int main(int argc, char **argv)break ;case 's' : con_args[count].crtc =-1 ; -if (sscanf (optarg,"%d:%64s" , +if (sscanf (optarg,"%20d:%64s" , &con_args[count].id, con_args[count].mode_str) !=2 && -sscanf (optarg,"%d@%d:%64s" , +sscanf (optarg,"%20d@%20d:%64s" , &con_args[count].id, &con_args[count].crtc, con_args[count].mode_str) !=3 )
@@ -1227,12 +1227,12 @@ int main(int argc, char **argv)break ;case 'P' :strcpy (plane_args[plane_count].format_str,"XR24" ); -if (sscanf (optarg,"%d:%dx%d@%4s" , +if (sscanf (optarg,"%20d:%20dx%20d@%4s" , &plane_args[plane_count].con_id, &plane_args[plane_count].w, &plane_args[plane_count].h, plane_args[plane_count].format_str) !=4 && -sscanf (optarg,"%d:%dx%d" , +sscanf (optarg,"%20d:%20dx%20d" , &plane_args[plane_count].con_id, &plane_args[plane_count].w, &plane_args[plane_count].h) !=3 )
xf86drm.c +4 -4
@@ -224,18 +224,18 @@ static int drmMatchBusID(const char *id1, const char *id2, int pci_domain_ok)unsigned int o2, b2, d2, f2;int ret; - ret =sscanf (id1,"pci:%04x:%02x:%02x.%u" , &o1, &b1, &d1, &f1); + ret =sscanf (id1,"pci:%04x:%02x:%02x.%20u" , &o1, &b1, &d1, &f1);if (ret !=4 ) { o1 =0 ; - ret =sscanf (id1,"PCI:%u:%u:%u" , &b1, &d1, &f1); + ret =sscanf (id1,"PCI:%20u:%20u:%20u" , &b1, &d1, &f1);if (ret !=3 )return 0 ; } - ret =sscanf (id2,"pci:%04x:%02x:%02x.%u" , &o2, &b2, &d2, &f2); + ret =sscanf (id2,"pci:%04x:%02x:%02x.%20u" , &o2, &b2, &d2, &f2);if (ret !=4 ) { o2 =0 ; - ret =sscanf (id2,"PCI:%u:%u:%u" , &b2, &d2, &f2); + ret =sscanf (id2,"PCI:%20u:%20u:%20u" , &b2, &d2, &f2);if (ret !=3 )return 0 ; }
xf86drmMode.c +1 -1
@@ -693,7 +693,7 @@ int drmCheckModesettingSupported(const char *busid)struct dirent *dent;int found =0 , ret; - ret =sscanf (busid,"pci:%04x:%02x:%02x.%d" , &domain, &bus, &dev, &func); + ret =sscanf (busid,"pci:%04x:%02x:%02x.%20d" , &domain, &bus, &dev, &func);if (ret !=4 )return -EINVAL ;
Signature · 1 line
1.7.10.4
PATCH 8/8 Update .gitignore
In reply to Tim Wiederhake--- .gitignore | 3 +++ 1 file changed, 3 insertions(+)
.gitignore +3 -0
@@ -39,8 +39,10 @@ i915.kld install-sh libdrm/config.h.in libdrm.pc +libdrm_exynos.pc libdrm_intel.pc libdrm_nouveau.pc +libdrm_omap.pc libdrm_radeon.pc libkms.pc libtool
@@ -70,6 +72,7 @@ tests/gem_flink tests/gem_mmap tests/gem_readwrite tests/openclose +tests/radeon/radeon_ttm tests/setversion tests/updatedraw tests/modeprint/modeprint
Signature · 1 line
1.7.10.4