diff options
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/regmap/regmap-mmio.c | 6 |
1 files changed, 3 insertions, 3 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); |