regmap: mmio: convert some error returns to BUG()
authorStephen Warren <swarren@nvidia.com>
Fri, 6 Apr 2012 21:17:32 +0000 (15:17 -0600)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 13 Apr 2012 10:29:17 +0000 (11:29 +0100)
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>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/base/regmap/regmap-mmio.c

index 1a7b5ee11abc337412e4952717830471679a28b4..ffa0e850839e70c1bc793a7ca443fb48498d4d83 100644 (file)
@@ -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;