summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2014-09-29 20:49:40 +0100
committerMark Brown <broonie@kernel.org>2014-09-29 20:49:40 +0100
commit25a948778759ad87d7b005522248cec97eaaa4c5 (patch)
tree37edf6ad96397c651120cb4ecbd9b7c9ac47b081 /drivers/base
parentfe82dcec644244676d55a1384c958d5f67979adb (diff)
parentd6b41cb06044a7d895db82bdd54f6e4219970510 (diff)
Merge remote-tracking branch 'regmap/fix/core' into regmap-linus
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/regmap/regmap.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 1cf427bc0d4..3a785a4f4ff 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1408,7 +1408,7 @@ int _regmap_write(struct regmap *map, unsigned int reg,
}
#ifdef LOG_DEVICE
- if (strcmp(dev_name(map->dev), LOG_DEVICE) == 0)
+ if (map->dev && strcmp(dev_name(map->dev), LOG_DEVICE) == 0)
dev_info(map->dev, "%x <= %x\n", reg, val);
#endif
@@ -1659,6 +1659,9 @@ out:
} else {
void *wval;
+ if (!val_count)
+ return -EINVAL;
+
wval = kmemdup(val, val_count * val_bytes, GFP_KERNEL);
if (!wval) {
dev_err(map->dev, "Error in memory allocation\n");
@@ -2058,7 +2061,7 @@ static int _regmap_read(struct regmap *map, unsigned int reg,
ret = map->reg_read(context, reg, val);
if (ret == 0) {
#ifdef LOG_DEVICE
- if (strcmp(dev_name(map->dev), LOG_DEVICE) == 0)
+ if (map->dev && strcmp(dev_name(map->dev), LOG_DEVICE) == 0)
dev_info(map->dev, "%x => %x\n", reg, *val);
#endif