All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] UIO: Adjustments for two function implementations
@ 2017-12-06 18:34 ` SF Markus Elfring
  0 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-12-06 18:34 UTC (permalink / raw)
  To: kernel-janitors, Greg Kroah-Hartman; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 6 Dec 2017 19:32:10 +0100

Three update suggestions were taken into account
from static source code analysis.

Markus Elfring (3):
  Delete two error messages for a failed memory allocation
    in uio_dmem_genirq_probe()
  Return directly after a failed kzalloc() in uio_dmem_genirq_probe()
  Delete two error messages for a failed memory allocation
    in uio_pdrv_genirq_probe()

 drivers/uio/uio_dmem_genirq.c | 11 ++++-------
 drivers/uio/uio_pdrv_genirq.c |  9 +++------
 2 files changed, 7 insertions(+), 13 deletions(-)

-- 
2.15.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 0/3] UIO: Adjustments for two function implementations
@ 2017-12-06 18:34 ` SF Markus Elfring
  0 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-12-06 18:34 UTC (permalink / raw)
  To: kernel-janitors, Greg Kroah-Hartman; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 6 Dec 2017 19:32:10 +0100

Three update suggestions were taken into account
from static source code analysis.

Markus Elfring (3):
  Delete two error messages for a failed memory allocation
    in uio_dmem_genirq_probe()
  Return directly after a failed kzalloc() in uio_dmem_genirq_probe()
  Delete two error messages for a failed memory allocation
    in uio_pdrv_genirq_probe()

 drivers/uio/uio_dmem_genirq.c | 11 ++++-------
 drivers/uio/uio_pdrv_genirq.c |  9 +++------
 2 files changed, 7 insertions(+), 13 deletions(-)

-- 
2.15.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] uio: Delete two error messages for a failed memory allocation in uio_dmem_genirq_probe()
  2017-12-06 18:34 ` SF Markus Elfring
@ 2017-12-06 18:35   ` SF Markus Elfring
  -1 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-12-06 18:35 UTC (permalink / raw)
  To: kernel-janitors, Greg Kroah-Hartman; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 6 Dec 2017 18:05:12 +0100

Omit extra messages for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/uio/uio_dmem_genirq.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/uio/uio_dmem_genirq.c b/drivers/uio/uio_dmem_genirq.c
index e1134a4d97f3..b7b0acd1bf01 100644
--- a/drivers/uio/uio_dmem_genirq.c
+++ b/drivers/uio/uio_dmem_genirq.c
@@ -160,7 +160,6 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev)
 		uioinfo = kzalloc(sizeof(*uioinfo), GFP_KERNEL);
 		if (!uioinfo) {
 			ret = -ENOMEM;
-			dev_err(&pdev->dev, "unable to kmalloc\n");
 			goto bad2;
 		}
 		uioinfo->name = pdev->dev.of_node->name;
@@ -188,7 +187,6 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev)
 	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
 	if (!priv) {
 		ret = -ENOMEM;
-		dev_err(&pdev->dev, "unable to kmalloc\n");
 		goto bad0;
 	}
 
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 1/3] uio: Delete two error messages for a failed memory allocation in uio_dmem_genirq_probe()
@ 2017-12-06 18:35   ` SF Markus Elfring
  0 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-12-06 18:35 UTC (permalink / raw)
  To: kernel-janitors, Greg Kroah-Hartman; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 6 Dec 2017 18:05:12 +0100

Omit extra messages for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/uio/uio_dmem_genirq.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/uio/uio_dmem_genirq.c b/drivers/uio/uio_dmem_genirq.c
index e1134a4d97f3..b7b0acd1bf01 100644
--- a/drivers/uio/uio_dmem_genirq.c
+++ b/drivers/uio/uio_dmem_genirq.c
@@ -160,7 +160,6 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev)
 		uioinfo = kzalloc(sizeof(*uioinfo), GFP_KERNEL);
 		if (!uioinfo) {
 			ret = -ENOMEM;
-			dev_err(&pdev->dev, "unable to kmalloc\n");
 			goto bad2;
 		}
 		uioinfo->name = pdev->dev.of_node->name;
@@ -188,7 +187,6 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev)
 	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
 	if (!priv) {
 		ret = -ENOMEM;
-		dev_err(&pdev->dev, "unable to kmalloc\n");
 		goto bad0;
 	}
 
-- 
2.15.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] uio: Return directly after a failed kzalloc() in uio_dmem_genirq_probe()
  2017-12-06 18:34 ` SF Markus Elfring
@ 2017-12-06 18:37   ` SF Markus Elfring
  -1 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-12-06 18:37 UTC (permalink / raw)
  To: kernel-janitors, Greg Kroah-Hartman; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
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@users.sourceforge.net>
---
 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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] uio: Return directly after a failed kzalloc() in uio_dmem_genirq_probe()
@ 2017-12-06 18:37   ` SF Markus Elfring
  0 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-12-06 18:37 UTC (permalink / raw)
  To: kernel-janitors, Greg Kroah-Hartman; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
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@users.sourceforge.net>
---
 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] uio: Delete two error messages for a failed memory allocation in uio_pdrv_genirq_probe()
  2017-12-06 18:34 ` SF Markus Elfring
@ 2017-12-06 18:38   ` SF Markus Elfring
  -1 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-12-06 18:38 UTC (permalink / raw)
  To: kernel-janitors, Greg Kroah-Hartman; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 6 Dec 2017 19:18:12 +0100

Omit extra messages for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/uio/uio_pdrv_genirq.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c
index f598ecddc8a7..327fbe766f1c 100644
--- a/drivers/uio/uio_pdrv_genirq.c
+++ b/drivers/uio/uio_pdrv_genirq.c
@@ -114,10 +114,9 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)
 		/* alloc uioinfo for one device */
 		uioinfo = devm_kzalloc(&pdev->dev, sizeof(*uioinfo),
 				       GFP_KERNEL);
-		if (!uioinfo) {
-			dev_err(&pdev->dev, "unable to kmalloc\n");
+		if (!uioinfo)
 			return -ENOMEM;
-		}
+
 		uioinfo->name = pdev->dev.of_node->name;
 		uioinfo->version = "devicetree";
 		/* Multiple IRQs are not supported */
@@ -135,10 +134,8 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)
 	}
 
 	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
-	if (!priv) {
-		dev_err(&pdev->dev, "unable to kmalloc\n");
+	if (!priv)
 		return -ENOMEM;
-	}
 
 	priv->uioinfo = uioinfo;
 	spin_lock_init(&priv->lock);
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] uio: Delete two error messages for a failed memory allocation in uio_pdrv_genirq_probe()
@ 2017-12-06 18:38   ` SF Markus Elfring
  0 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2017-12-06 18:38 UTC (permalink / raw)
  To: kernel-janitors, Greg Kroah-Hartman; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 6 Dec 2017 19:18:12 +0100

Omit extra messages for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/uio/uio_pdrv_genirq.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c
index f598ecddc8a7..327fbe766f1c 100644
--- a/drivers/uio/uio_pdrv_genirq.c
+++ b/drivers/uio/uio_pdrv_genirq.c
@@ -114,10 +114,9 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)
 		/* alloc uioinfo for one device */
 		uioinfo = devm_kzalloc(&pdev->dev, sizeof(*uioinfo),
 				       GFP_KERNEL);
-		if (!uioinfo) {
-			dev_err(&pdev->dev, "unable to kmalloc\n");
+		if (!uioinfo)
 			return -ENOMEM;
-		}
+
 		uioinfo->name = pdev->dev.of_node->name;
 		uioinfo->version = "devicetree";
 		/* Multiple IRQs are not supported */
@@ -135,10 +134,8 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)
 	}
 
 	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
-	if (!priv) {
-		dev_err(&pdev->dev, "unable to kmalloc\n");
+	if (!priv)
 		return -ENOMEM;
-	}
 
 	priv->uioinfo = uioinfo;
 	spin_lock_init(&priv->lock);
-- 
2.15.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-12-06 18:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-06 18:34 [PATCH 0/3] UIO: Adjustments for two function implementations SF Markus Elfring
2017-12-06 18:34 ` SF Markus Elfring
2017-12-06 18:35 ` [PATCH 1/3] uio: Delete two error messages for a failed memory allocation in uio_dmem_genirq_probe() SF Markus Elfring
2017-12-06 18:35   ` SF Markus Elfring
2017-12-06 18:37 ` [PATCH 2/3] uio: Return directly after a failed kzalloc() " SF Markus Elfring
2017-12-06 18:37   ` SF Markus Elfring
2017-12-06 18:38 ` [PATCH 3/3] uio: Delete two error messages for a failed memory allocation in uio_pdrv_genirq_probe() SF Markus Elfring
2017-12-06 18:38   ` SF Markus Elfring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.