aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJeremy Sowden <jeremy@azazel.net>2019-05-15 12:14:36 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-20 07:40:41 +0200
commitabb611d2c21c0a4fa8eab35dc936c80d9a07acd8 (patch)
tree34239d36167acbee96d22e6b2d5be9c0f10974c5 /drivers
parentstaging: kpc2000: added designated initializers to two structs. (diff)
downloadlinux-dev-abb611d2c21c0a4fa8eab35dc936c80d9a07acd8.tar.xz
linux-dev-abb611d2c21c0a4fa8eab35dc936c80d9a07acd8.zip
staging: kpc2000: added missing clean-up to probe_core_uio.
On error, probe_core_uio just returned an error without freeing resources which had previously been allocated. Added the missing clean-up code. Updated TODO. Signed-off-by: Jeremy Sowden <jeremy@azazel.net> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/kpc2000/TODO1
-rw-r--r--drivers/staging/kpc2000/kpc2000/cell_probe.c3
2 files changed, 3 insertions, 1 deletions
diff --git a/drivers/staging/kpc2000/TODO b/drivers/staging/kpc2000/TODO
index 8c7af29fefae..ed951acc829a 100644
--- a/drivers/staging/kpc2000/TODO
+++ b/drivers/staging/kpc2000/TODO
@@ -1,7 +1,6 @@
- the kpc_spi driver doesn't seem to let multiple transactions (to different instances of the core) happen in parallel...
- The kpc_i2c driver is a hot mess, it should probably be cleaned up a ton. It functions against current hardware though.
- pcard->card_num in kp2000_pcie_probe() is a global variable and needs atomic / locking / something better.
-- probe_core_uio() probably needs error handling
- the loop in kp2000_probe_cores() that uses probe_core_uio() also probably needs error handling
- would be nice if the AIO fileops in kpc_dma could be made to work
- probably want to add a CONFIG_ option to control compilation of the AIO functions
diff --git a/drivers/staging/kpc2000/kpc2000/cell_probe.c b/drivers/staging/kpc2000/kpc2000/cell_probe.c
index b98d53c8637f..e4c21291fe16 100644
--- a/drivers/staging/kpc2000/kpc2000/cell_probe.c
+++ b/drivers/staging/kpc2000/kpc2000/cell_probe.c
@@ -295,6 +295,7 @@ static int probe_core_uio(unsigned int core_num, struct kp2000_device *pcard,
kudev->dev = device_create(kpc_uio_class, &pcard->pdev->dev, MKDEV(0,0), kudev, "%s.%d.%d.%d", kudev->uioinfo.name, pcard->card_num, cte.type, kudev->core_num);
if (IS_ERR(kudev->dev)) {
dev_err(&pcard->pdev->dev, "probe_core_uio device_create failed!\n");
+ kfree(kudev);
return -ENODEV;
}
dev_set_drvdata(kudev->dev, kudev);
@@ -302,6 +303,8 @@ static int probe_core_uio(unsigned int core_num, struct kp2000_device *pcard,
rv = uio_register_device(kudev->dev, &kudev->uioinfo);
if (rv){
dev_err(&pcard->pdev->dev, "probe_core_uio failed uio_register_device: %d\n", rv);
+ put_device(kudev->dev);
+ kfree(kudev);
return rv;
}