* [PATCH v2] regmap: mmio: Fix regmap_mmio_write for uneven counts
@ 2014-05-16 14:25 Philipp Zabel
2014-05-26 15:56 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Philipp Zabel @ 2014-05-16 14:25 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-kernel, kernel, Philipp Zabel
Commit 932580409a9dacbf42215fa737bf06ae2c0aa624
"regmap: mmio: Add support for 1/2/8 bytes wide register address."
broke regmap_mmio_write for uneven counts, for example 32-bit register
addresses with no padding and 8-byte values (count = 5).
Fix this by allowing all counts large enough to include some value.
This check was BUG_ON(count < 4) before the last change.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
Changes since v1:
- Added missing offset parameter.
---
drivers/base/regmap/regmap-mmio.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/base/regmap/regmap-mmio.c b/drivers/base/regmap/regmap-mmio.c
index 1e03e7f..902c4fb 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)
}
}
-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,
@@ -120,7 +120,7 @@ static int regmap_mmio_write(void *context, const void *data, size_t count)
struct regmap_mmio_context *ctx = context;
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,
data + offset, count - offset);
--
2.0.0.rc0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] regmap: mmio: Fix regmap_mmio_write for uneven counts
2014-05-16 14:25 [PATCH v2] regmap: mmio: Fix regmap_mmio_write for uneven counts Philipp Zabel
@ 2014-05-26 15:56 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2014-05-26 15:56 UTC (permalink / raw)
To: Philipp Zabel; +Cc: Greg Kroah-Hartman, linux-kernel, kernel
[-- Attachment #1: Type: text/plain, Size: 461 bytes --]
On Fri, May 16, 2014 at 04:25:34PM +0200, Philipp Zabel wrote:
> Commit 932580409a9dacbf42215fa737bf06ae2c0aa624
> "regmap: mmio: Add support for 1/2/8 bytes wide register address."
> broke regmap_mmio_write for uneven counts, for example 32-bit register
> addresses with no padding and 8-byte values (count = 5).
> Fix this by allowing all counts large enough to include some value.
> This check was BUG_ON(count < 4) before the last change.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-05-26 15:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-16 14:25 [PATCH v2] regmap: mmio: Fix regmap_mmio_write for uneven counts Philipp Zabel
2014-05-26 15:56 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®