uio/uio_pci_generic: don't return zero on failure path in probe()
authorAlexey Khoroshilov <khoroshilov@ispras.ru>
Fri, 5 Dec 2014 21:28:01 +0000 (00:28 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 12 Jan 2015 13:04:12 +0000 (05:04 -0800)
If uio_register_device() fails in probe(), it breaks off initialization,
deallocates all resources, but returns zero.

The patch adds proper error code propagation.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/uio/uio_pci_generic.c

index 077ae12269ce3a99fcc35ee099e6453a102484de..d0b508b68f3c3e4969bf46036510255d01ae7dd9 100644 (file)
@@ -91,7 +91,8 @@ static int probe(struct pci_dev *pdev,
        gdev->info.handler = irqhandler;
        gdev->pdev = pdev;
 
-       if (uio_register_device(&pdev->dev, &gdev->info))
+       err = uio_register_device(&pdev->dev, &gdev->info);
+       if (err)
                goto err_register;
        pci_set_drvdata(pdev, gdev);