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


Groups > linux.kernel > #1630407 > unrolled thread

[PATCH 3/3] HSI: omap_ssi: Delete an error message for a failed memory allocation in ssi_add_controller()

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2017-04-25 13:20 +0200
Last post2017-04-25 14:40 +0200
Articles 3 — 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 3/3] HSI: omap_ssi: Delete an error message for a failed  memory allocation in ssi_add_controller() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-25 13:20 +0200
    Re: [PATCH 3/3] HSI: omap_ssi: Delete an error message for a failed  memory allocation in ssi_add_controller() Pavel Machek <pavel@ucw.cz> - 2017-04-25 14:00 +0200
      Re: [PATCH 3/3] HSI: omap_ssi: Delete an error message for a failed  memory allocation in ssi_add_controller() Dan Carpenter <dan.carpenter@oracle.com> - 2017-04-25 14:40 +0200

#1630407 — [PATCH 3/3] HSI: omap_ssi: Delete an error message for a failed memory allocation in ssi_add_controller()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-25 13:20 +0200
Subject[PATCH 3/3] HSI: omap_ssi: Delete an error message for a failed memory allocation in ssi_add_controller()
Message-ID<tA6FI-3Yq-3@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 25 Apr 2017 12:42:14 +0200

The script "checkpatch.pl" pointed information out like the following.

WARNING: Possible unnecessary 'out of memory' message

Thus remove such a statement here.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/hsi/controllers/omap_ssi_core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/hsi/controllers/omap_ssi_core.c b/drivers/hsi/controllers/omap_ssi_core.c
index fb7ed8fce83a..88e48b346916 100644
--- a/drivers/hsi/controllers/omap_ssi_core.c
+++ b/drivers/hsi/controllers/omap_ssi_core.c
@@ -384,10 +384,8 @@ static int ssi_add_controller(struct hsi_controller *ssi,
 	int err;
 
 	omap_ssi = devm_kzalloc(&ssi->device, sizeof(*omap_ssi), GFP_KERNEL);
-	if (!omap_ssi) {
-		dev_err(&pd->dev, "not enough memory for omap ssi\n");
+	if (!omap_ssi)
 		return -ENOMEM;
-	}
 
 	err = ida_simple_get(&platform_omap_ssi_ida, 0, 0, GFP_KERNEL);
 	if (err < 0)
-- 
2.12.2

[toc] | [next] | [standalone]


#1630432

FromPavel Machek <pavel@ucw.cz>
Date2017-04-25 14:00 +0200
Message-ID<tA7ip-4eL-1@gated-at.bofh.it>
In reply to#1630407

[Multipart message — attachments visible in raw view] — view raw

On Tue 2017-04-25 13:18:31, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 25 Apr 2017 12:42:14 +0200
> 
> The script "checkpatch.pl" pointed information out like the following.
> 
> WARNING: Possible unnecessary 'out of memory' message
> 
> Thus remove such a statement here.

Any reason to believe it is good idea besides program telling you it
_might_ be?
								Pavel
								
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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


#1630463

FromDan Carpenter <dan.carpenter@oracle.com>
Date2017-04-25 14:40 +0200
Message-ID<tA7V7-4Ib-1@gated-at.bofh.it>
In reply to#1630432
1) That allocation will never fail in real life so it's dead code.
2) kmalloc and friends already have much better builtin in error
   messages so it's useless.
3) There is a small memory savings from removing it.

I'm not saying you should apply the patch, I'm just saying that these
messages are pointless and detrimental.

regards,
an carpenter

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web