| @@ -742,28 +742,28 @@ ms_get_drm_master_fd(ScrnInfoPtr pScrn) | | | @@ -742,28 +742,28 @@ ms_get_drm_master_fd(ScrnInfoPtr pScrn) |
742 | #endif | | 742 | #endif |
743 | { | | 743 | { |
744 | char *path = | | 744 | char *path = |
745 | xf86_platform_device_odev_attributes(pEnt->location.id.plat)-> | | 745 | xf86_platform_device_odev_attributes(pEnt->location.id.plat)-> |
746 | path; | | 746 | path; |
747 | ms->fd = open_hw(path); | | 747 | ms->fd = open_hw(path); |
748 | } | | 748 | } |
749 | } | | 749 | } |
750 | else | | 750 | else |
751 | #endif | | 751 | #endif |
752 | if (pEnt->location.type == BUS_PCI) { | | 752 | if (pEnt->location.type == BUS_PCI) { |
753 | ms->PciInfo = xf86GetPciInfoForEntity(ms->pEnt->index); | | 753 | ms->PciInfo = xf86GetPciInfoForEntity(ms->pEnt->index); |
754 | if (ms->PciInfo) { | | 754 | if (ms->PciInfo) { |
755 | BusID = malloc(64); | | 755 | char BusID[256]; |
756 | sprintf(BusID, "PCI:%d:%d:%d", | | 756 | snprintf(BusID, sizeof(BusID), "PCI:%d:%d:%d", |
757 | #if XSERVER_LIBPCIACCESS | | 757 | #if XSERVER_LIBPCIACCESS |
758 | ((ms->PciInfo->domain << 8) | ms->PciInfo->bus), | | 758 | ((ms->PciInfo->domain << 8) | ms->PciInfo->bus), |
759 | ms->PciInfo->dev, ms->PciInfo->func | | 759 | ms->PciInfo->dev, ms->PciInfo->func |
760 | #else | | 760 | #else |
761 | ((pciConfigPtr) ms->PciInfo->thisCard)->busnum, | | 761 | ((pciConfigPtr) ms->PciInfo->thisCard)->busnum, |
762 | ((pciConfigPtr) ms->PciInfo->thisCard)->devnum, | | 762 | ((pciConfigPtr) ms->PciInfo->thisCard)->devnum, |
763 | ((pciConfigPtr) ms->PciInfo->thisCard)->funcnum | | 763 | ((pciConfigPtr) ms->PciInfo->thisCard)->funcnum |
764 | #endif | | 764 | #endif |
765 | ); | | 765 | ); |
766 | } | | 766 | } |
767 | ms->fd = drmOpen(NULL, BusID); | | 767 | ms->fd = drmOpen(NULL, BusID); |
768 | } | | 768 | } |
769 | else { | | 769 | else { |
| @@ -786,32 +786,35 @@ PreInit(ScrnInfoPtr pScrn, int flags) | | | @@ -786,32 +786,35 @@ PreInit(ScrnInfoPtr pScrn, int flags) |
786 | rgb defaultWeight = { 0, 0, 0 }; | | 786 | rgb defaultWeight = { 0, 0, 0 }; |
787 | EntityInfoPtr pEnt; | | 787 | EntityInfoPtr pEnt; |
788 | uint64_t value = 0; | | 788 | uint64_t value = 0; |
789 | int ret; | | 789 | int ret; |
790 | int bppflags; | | 790 | int bppflags; |
791 | int defaultdepth, defaultbpp; | | 791 | int defaultdepth, defaultbpp; |
792 | | | 792 | |
793 | if (pScrn->numEntities != 1) | | 793 | if (pScrn->numEntities != 1) |
794 | return FALSE; | | 794 | return FALSE; |
795 | | | 795 | |
796 | pEnt = xf86GetEntityInfo(pScrn->entityList[0]); | | 796 | pEnt = xf86GetEntityInfo(pScrn->entityList[0]); |
797 | | | 797 | |
798 | if (flags & PROBE_DETECT) { | | 798 | if (flags & PROBE_DETECT) { |
| | | 799 | free(pEnt); |
799 | return FALSE; | | 800 | return FALSE; |
800 | } | | 801 | } |
801 | | | 802 | |
802 | /* Allocate driverPrivate */ | | 803 | /* Allocate driverPrivate */ |
803 | if (!GetRec(pScrn)) | | 804 | if (!GetRec(pScrn)) { |
| | | 805 | free(pEnt); |
804 | return FALSE; | | 806 | return FALSE; |
| | | 807 | } |
805 | | | 808 | |
806 | ms = modesettingPTR(pScrn); | | 809 | ms = modesettingPTR(pScrn); |
807 | ms->SaveGeneration = -1; | | 810 | ms->SaveGeneration = -1; |
808 | ms->pEnt = pEnt; | | 811 | ms->pEnt = pEnt; |
809 | ms->drmmode.is_secondary = FALSE; | | 812 | ms->drmmode.is_secondary = FALSE; |
810 | pScrn->displayWidth = 640; /* default it */ | | 813 | pScrn->displayWidth = 640; /* default it */ |
811 | | | 814 | |
812 | if (xf86IsEntityShared(pScrn->entityList[0])) { | | 815 | if (xf86IsEntityShared(pScrn->entityList[0])) { |
813 | if (xf86IsPrimInitDone(pScrn->entityList[0])) | | 816 | if (xf86IsPrimInitDone(pScrn->entityList[0])) |
814 | ms->drmmode.is_secondary = TRUE; | | 817 | ms->drmmode.is_secondary = TRUE; |
815 | else | | 818 | else |
816 | xf86SetPrimInitDone(pScrn->entityList[0]); | | 819 | xf86SetPrimInitDone(pScrn->entityList[0]); |
817 | } | | 820 | } |