Skip to contentSkip to conversation

clocksource: remove unnecessary OOM messages

PATCH Applied Jingoo Han 3 participants 10 messages Apr 29, 2014 – May 22, 2014 Clocksource, clockevent drivers

lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

cover clocksource: remove unnecessary OOM messages

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message. For example, k.alloc and v.alloc failures use dump_stack().

Jingoo Han (4):
clocksource: em_sti: remove unnecessary OOM messages
clocksource: sh_cmt: remove unnecessary OOM messages
clocksource: sh_mtu2: remove unnecessary OOM messages
clocksource: sh_tmu: remove unnecessary OOM messages

---
 drivers/clocksource/em_sti.c  |    4 +---
 drivers/clocksource/sh_cmt.c  |    4 +---
 drivers/clocksource/sh_mtu2.c |    4 +---
 drivers/clocksource/sh_tmu.c  |    4 +---
 4 files changed, 4 insertions(+), 12 deletions(-)
author
#1 lore raw

PATCH 1/4 clocksource: em_sti: remove unnecessary OOM messages

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/clocksource/em_sti.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/clocksource/em_sti.c +1 -3
index 9d17083..d0a7bd6 100644
@@ -318,10 +318,8 @@ static int em_sti_probe(struct platform_device *pdev)
 	int irq;
 
 	p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL);
-	if (p == NULL) {
-		dev_err(&pdev->dev, "failed to allocate driver data\n");
+	if (p == NULL)
 		return -ENOMEM;
-	}
 
 	p->pdev = pdev;
 	platform_set_drvdata(pdev, p);
Signature · 1 line
1.7.10.4
#2 lore raw

Re: [PATCH 1/4] clocksource: em_sti: remove unnecessary OOM messages

Quoted 2 lines · Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

Are you sure the MM subsys display a message when an allocation fails ?

There are multiple reasons an allocation can fail.

Quoted 22 lines
---
  drivers/clocksource/em_sti.c |    4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
drivers/clocksource/em_sti.c +1 -3
index 9d17083..d0a7bd6 100644
@@ -318,10 +318,8 @@ static int em_sti_probe(struct platform_device *pdev)
  	int irq;
 
  	p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL);
-	if (p == NULL) {
-		dev_err(&pdev->dev, "failed to allocate driver data\n");
+	if (p == NULL)
  		return -ENOMEM;
-	}
 
  	p->pdev = pdev;
  	platform_set_drvdata(pdev, p);
Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
author
#3 lore raw

Re: [PATCH 1/4] clocksource: em_sti: remove unnecessary OOM messages

Quoted 7 lines · Daniel Lezcano
Quoted 2 lines · Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

Are you sure the MM subsys display a message when an allocation fails ?

There are multiple reasons an allocation can fail.

(+cc Viresh Kumar, Laurent Pinchart, Dan Carpenter, Joe Perches,
Thierry Reding, Andrew Morton)

There was a discussion about this in other threads. [1] Please refer to the following link. Thank you.

[1] http://patchwork.ozlabs.org/patch/324158/

Best regards,
Jingoo Han

Quoted 23 lines
Quoted 23 lines
---
  drivers/clocksource/em_sti.c |    4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
drivers/clocksource/em_sti.c +1 -3
index 9d17083..d0a7bd6 100644
@@ -318,10 +318,8 @@ static int em_sti_probe(struct platform_device *pdev)
  	int irq;
 
  	p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL);
-	if (p == NULL) {
-		dev_err(&pdev->dev, "failed to allocate driver data\n");
+	if (p == NULL)
  		return -ENOMEM;
-	}
 
  	p->pdev = pdev;
  	platform_set_drvdata(pdev, p);
#4 lore raw

Re: [PATCH 1/4] clocksource: em_sti: remove unnecessary OOM messages

Quoted 9 lines · Jingoo Han
Quoted 7 lines · Daniel Lezcano
Quoted 2 lines · Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

Are you sure the MM subsys display a message when an allocation fails ?

There are multiple reasons an allocation can fail.

Quoted 8 lines

(+cc Viresh Kumar, Laurent Pinchart, Dan Carpenter, Joe Perches,
Thierry Reding, Andrew Morton)

There was a discussion about this in other threads. [1] Please refer to the following link. Thank you.

[1] http://patchwork.ozlabs.org/patch/324158/

Yes yes. These are the right things to do, no need to add me to the CC list, Jingoo.

Someone was going to give a talk on removing these as part of their kernel smallification project or something...

regards,
dan carpenter

#5 lore raw

Re: [PATCH 1/4] clocksource: em_sti: remove unnecessary OOM messages

In reply to Jingoo Han
Quoted 9 lines · Jingoo Han
Quoted 7 lines · Daniel Lezcano
Quoted 2 lines · Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

Are you sure the MM subsys display a message when an allocation fails ?

There are multiple reasons an allocation can fail.

Quoted 7 lines

(+cc Viresh Kumar, Laurent Pinchart, Dan Carpenter, Joe Perches,
Thierry Reding, Andrew Morton)

There was a discussion about this in other threads. [1] Please refer to the following link. Thank you.

[1] http://patchwork.ozlabs.org/patch/324158/

Ok, thanks for the pointer.

Quoted 23 lines
Quoted 22 lines
Quoted 22 lines
---
   drivers/clocksource/em_sti.c |    4 +---
   1 file changed, 1 insertion(+), 3 deletions(-)
drivers/clocksource/em_sti.c +1 -3
index 9d17083..d0a7bd6 100644
@@ -318,10 +318,8 @@ static int em_sti_probe(struct platform_device *pdev)
   	int irq;
 
   	p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL);
-	if (p == NULL) {
-		dev_err(&pdev->dev, "failed to allocate driver data\n");
+	if (p == NULL)
   		return -ENOMEM;
-	}
 
   	p->pdev = pdev;
   	platform_set_drvdata(pdev, p);
Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
author
#6 lore raw

PATCH 2/4 clocksource: sh_cmt: remove unnecessary OOM messages

In reply to Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/clocksource/sh_cmt.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/clocksource/sh_cmt.c +1 -3
index 0b1836a..d2aa209 100644
@@ -824,10 +824,8 @@ static int sh_cmt_probe(struct platform_device *pdev)
 	}
 
 	p = kmalloc(sizeof(*p), GFP_KERNEL);
-	if (p == NULL) {
-		dev_err(&pdev->dev, "failed to allocate driver data\n");
+	if (p == NULL)
 		return -ENOMEM;
-	}
 
 	ret = sh_cmt_setup(p, pdev);
 	if (ret) {
Signature · 1 line
1.7.10.4
author
#7 lore raw

PATCH 3/4 clocksource: sh_mtu2: remove unnecessary OOM messages

In reply to Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/clocksource/sh_mtu2.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/clocksource/sh_mtu2.c +1 -3
index e30d76e..e6bee62 100644
@@ -349,10 +349,8 @@ static int sh_mtu2_probe(struct platform_device *pdev)
 	}
 
 	p = kmalloc(sizeof(*p), GFP_KERNEL);
-	if (p == NULL) {
-		dev_err(&pdev->dev, "failed to allocate driver data\n");
+	if (p == NULL)
 		return -ENOMEM;
-	}
 
 	ret = sh_mtu2_setup(p, pdev);
 	if (ret) {
Signature · 1 line
1.7.10.4
author
#8 lore raw

PATCH 4/4 clocksource: sh_tmu: remove unnecessary OOM messages

In reply to Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/clocksource/sh_tmu.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/clocksource/sh_tmu.c +1 -3
index ecd7b60..b62f28c 100644
@@ -514,10 +514,8 @@ static int sh_tmu_probe(struct platform_device *pdev)
 	}
 
 	p = kmalloc(sizeof(*p), GFP_KERNEL);
-	if (p == NULL) {
-		dev_err(&pdev->dev, "failed to allocate driver data\n");
+	if (p == NULL)
 		return -ENOMEM;
-	}
 
 	ret = sh_tmu_setup(p, pdev);
 	if (ret) {
Signature · 1 line
1.7.10.4
#9 lore raw
In reply to Jingoo Han
Quoted 10 lines · Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message. For example, k.alloc and v.alloc failures use dump_stack().

Jingoo Han (4):
clocksource: em_sti: remove unnecessary OOM messages
clocksource: sh_cmt: remove unnecessary OOM messages
clocksource: sh_mtu2: remove unnecessary OOM messages
clocksource: sh_tmu: remove unnecessary OOM messages

Quoted 6 lines
---
  drivers/clocksource/em_sti.c  |    4 +---
  drivers/clocksource/sh_cmt.c  |    4 +---
  drivers/clocksource/sh_mtu2.c |    4 +---
  drivers/clocksource/sh_tmu.c  |    4 +---
  4 files changed, 4 insertions(+), 12 deletions(-)

Applied to my tree for 3.16 with some slight changes due to Laurent's changes (kmalloc -> kzalloc).

Thanks !
-- Daniel

Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog