Web lists-archives.com

[PATCH 2/3] uio: Return directly after a failed kzalloc() in uio_dmem_genirq_probe()




From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 6 Dec 2017 19:11:49 +0100

* Return directly after a call of the function "kzalloc" failed
  in an if branch.

* Delete the jump label "bad2" which became unnecessary with
  this refactoring.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
 drivers/uio/uio_dmem_genirq.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/uio/uio_dmem_genirq.c b/drivers/uio/uio_dmem_genirq.c
index b7b0acd1bf01..4f230ce8b861 100644
--- a/drivers/uio/uio_dmem_genirq.c
+++ b/drivers/uio/uio_dmem_genirq.c
@@ -158,10 +158,9 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev)
 
 		/* alloc uioinfo for one device */
 		uioinfo = kzalloc(sizeof(*uioinfo), GFP_KERNEL);
-		if (!uioinfo) {
-			ret = -ENOMEM;
-			goto bad2;
-		}
+		if (!uioinfo)
+			return -ENOMEM;
+
 		uioinfo->name = pdev->dev.of_node->name;
 		uioinfo->version = "devicetree";
 
@@ -285,7 +284,7 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev)
 	/* kfree uioinfo for OF */
 	if (pdev->dev.of_node)
 		kfree(uioinfo);
- bad2:
+
 	return ret;
 }
 
-- 
2.15.1