@@ -337,11 +337,28 @@
u32 lnkcap, lnkcap2;
*mask = 0;
- if (!dev->pdev)
- return -EINVAL;
-
+ if (!dev->pdev) {
+ DRM_INFO("invalid dev->pdev\n");
+ return -EINVAL;
+ }
+
+ if (!dev->pdev->bus) {
+ DRM_INFO("invalid dev->pdev->bus\n");
+ return -EINVAL;
+ }
+
+ if (!dev->pdev->bus->self) {
+ DRM_INFO("invalid dev->pdev->bus->self\n");
+ return -EINVAL;
+ }
+
root = dev->pdev->bus->self;
+ if (!root->vendor) {
+ DRM_INFO("invalid root->vendor\n");
+ return -EINVAL;
+ }
+
/* we've been informed via and serverworks don't make the cut */
if (root->vendor == PCI_VENDOR_ID_VIA ||
root->vendor == PCI_VENDOR_ID_SERVERWORKS)