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


Groups > linux.kernel > #1435858 > unrolled thread

[PATCH 0/2] Input-at32psif: Fine-tuning for OOM handling in psif_probe()

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2016-07-02 21:10 +0200
Last post2016-07-03 10:10 +0200
Articles 6 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [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

#1435858 — [PATCH 0/2] Input-at32psif: Fine-tuning for OOM handling in psif_probe()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-07-02 21:10 +0200
Subject[PATCH 0/2] Input-at32psif: Fine-tuning for OOM handling in psif_probe()
Message-ID<rQysF-7lA-1@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 2 Jul 2016 20:50:09 +0200

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

Markus Elfring (2):
  Return directly after a failed kzalloc()
  Remove two OOM messages

 drivers/input/serio/at32psif.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

-- 
2.9.0

[toc] | [next] | [standalone]


#1435860 — [PATCH 2/2] Input-at32psif: Remove OOM messages in psif_probe()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-07-02 21:10 +0200
Subject[PATCH 2/2] Input-at32psif: Remove OOM messages in psif_probe()
Message-ID<rQysF-7lA-17@gated-at.bofh.it>
In reply to#1435858
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 2 Jul 2016 20:34:18 +0200

Delete two debug messages because Linux will usually provide
an appropriate information for a memory allocation failure.

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

diff --git a/drivers/input/serio/at32psif.c b/drivers/input/serio/at32psif.c
index fcb769a..b30503d 100644
--- a/drivers/input/serio/at32psif.c
+++ b/drivers/input/serio/at32psif.c
@@ -210,15 +210,13 @@ static int __init psif_probe(struct platform_device *pdev)
 	int ret;
 
 	psif = kzalloc(sizeof(struct psif), GFP_KERNEL);
-	if (!psif) {
-		dev_dbg(&pdev->dev, "out of memory\n");
+	if (!psif)
 		return -ENOMEM;
-	}
+
 	psif->pdev = pdev;
 
 	io = kzalloc(sizeof(struct serio), GFP_KERNEL);
 	if (!io) {
-		dev_dbg(&pdev->dev, "out of memory\n");
 		ret = -ENOMEM;
 		goto out_free_psif;
 	}
-- 
2.9.0

[toc] | [prev] | [next] | [standalone]


#1435862 — Re: [PATCH 2/2] Input-at32psif: Remove OOM messages in psif_probe()

FromJulia Lawall <julia.lawall@lip6.fr>
Date2016-07-02 21:30 +0200
SubjectRe: [PATCH 2/2] Input-at32psif: Remove OOM messages in psif_probe()
Message-ID<rQyM1-7se-11@gated-at.bofh.it>
In reply to#1435860

On Sat, 2 Jul 2016, SF Markus Elfring wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 2 Jul 2016 20:34:18 +0200
> 
> Delete two debug messages because Linux will usually provide
> an appropriate information for a memory allocation failure.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/input/serio/at32psif.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/input/serio/at32psif.c b/drivers/input/serio/at32psif.c
> index fcb769a..b30503d 100644
> --- a/drivers/input/serio/at32psif.c
> +++ b/drivers/input/serio/at32psif.c
> @@ -210,15 +210,13 @@ static int __init psif_probe(struct platform_device *pdev)
>  	int ret;
>  
>  	psif = kzalloc(sizeof(struct psif), GFP_KERNEL);
> -	if (!psif) {
> -		dev_dbg(&pdev->dev, "out of memory\n");
> +	if (!psif)
>  		return -ENOMEM;
> -	}
> +

Why add a blank line here?

>  	psif->pdev = pdev;
>  
>  	io = kzalloc(sizeof(struct serio), GFP_KERNEL);
>  	if (!io) {
> -		dev_dbg(&pdev->dev, "out of memory\n");
>  		ret = -ENOMEM;
>  		goto out_free_psif;
>  	}
> -- 
> 2.9.0
> 
> 

[toc] | [prev] | [next] | [standalone]


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

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-07-02 21:10 +0200
Subject[PATCH 1/2] Input-at32psif: Return directly after a failed kzalloc() in psif_probe()
Message-ID<rQysG-7lA-31@gated-at.bofh.it>
In reply to#1435858
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

[toc] | [prev] | [next] | [standalone]


#1435869

FromJoe Perches <joe@perches.com>
Date2016-07-02 22:50 +0200
Message-ID<rQA1r-8dk-3@gated-at.bofh.it>
In reply to#1435858
On Sat, 2016-07-02 at 21:00 +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 2 Jul 2016 20:50:09 +0200
> 
> A few update suggestions were taken into account
> from static source code analysis.
> 
> Markus Elfring (2):
>   Return directly after a failed kzalloc()
>   Remove two OOM messages
> 
>  drivers/input/serio/at32psif.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)

What possible rationale is there for including this "references" header?
566ABCD9.1060404@users.sourceforge.net

This message id is for your message:
	"Source code review around jump label usage"
sent December 11, 2015!

Please stop adding unnecessary and useless email headers.

[toc] | [prev] | [next] | [standalone]


#1435921

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-07-03 10:10 +0200
Message-ID<rQKDv-6iv-1@gated-at.bofh.it>
In reply to#1435869
>> A few update suggestions were taken into account
>> from static source code analysis.
>>
>> Markus Elfring (2):
>>   Return directly after a failed kzalloc()
>>   Remove two OOM messages
>>
>>  drivers/input/serio/at32psif.c | 10 +++-------
>>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> What possible rationale is there for including this "references" header?
> 566ABCD9.1060404@users.sourceforge.net

Do any more software developers dare to reconsider source code
also around a jump label like "out"?


> This message id is for your message:
> 	"Source code review around jump label usage"
> sent December 11, 2015!

Can such an association with a bit of background information
be occasionally useful for clarification of corresponding
implementation details?

Regards,
Markus

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web