drm/nouveau/hwmon: fix crash on non-PCI platforms
authorAlexandre Courbot <acourbot@nvidia.com>
Wed, 2 Mar 2016 10:13:42 +0000 (19:13 +0900)
committerBen Skeggs <bskeggs@redhat.com>
Mon, 14 Mar 2016 00:13:33 +0000 (10:13 +1000)
Registration of the hwmon device will fail on non-PCI systems since
dev->pdev is NULL in that case. Use the more generic drm_device::dev
member that points to the same and is always set no matter the platform.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nouveau_hwmon.c

index 3fa1e78e4ece11c8a2161adc6b6d9a0bbd940205..67edd2f5b71a580602aa33ef86e2c9f2976531b8 100644 (file)
@@ -640,7 +640,7 @@ nouveau_hwmon_init(struct drm_device *dev)
                return -ENOMEM;
        hwmon->dev = dev;
 
-       hwmon_dev = hwmon_device_register(&dev->pdev->dev);
+       hwmon_dev = hwmon_device_register(dev->dev);
        if (IS_ERR(hwmon_dev)) {
                ret = PTR_ERR(hwmon_dev);
                NV_ERROR(drm, "Unable to register hwmon device: %d\n", ret);