diff options
-rw-r--r-- | drivers/base/regmap/regmap.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 1cf427bc0d4a..3a785a4f4ff6 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, | |||
1408 | } | 1408 | } |
1409 | 1409 | ||
1410 | #ifdef LOG_DEVICE | 1410 | #ifdef LOG_DEVICE |
1411 | if (strcmp(dev_name(map->dev), LOG_DEVICE) == 0) | 1411 | if (map->dev && strcmp(dev_name(map->dev), LOG_DEVICE) == 0) |
1412 | dev_info(map->dev, "%x <= %x\n", reg, val); | 1412 | dev_info(map->dev, "%x <= %x\n", reg, val); |
1413 | #endif | 1413 | #endif |
1414 | 1414 | ||
@@ -1659,6 +1659,9 @@ out: | |||
1659 | } else { | 1659 | } else { |
1660 | void *wval; | 1660 | void *wval; |
1661 | 1661 | ||
1662 | if (!val_count) | ||
1663 | return -EINVAL; | ||
1664 | |||
1662 | wval = kmemdup(val, val_count * val_bytes, GFP_KERNEL); | 1665 | wval = kmemdup(val, val_count * val_bytes, GFP_KERNEL); |
1663 | if (!wval) { | 1666 | if (!wval) { |
1664 | dev_err(map->dev, "Error in memory allocation\n"); | 1667 | dev_err(map->dev, "Error in memory allocation\n"); |
@@ -2058,7 +2061,7 @@ static int _regmap_read(struct regmap *map, unsigned int reg, | |||
2058 | ret = map->reg_read(context, reg, val); | 2061 | ret = map->reg_read(context, reg, val); |
2059 | if (ret == 0) { | 2062 | if (ret == 0) { |
2060 | #ifdef LOG_DEVICE | 2063 | #ifdef LOG_DEVICE |
2061 | if (strcmp(dev_name(map->dev), LOG_DEVICE) == 0) | 2064 | if (map->dev && strcmp(dev_name(map->dev), LOG_DEVICE) == 0) |
2062 | dev_info(map->dev, "%x => %x\n", reg, *val); | 2065 | dev_info(map->dev, "%x => %x\n", reg, *val); |
2063 | #endif | 2066 | #endif |
2064 | 2067 | ||