clang: Fix warnings found through clang.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
This commit is contained in:
Ben Widawsky 2012-08-30 14:03:54 -07:00
parent ac23daaa51
commit 54ed938d39
6 changed files with 14 additions and 10 deletions

View File

@ -457,7 +457,7 @@ uint32_t prime_fd_to_handle(int fd, int dma_buf_fd)
/* signal interrupt helpers */ /* signal interrupt helpers */
static pid_t signal_helper = -1; static pid_t signal_helper = -1;
long long int sig_stat; long long int sig_stat;
static void signal_helper_process(pid_t pid) static void __attribute__((noreturn)) signal_helper_process(pid_t pid)
{ {
/* Interrupt the parent process at 500Hz, just to be annoying */ /* Interrupt the parent process at 500Hz, just to be annoying */
while (1) { while (1) {

View File

@ -64,10 +64,12 @@ static uint32_t do_gem_create(int fd, int size, int *retval)
return create.handle; return create.handle;
} }
#if 0
static int gem_exec(int fd, struct drm_i915_gem_execbuffer2 *execbuf) static int gem_exec(int fd, struct drm_i915_gem_execbuffer2 *execbuf)
{ {
return drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, execbuf); return drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, execbuf);
} }
#endif
static void create0(int fd) static void create0(int fd)
{ {
@ -77,6 +79,7 @@ static void create0(int fd)
assert(retval == EINVAL); assert(retval == EINVAL);
} }
#if 0
static void exec0(int fd) static void exec0(int fd)
{ {
struct drm_i915_gem_execbuffer2 execbuf; struct drm_i915_gem_execbuffer2 execbuf;
@ -115,6 +118,7 @@ static void exec0(int fd)
gem_close(fd, exec[0].handle); gem_close(fd, exec[0].handle);
} }
#endif
int main(int argc, char **argv) int main(int argc, char **argv)
{ {

View File

@ -62,7 +62,7 @@
#define WIDTH 512 #define WIDTH 512
#define HEIGHT 512 #define HEIGHT 512
static uint32_t linear[WIDTH * HEIGHT]; #define LINEAR_DWORDS (4 * WIDTH * HEIGHT)
static uint32_t current_tiling_mode; static uint32_t current_tiling_mode;
#define PAGE_SIZE 4096 #define PAGE_SIZE 4096
@ -74,14 +74,14 @@ create_bo_and_fill(int fd)
uint32_t *data; uint32_t *data;
int i; int i;
handle = gem_create(fd, sizeof(linear)); handle = gem_create(fd, LINEAR_DWORDS);
gem_set_tiling(fd, handle, current_tiling_mode, WIDTH * sizeof(uint32_t)); gem_set_tiling(fd, handle, current_tiling_mode, WIDTH * sizeof(uint32_t));
/* Fill the BO with dwords starting at start_val */ /* Fill the BO with dwords starting at start_val */
data = gem_mmap(fd, handle, sizeof(linear), PROT_READ | PROT_WRITE); data = gem_mmap(fd, handle, LINEAR_DWORDS, PROT_READ | PROT_WRITE);
for (i = 0; i < WIDTH*HEIGHT; i++) for (i = 0; i < WIDTH*HEIGHT; i++)
data[i] = i; data[i] = i;
munmap(data, sizeof(linear)); munmap(data, LINEAR_DWORDS);
return handle; return handle;
} }
@ -129,14 +129,14 @@ main(int argc, char **argv)
for (i = 0; i < count/2; i++) { for (i = 0; i < count/2; i++) {
/* Check the target bo's contents. */ /* Check the target bo's contents. */
data = gem_mmap(fd, bo_handles[idx_arr[i]], data = gem_mmap(fd, bo_handles[idx_arr[i]],
sizeof(linear), PROT_READ | PROT_WRITE); LINEAR_DWORDS, PROT_READ | PROT_WRITE);
for (j = 0; j < WIDTH*HEIGHT; j++) for (j = 0; j < WIDTH*HEIGHT; j++)
if (data[j] != j) { if (data[j] != j) {
fprintf(stderr, "mismatch at %i: %i\n", fprintf(stderr, "mismatch at %i: %i\n",
j, data[j]); j, data[j]);
exit(1); exit(1);
} }
munmap(data, sizeof(linear)); munmap(data, LINEAR_DWORDS);
} }
close(fd); close(fd);

View File

@ -598,7 +598,7 @@ int update_display(void)
static char optstr[] = "hiaf:s:d:p:mrt"; static char optstr[] = "hiaf:s:d:p:mrt";
static void usage(char *name) static void __attribute__((noreturn)) usage(char *name)
{ {
fprintf(stderr, "usage: %s [-hiasdpmtf]\n", name); fprintf(stderr, "usage: %s [-hiasdpmtf]\n", name);
fprintf(stderr, "\t-i\tdump info\n"); fprintf(stderr, "\t-i\tdump info\n");

View File

@ -40,7 +40,7 @@
#define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) /* 0666 */ #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) /* 0666 */
#endif #endif
static void usage(void) static void __attribute__((noreturn)) usage(void)
{ {
fprintf(stderr, "usage: bios_dumper <filename>\n"); fprintf(stderr, "usage: bios_dumper <filename>\n");
exit(1); exit(1);

View File

@ -85,7 +85,7 @@ static int i830_lvds_acpi_lid_state(void)
} }
} }
state_name = malloc(strlen(ACPI_LID) + strlen(lid_dent->d_name) + 7); state_name = malloc(strlen(ACPI_LID) + strlen(lid_dent->d_name) + 7);
memset(state_name, 0, sizeof(state_name)); memset(state_name, 0, strlen(ACPI_LID) + strlen(lid_dent->d_name) + 7);
strcat(state_name, ACPI_LID); strcat(state_name, ACPI_LID);
strcat(state_name, lid_dent->d_name); strcat(state_name, lid_dent->d_name);
strcat(state_name, "/state"); strcat(state_name, "/state");