aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/uio/uio_dmem_genirq.c
diff options
context:
space:
mode:
authorDaeseok Youn <daeseok.youn@gmail.com>2014-05-21 20:46:12 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-05-27 17:11:06 -0400
commitca3c61f358d8e5a4b2732d6aa81ac46f677e69f0 (patch)
tree067f59413cfd55aede6c0216018724ebd85194cf /drivers/uio/uio_dmem_genirq.c
parenta0f104644ec27ce5bbb36e950eb426dba9a3ad44 (diff)
drivers: uio_dmem_genirq: Fix memory leak in uio_dmem_genirq_probe()
When platform_get_irq() is failed after "priv" allocated, it need to free "priv". But the label of bad0 doesn't try to free about "priv". So this patch changes that lable to "bad1". But "bad1" has pm_runtime_disable() call, this function should be called when uio_register_device() is failed. So it is moved into handling error for uio_register_device(). Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Hans J. Koch <hjk@hansjkoch.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/uio/uio_dmem_genirq.c')
-rw-r--r--drivers/uio/uio_dmem_genirq.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/uio/uio_dmem_genirq.c b/drivers/uio/uio_dmem_genirq.c
index 1270f3b26139..8d0bba469566 100644
--- a/drivers/uio/uio_dmem_genirq.c
+++ b/drivers/uio/uio_dmem_genirq.c
@@ -204,7 +204,7 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev)
204 ret = platform_get_irq(pdev, 0); 204 ret = platform_get_irq(pdev, 0);
205 if (ret < 0) { 205 if (ret < 0) {
206 dev_err(&pdev->dev, "failed to get IRQ\n"); 206 dev_err(&pdev->dev, "failed to get IRQ\n");
207 goto bad0; 207 goto bad1;
208 } 208 }
209 uioinfo->irq = ret; 209 uioinfo->irq = ret;
210 } 210 }
@@ -275,6 +275,7 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev)
275 ret = uio_register_device(&pdev->dev, priv->uioinfo); 275 ret = uio_register_device(&pdev->dev, priv->uioinfo);
276 if (ret) { 276 if (ret) {
277 dev_err(&pdev->dev, "unable to register uio device\n"); 277 dev_err(&pdev->dev, "unable to register uio device\n");
278 pm_runtime_disable(&pdev->dev);
278 goto bad1; 279 goto bad1;
279 } 280 }
280 281
@@ -282,7 +283,6 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev)
282 return 0; 283 return 0;
283 bad1: 284 bad1:
284 kfree(priv); 285 kfree(priv);
285 pm_runtime_disable(&pdev->dev);
286 bad0: 286 bad0:
287 /* kfree uioinfo for OF */ 287 /* kfree uioinfo for OF */
288 if (pdev->dev.of_node) 288 if (pdev->dev.of_node)