[patch] Add some asserts
Rafael Espíndola
rafael.espindola at gmail.com
Wed Dec 23 19:59:08 PST 2009
> Unfortunately, the screen is black.
With the attached patch it works :-)
Cheers,
Rafael
-------------- next part --------------
diff --git a/src/radeon_atombios.c b/src/radeon_atombios.c
index c272c9a..567238c 100644
--- a/src/radeon_atombios.c
+++ b/src/radeon_atombios.c
@@ -1432,7 +1432,7 @@ rhdAtomFirmwareInfoQuery(atomBiosHandlePtr handle,
return ATOM_SUCCESS;
}
-const int object_connector_convert[] =
+static const int object_connector_convert[] =
{ CONNECTOR_NONE,
CONNECTOR_DVI_I,
CONNECTOR_DVI_I,
@@ -1453,6 +1453,7 @@ const int object_connector_convert[] =
CONNECTOR_NONE,
CONNECTOR_NONE,
CONNECTOR_DISPLAY_PORT,
+ CONNECTOR_DISPLAY_PORT,
};
xf86MonPtr radeon_atom_get_edid(xf86OutputPtr output)
@@ -1847,6 +1848,7 @@ RADEONGetATOMConnectorInfoFromBIOSObject (ScrnInfoPtr pScrn)
uint8_t con_obj_id, con_obj_num, con_obj_type;
con_obj_id = (le16_to_cpu(path->usConnObjectId) & OBJECT_ID_MASK) >> OBJECT_ID_SHIFT;
+ assert(con_obj_id < sizeof(object_connector_convert)/sizeof(int));
con_obj_num = (le16_to_cpu(path->usConnObjectId) & ENUM_ID_MASK) >> ENUM_ID_SHIFT;
con_obj_type = (le16_to_cpu(path->usConnObjectId) & OBJECT_TYPE_MASK) >> OBJECT_TYPE_SHIFT;
@@ -1879,6 +1881,7 @@ RADEONGetATOMConnectorInfoFromBIOSObject (ScrnInfoPtr pScrn)
slot_config = igp_obj->ulDDISlot2Config;
ct = (slot_config >> 16) & 0xff;
+ assert(ct < sizeof(object_connector_convert)/sizeof(int));
info->BiosConnector[i].ConnectorType = object_connector_convert[ct];
info->BiosConnector[i].connector_object_id = ct;
info->BiosConnector[i].igp_lane_info = slot_config & 0xffff;
diff --git a/src/radeon_output.c b/src/radeon_output.c
index 107955d..330a0b3 100644
--- a/src/radeon_output.c
+++ b/src/radeon_output.c
@@ -2946,6 +2946,7 @@ Bool RADEONSetupConnectors(ScrnInfoPtr pScrn)
} else if (conntype == CONNECTOR_DISPLAY_PORT) {
output = RADEONOutputCreate(pScrn, "DisplayPort-%d", --num_dp);
} else {
+ assert(conntype < sizeof(ConnectorTypeName)/sizeof(char *));
output = RADEONOutputCreate(pScrn,
ConnectorTypeName[conntype], 0);
}
More information about the xorg-driver-ati
mailing list