Fix void pointer arithmetic in drmProcessPciDevice
Arithmetic on void pointers is a GCC extension. CC libdrm_la-xf86drm.lo ../xf86drm.c: In function 'drmProcessPciDevice': ../xf86drm.c:3017:10: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith] addr += sizeof(drmDevice); ^ ../xf86drm.c:3020:10: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith] addr += DRM_NODE_MAX * sizeof(void *); ^ ../xf86drm.c:3023:14: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith] addr += max_node_str; ^ ../xf86drm.c:3035:14: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith] addr += sizeof(drmPciBusInfo); ^ Reviewed-by: Alex Deucher <alexander.deucher@amd.com>main
parent
8c4a1cbd98
commit
3045523de2
15
xf86drm.c
15
xf86drm.c
|
@ -3001,21 +3001,22 @@ static int drmProcessPciDevice(drmDevicePtr *device, const char *d_name,
|
|||
{
|
||||
const int max_node_str = drmGetMaxNodeName();
|
||||
int ret, i;
|
||||
void *addr;
|
||||
char *addr;
|
||||
|
||||
addr = *device = calloc(1, sizeof(drmDevice) +
|
||||
(DRM_NODE_MAX *
|
||||
(sizeof(void *) + max_node_str)) +
|
||||
*device = calloc(1, sizeof(drmDevice) +
|
||||
(DRM_NODE_MAX * (sizeof(void *) + max_node_str)) +
|
||||
sizeof(drmPciBusInfo) +
|
||||
sizeof(drmPciDeviceInfo));
|
||||
if (!*device)
|
||||
return -ENOMEM;
|
||||
|
||||
addr = (char*)*device;
|
||||
|
||||
(*device)->bustype = DRM_BUS_PCI;
|
||||
(*device)->available_nodes = 1 << node_type;
|
||||
|
||||
addr += sizeof(drmDevice);
|
||||
(*device)->nodes = addr;
|
||||
(*device)->nodes = (char**)addr;
|
||||
|
||||
addr += DRM_NODE_MAX * sizeof(void *);
|
||||
for (i = 0; i < DRM_NODE_MAX; i++) {
|
||||
|
@ -3024,7 +3025,7 @@ static int drmProcessPciDevice(drmDevicePtr *device, const char *d_name,
|
|||
}
|
||||
memcpy((*device)->nodes[node_type], node, max_node_str);
|
||||
|
||||
(*device)->businfo.pci = addr;
|
||||
(*device)->businfo.pci = (drmPciBusInfoPtr)addr;
|
||||
|
||||
ret = drmParsePciBusInfo(maj, min, (*device)->businfo.pci);
|
||||
if (ret)
|
||||
|
@ -3033,7 +3034,7 @@ static int drmProcessPciDevice(drmDevicePtr *device, const char *d_name,
|
|||
// Fetch the device info if the user has requested it
|
||||
if (fetch_deviceinfo) {
|
||||
addr += sizeof(drmPciBusInfo);
|
||||
(*device)->deviceinfo.pci = addr;
|
||||
(*device)->deviceinfo.pci = (drmPciDeviceInfoPtr)addr;
|
||||
|
||||
ret = drmParsePciDeviceInfo(d_name, (*device)->deviceinfo.pci);
|
||||
if (ret)
|
||||
|
|
Loading…
Reference in New Issue