Commit e6353328 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branch 'regmap/topic/core' into regmap-next

parents fad01e86 2e804b7c
...@@ -61,9 +61,9 @@ static int regmap_mmio_regbits_check(size_t reg_bits) ...@@ -61,9 +61,9 @@ static int regmap_mmio_regbits_check(size_t reg_bits)
} }
} }
static inline void regmap_mmio_count_check(size_t count) static inline void regmap_mmio_count_check(size_t count, u32 offset)
{ {
BUG_ON(count % 2 != 0); BUG_ON(count <= offset);
} }
static int regmap_mmio_gather_write(void *context, 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,7 +120,7 @@ static int regmap_mmio_write(void *context, const void *data, size_t count)
struct regmap_mmio_context *ctx = context; struct regmap_mmio_context *ctx = context;
u32 offset = ctx->reg_bytes + ctx->pad_bytes; u32 offset = ctx->reg_bytes + ctx->pad_bytes;
regmap_mmio_count_check(count); regmap_mmio_count_check(count, offset);
return regmap_mmio_gather_write(context, data, ctx->reg_bytes, return regmap_mmio_gather_write(context, data, ctx->reg_bytes,
data + offset, count - offset); data + offset, count - offset);
......
...@@ -1615,6 +1615,9 @@ static int _regmap_raw_multi_reg_write(struct regmap *map, ...@@ -1615,6 +1615,9 @@ static int _regmap_raw_multi_reg_write(struct regmap *map,
size_t pair_size = reg_bytes + pad_bytes + val_bytes; size_t pair_size = reg_bytes + pad_bytes + val_bytes;
size_t len = pair_size * num_regs; size_t len = pair_size * num_regs;
if (!len)
return -EINVAL;
buf = kzalloc(len, GFP_KERNEL); buf = kzalloc(len, GFP_KERNEL);
if (!buf) if (!buf)
return -ENOMEM; return -ENOMEM;
...@@ -1662,7 +1665,7 @@ static int _regmap_range_multi_paged_reg_write(struct regmap *map, ...@@ -1662,7 +1665,7 @@ static int _regmap_range_multi_paged_reg_write(struct regmap *map,
int ret; int ret;
int i, n; int i, n;
struct reg_default *base; struct reg_default *base;
unsigned int this_page; unsigned int this_page = 0;
/* /*
* the set of registers are not neccessarily in order, but * the set of registers are not neccessarily in order, but
* since the order of write must be preserved this algorithm * since the order of write must be preserved this algorithm
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment