Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1435861

[PATCH 1/2] Input-at32psif: Return directly after a failed kzalloc() in psif_probe()

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 1/2] Input-at32psif: Return directly after a failed kzalloc() in psif_probe()
Date 2016-07-02 21:10 +0200
Message-ID <rQysG-7lA-31@gated-at.bofh.it> (permalink)
References <qEuGl-43C-5@gated-at.bofh.it> <rQysF-7lA-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 2 Jul 2016 18:34:43 +0200

Return directly after a memory allocation failed at the beginning.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/input/serio/at32psif.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/input/serio/at32psif.c b/drivers/input/serio/at32psif.c
index 2e4ff5b..fcb769a 100644
--- a/drivers/input/serio/at32psif.c
+++ b/drivers/input/serio/at32psif.c
@@ -212,8 +212,7 @@ static int __init psif_probe(struct platform_device *pdev)
 	psif = kzalloc(sizeof(struct psif), GFP_KERNEL);
 	if (!psif) {
 		dev_dbg(&pdev->dev, "out of memory\n");
-		ret = -ENOMEM;
-		goto out;
+		return -ENOMEM;
 	}
 	psif->pdev = pdev;
 
@@ -297,7 +296,6 @@ out_free_io:
 	kfree(io);
 out_free_psif:
 	kfree(psif);
-out:
 	return ret;
 }
 
-- 
2.9.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/2] Input-at32psif: Fine-tuning for OOM handling in  psif_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-07-02 21:10 +0200
  [PATCH 2/2] Input-at32psif: Remove OOM messages in psif_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-07-02 21:10 +0200
    Re: [PATCH 2/2] Input-at32psif: Remove OOM messages in  psif_probe() Julia Lawall <julia.lawall@lip6.fr> - 2016-07-02 21:30 +0200
  [PATCH 1/2] Input-at32psif: Return directly after a failed kzalloc()  in psif_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-07-02 21:10 +0200
  Re: [PATCH 0/2] Input-at32psif: Fine-tuning for OOM handling in  psif_probe() Joe Perches <joe@perches.com> - 2016-07-02 22:50 +0200
    Re: [PATCH 0/2] Input-at32psif: Fine-tuning for OOM handling in  psif_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-07-03 10:10 +0200

csiph-web