diff options
author | Mark Brown <broonie@linaro.org> | 2014-06-02 12:07:38 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-06-02 12:07:38 -0400 |
commit | e6353328eeb7874bb5a98e226237098a8f475232 (patch) | |
tree | ed20cab6a40758c58d0a01115ee71e81758a3eb7 /drivers/base | |
parent | fad01e866afdbe01a1f3ec06a39c3a8b9e197014 (diff) | |
parent | 2e804b7c72d4efd2318428a2c1e40fd0e173c487 (diff) |
Merge remote-tracking branch 'regmap/topic/core' into regmap-next
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/regmap/regmap-mmio.c | 6 | ||||
-rw-r--r-- | drivers/base/regmap/regmap.c | 5 |
2 files changed, 7 insertions, 4 deletions
diff --git a/drivers/base/regmap/regmap-mmio.c b/drivers/base/regmap/regmap-mmio.c index 1e03e7f8bacb..902c4fb5c760 100644 --- a/drivers/base/regmap/regmap-mmio.c +++ b/drivers/base/regmap/regmap-mmio.c | |||
@@ -61,9 +61,9 @@ static int regmap_mmio_regbits_check(size_t reg_bits) | |||
61 | } | 61 | } |
62 | } | 62 | } |
63 | 63 | ||
64 | static inline void regmap_mmio_count_check(size_t count) | 64 | static inline void regmap_mmio_count_check(size_t count, u32 offset) |
65 | { | 65 | { |
66 | BUG_ON(count % 2 != 0); | 66 | BUG_ON(count <= offset); |
67 | } | 67 | } |
68 | 68 | ||
69 | static int regmap_mmio_gather_write(void *context, | 69 | static int regmap_mmio_gather_write(void *context, |
@@ -120,7 +120,7 @@ static int regmap_mmio_write(void *context, const void *data, size_t count) | |||
120 | struct regmap_mmio_context *ctx = context; | 120 | struct regmap_mmio_context *ctx = context; |
121 | u32 offset = ctx->reg_bytes + ctx->pad_bytes; | 121 | u32 offset = ctx->reg_bytes + ctx->pad_bytes; |
122 | 122 | ||
123 | regmap_mmio_count_check(count); | 123 | regmap_mmio_count_check(count, offset); |
124 | 124 | ||
125 | return regmap_mmio_gather_write(context, data, ctx->reg_bytes, | 125 | return regmap_mmio_gather_write(context, data, ctx->reg_bytes, |
126 | data + offset, count - offset); | 126 | data + offset, count - offset); |
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 63e30ef096e2..35869755d464 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c | |||
@@ -1615,6 +1615,9 @@ static int _regmap_raw_multi_reg_write(struct regmap *map, | |||
1615 | size_t pair_size = reg_bytes + pad_bytes + val_bytes; | 1615 | size_t pair_size = reg_bytes + pad_bytes + val_bytes; |
1616 | size_t len = pair_size * num_regs; | 1616 | size_t len = pair_size * num_regs; |
1617 | 1617 | ||
1618 | if (!len) | ||
1619 | return -EINVAL; | ||
1620 | |||
1618 | buf = kzalloc(len, GFP_KERNEL); | 1621 | buf = kzalloc(len, GFP_KERNEL); |
1619 | if (!buf) | 1622 | if (!buf) |
1620 | return -ENOMEM; | 1623 | return -ENOMEM; |
@@ -1662,7 +1665,7 @@ static int _regmap_range_multi_paged_reg_write(struct regmap *map, | |||
1662 | int ret; | 1665 | int ret; |
1663 | int i, n; | 1666 | int i, n; |
1664 | struct reg_default *base; | 1667 | struct reg_default *base; |
1665 | unsigned int this_page; | 1668 | unsigned int this_page = 0; |
1666 | /* | 1669 | /* |
1667 | * the set of registers are not neccessarily in order, but | 1670 | * the set of registers are not neccessarily in order, but |
1668 | * since the order of write must be preserved this algorithm | 1671 | * since the order of write must be preserved this algorithm |