Skip to content

Commit

Permalink
uio/uio_pci_generic: don't return zero on failure path in probe()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alexey Khoroshilov authored and Greg Kroah-Hartman committed Jan 12, 2015
1 parent 5de61e7 commit c4277e9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/uio/uio_pci_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit c4277e9

Please sign in to comment.