summaryrefslogtreecommitdiff
path: root/drivers/staging/kpc2000
diff options
context:
space:
mode:
authorEvgeny Novikov <novikov@ispras.ru>2020-06-23 11:29:59 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-06-25 15:40:27 +0200
commit8ce8668bfb64f2973cc1276c54619aceede6498a (patch)
treebf503b09ee4d87dbaa3ad7b2e48267186377f91c /drivers/staging/kpc2000
parentc8a00029dc70d0c35e84d6f0ff99a534dfe636e6 (diff)
staging: kpc2000: kpc_dma: set error code in probe
If device_create() fails during probing the device, kpc_dma_probe() does not set the error code and returns 0. This can result in various bad issues later. The patch sets the error code on the corresponding error handling path. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Evgeny Novikov <novikov@ispras.ru> Link: https://lore.kernel.org/r/20200623082959.14951-1-novikov@ispras.ru Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/kpc2000')
-rw-r--r--drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c b/drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c
index c3b30551e0ca..624d47bae4d1 100644
--- a/drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c
+++ b/drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c
@@ -140,6 +140,7 @@ int kpc_dma_probe(struct platform_device *pldev)
dev = MKDEV(assigned_major_num, pldev->id);
ldev->kpc_dma_dev = device_create(kpc_dma_class, &pldev->dev, dev, ldev, "kpc_dma%d", pldev->id);
if (IS_ERR(ldev->kpc_dma_dev)) {
+ rv = PTR_ERR(ldev->kpc_dma_dev);
dev_err(&ldev->pldev->dev, "%s: device_create failed: %d\n", __func__, rv);
goto err_kfree;
}