regmap: Adjustments for two function implementations
Subsystems (3)
cover regmap: Adjustments for two function implementations
From: Markus Elfring <[email protected]>
Date: Thu, 25 May 2017 22:02:02 +0200
Two update suggestions were taken into account
from static source code analysis.
Markus Elfring (2):
Delete an error message for a failed memory allocation in regmap_bulk_write() Adjust five checks for null pointers in __regmap_init()
drivers/base/regmap/regmap.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
Signature · 1 line
2.13.0
PATCH 1/2 regmap: Delete an error message for a failed memory allocation in regmap_bulk_write()
From: Markus Elfring <[email protected]>
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.
--- drivers/base/regmap/regmap.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/base/regmap/regmap.c +2 -3
@@ -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);
Signature · 1 line
2.13.0
Mark Brown
maintainerApplied "regmap: Remove unnecessary printk for failed allocation" to the regmap tree
The patch
regmap: Remove unnecessary printk for failed allocation
has been applied to the regmap tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
From b4ecfec5ee3f282a4ac0876de332876fec9b488c Mon Sep 17 00:00:00 2001
From: Charles Keepax <[email protected]>
Date: Thu, 22 Feb 2018 12:59:11 +0000
Subject: [PATCH] regmap: Remove unnecessary printk for failed allocation
--- drivers/base/regmap/regmap.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/base/regmap/regmap.c +2 -3
@@ -2050,10 +2050,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);
Signature · 1 line
2.16.1
PATCH 2/2 regmap: Adjust five checks for null pointers in __regmap_init()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Thu, 25 May 2017 21:52:42 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The script “checkpatch.pl” pointed information out like the following.
Comparison to NULL could be written !…
Thus fix the affected source code places.
--- drivers/base/regmap/regmap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/base/regmap/regmap.c +5 -5
@@ -618,7 +618,7 @@ struct regmap *__regmap_init(struct device *dev, goto err; map =kzalloc (sizeof (*map),GFP_KERNEL ); -if (map =NULL ) { +if (!map) { ret = -ENOMEM ; goto err; }
@@ -918,7 +918,7 @@ struct regmap *__regmap_init(struct device *dev, goto err_map; map->work_buf =kzalloc (map->format.buf_size,GFP_KERNEL ); -if (map->work_buf =NULL ) { +if (!map->work_buf) { ret = -ENOMEM ; goto err_map; }
@@ -993,7 +993,7 @@ struct regmap *__regmap_init(struct device *dev, } new =kzalloc (sizeof (*new),GFP_KERNEL ); -if (new =NULL ) { +if (!new) { ret = -ENOMEM ; goto err_range; }
@@ -1014,10 +1014,10 @@ struct regmap *__regmap_init(struct device *dev, goto err_range; } -if (map->selector_work_buf =NULL ) { +if (!map->selector_work_buf) { map->selector_work_buf kzalloc(map->format.buf_size, GFP_KERNEL); -if (map->selector_work_buf =NULL ) { +if (!map->selector_work_buf) { ret = -ENOMEM ; goto err_range; }
Signature · 1 line
2.13.0