OSDN Git Service

Correct the casting type for radeon drm calls
authorPaulo Sergio Travaglia <pstglia@gmail.com>
Sun, 28 Jun 2015 22:16:42 +0000 (19:16 -0300)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Sun, 26 Jul 2015 15:58:28 +0000 (23:58 +0800)
It could be wrong to cast a pointer to a long type
(32-bit signed integer) and extend it to a uint64_t
(64-bit unsigned integer).

Cast it to uintptr_t as the xorg-video-ati does.

gralloc_drm_radeon.c

index 2911a45..8320989 100644 (file)
@@ -353,7 +353,7 @@ static int radeon_init_tile_config(struct radeon_info *info)
 
        memset(&ginfo, 0, sizeof(ginfo));
        ginfo.request = RADEON_INFO_TILING_CONFIG;
-       ginfo.value = (long) &val;
+       ginfo.value = (uintptr_t) &val;
        ret = drmCommandWriteRead(info->fd, DRM_RADEON_INFO,
                        &ginfo, sizeof(ginfo));
        if (ret)
@@ -465,7 +465,7 @@ static int radeon_probe(struct radeon_info *info)
 
        memset(&kinfo, 0, sizeof(kinfo));
        kinfo.request = RADEON_INFO_DEVICE_ID;
-       kinfo.value = (long) &info->chipset;
+       kinfo.value = (uintptr_t) &info->chipset;
        err = drmCommandWriteRead(info->fd, DRM_RADEON_INFO, &kinfo, sizeof(kinfo));
        if (err) {
                ALOGE("failed to get device id");