linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] regmap: mmio: convert some error returns to BUG()
@ 2012-04-06 21:17 Stephen Warren
  2012-04-06 21:17 ` [PATCH 2/2] regmap: mmio: remove some error checks now in the core Stephen Warren
  2012-04-07  8:26 ` [PATCH 1/2] regmap: mmio: convert some error returns to BUG() Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Stephen Warren @ 2012-04-06 21:17 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel, Stephen Warren

From: Stephen Warren <swarren@nvidia.com>

Some of the error conditions detected by regmap_mmio_*() are pure internal
errors, rather than user-/client-triggerable conditions. Convert these to
BUG().

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 drivers/base/regmap/regmap-mmio.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/base/regmap/regmap-mmio.c b/drivers/base/regmap/regmap-mmio.c
index 1a7b5ee..ffa0e85 100644
--- a/drivers/base/regmap/regmap-mmio.c
+++ b/drivers/base/regmap/regmap-mmio.c
@@ -35,8 +35,8 @@ static int regmap_mmio_gather_write(void *context,
 	struct regmap_mmio_context *ctx = context;
 	u32 offset;
 
-	if (reg_size != 4)
-		return -EIO;
+	BUG_ON(reg_size != 4);
+
 	if (val_size % ctx->val_bytes)
 		return -EIO;
 
@@ -60,7 +60,7 @@ static int regmap_mmio_gather_write(void *context,
 #endif
 		default:
 			/* Should be caught by regmap_mmio_check_config */
-			return -EIO;
+			BUG();
 		}
 		val_size -= ctx->val_bytes;
 		val += ctx->val_bytes;
@@ -72,8 +72,8 @@ static int regmap_mmio_gather_write(void *context,
 
 static int regmap_mmio_write(void *context, const void *data, size_t count)
 {
-	if (count < 4)
-		return -EIO;
+	BUG_ON(count < 4);
+
 	return regmap_mmio_gather_write(context, data, 4, data + 4, count - 4);
 }
 
@@ -84,8 +84,8 @@ static int regmap_mmio_read(void *context,
 	struct regmap_mmio_context *ctx = context;
 	u32 offset;
 
-	if (reg_size != 4)
-		return -EIO;
+	BUG_ON(reg_size != 4);
+
 	if (val_size % ctx->val_bytes)
 		return -EIO;
 
@@ -109,7 +109,7 @@ static int regmap_mmio_read(void *context,
 #endif
 		default:
 			/* Should be caught by regmap_mmio_check_config */
-			return -EIO;
+			BUG();
 		}
 		val_size -= ctx->val_bytes;
 		val += ctx->val_bytes;
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] regmap: mmio: remove some error checks now in the core
  2012-04-06 21:17 [PATCH 1/2] regmap: mmio: convert some error returns to BUG() Stephen Warren
@ 2012-04-06 21:17 ` Stephen Warren
  2012-04-07  8:26 ` [PATCH 1/2] regmap: mmio: convert some error returns to BUG() Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Warren @ 2012-04-06 21:17 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel, Stephen Warren

From: Stephen Warren <swarren@nvidia.com>

These error checks are implemented in regmap core. Remove the duplicate
code from regmap-mmio.c

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
This logically slight depends on "regmap: validate regmap_raw_read/write
val_len" that I just sent, but its not really a big deal.

 drivers/base/regmap/regmap-mmio.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/drivers/base/regmap/regmap-mmio.c b/drivers/base/regmap/regmap-mmio.c
index ffa0e85..bdf4dc8 100644
--- a/drivers/base/regmap/regmap-mmio.c
+++ b/drivers/base/regmap/regmap-mmio.c
@@ -37,9 +37,6 @@ static int regmap_mmio_gather_write(void *context,
 
 	BUG_ON(reg_size != 4);
 
-	if (val_size % ctx->val_bytes)
-		return -EIO;
-
 	offset = be32_to_cpup(reg);
 
 	while (val_size) {
@@ -86,9 +83,6 @@ static int regmap_mmio_read(void *context,
 
 	BUG_ON(reg_size != 4);
 
-	if (val_size % ctx->val_bytes)
-		return -EIO;
-
 	offset = be32_to_cpup(reg);
 
 	while (val_size) {
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] regmap: mmio: convert some error returns to BUG()
  2012-04-06 21:17 [PATCH 1/2] regmap: mmio: convert some error returns to BUG() Stephen Warren
  2012-04-06 21:17 ` [PATCH 2/2] regmap: mmio: remove some error checks now in the core Stephen Warren
@ 2012-04-07  8:26 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2012-04-07  8:26 UTC (permalink / raw)
  To: Stephen Warren; +Cc: linux-kernel, Stephen Warren

[-- Attachment #1: Type: text/plain, Size: 304 bytes --]

On Fri, Apr 06, 2012 at 03:17:32PM -0600, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
> 
> Some of the error conditions detected by regmap_mmio_*() are pure internal
> errors, rather than user-/client-triggerable conditions. Convert these to
> BUG().

Applied both, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-07  8:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-06 21:17 [PATCH 1/2] regmap: mmio: convert some error returns to BUG() Stephen Warren
2012-04-06 21:17 ` [PATCH 2/2] regmap: mmio: remove some error checks now in the core Stephen Warren
2012-04-07  8:26 ` [PATCH 1/2] regmap: mmio: convert some error returns to BUG() Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).