drm/bochs: Fix the ID mismatch error [Linux 5.0]

drm/bochs: Fix the ID mismatch error [Linux 5.0]

This Linux kernel change "drm/bochs: Fix the ID mismatch error" is included in the Linux 5.0 release. This change is authored by Alistair Francis <Alistair.Francis [at] wdc.com> on Thu Feb 21 00:33:03 2019 +0000. The commit for this change in Linux stable tree is 17fb465 (patch).

drm/bochs: Fix the ID mismatch error

When running RISC-V QEMU with the Bochs device attached via PCIe the
probe of the Bochs device fails with:
    [drm:bochs_hw_init] *ERROR* ID mismatch

This was introduced by this commit:
    7780eb9ce8 bochs: convert to drm_dev_register

To fix the error we ensure that pci_enable_device() is called before
bochs_load().

Fixes: 7780eb9ce80f ("bochs: convert to drm_dev_register")
Signed-off-by: Alistair Francis <[email protected]>
Reported-by: David Abdurachmanov <[email protected]>
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>

There are 4 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/gpu/drm/bochs/bochs_drv.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/bochs/bochs_drv.c b/drivers/gpu/drm/bochs/bochs_drv.c
index f3dd66a..aa35007 100644
--- a/drivers/gpu/drm/bochs/bochs_drv.c
+++ b/drivers/gpu/drm/bochs/bochs_drv.c
@@ -154,6 +154,10 @@ static int bochs_pci_probe(struct pci_dev *pdev,
    if (IS_ERR(dev))
        return PTR_ERR(dev);

+   ret = pci_enable_device(pdev);
+   if (ret)
+       goto err_free_dev;
+
    dev->pdev = pdev;
    pci_set_drvdata(pdev, dev);

Leave a Reply

Your email address will not be published. Required fields are marked *