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


Groups > linux.kernel > #1650792

[PATCH 1/2] regmap: Delete an error message for a failed memory allocation in regmap_bulk_write()

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 1/2] regmap: Delete an error message for a failed memory allocation in regmap_bulk_write()
Date 2017-05-25 22:10 +0200
Message-ID <tL7f4-4jo-17@gated-at.bofh.it> (permalink)
References <tL7f4-4jo-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 25 May 2017 21:43:58 +0200

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

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/base/regmap/regmap.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index b9a779a4a739..096499e1f223 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1945,10 +1945,9 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
 			return -EINVAL;
 
 		wval = kmemdup(val, val_count * val_bytes, map->alloc_flags);
-		if (!wval) {
-			dev_err(map->dev, "Error in memory allocation\n");
+		if (!wval)
 			return -ENOMEM;
-		}
+
 		for (i = 0; i < val_count * val_bytes; i += val_bytes)
 			map->format.parse_inplace(wval + i);
 
-- 
2.13.0

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


Thread

[PATCH 1/2] regmap: Delete an error message for a failed memory  allocation in regmap_bulk_write() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-25 22:10 +0200

csiph-web