aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/base/regmap/regmap.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 4ac63c0e50c7..a8f6dd9457be 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1513,7 +1513,7 @@ int regmap_write(struct regmap *map, unsigned int reg, unsigned int val)
1513{ 1513{
1514 int ret; 1514 int ret;
1515 1515
1516 if (reg % map->reg_stride) 1516 if (!IS_ALIGNED(reg, map->reg_stride))
1517 return -EINVAL; 1517 return -EINVAL;
1518 1518
1519 map->lock(map->lock_arg); 1519 map->lock(map->lock_arg);
@@ -1540,7 +1540,7 @@ int regmap_write_async(struct regmap *map, unsigned int reg, unsigned int val)
1540{ 1540{
1541 int ret; 1541 int ret;
1542 1542
1543 if (reg % map->reg_stride) 1543 if (!IS_ALIGNED(reg, map->reg_stride))
1544 return -EINVAL; 1544 return -EINVAL;
1545 1545
1546 map->lock(map->lock_arg); 1546 map->lock(map->lock_arg);
@@ -1714,7 +1714,7 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
1714 1714
1715 if (map->bus && !map->format.parse_inplace) 1715 if (map->bus && !map->format.parse_inplace)
1716 return -EINVAL; 1716 return -EINVAL;
1717 if (reg % map->reg_stride) 1717 if (!IS_ALIGNED(reg, map->reg_stride))
1718 return -EINVAL; 1718 return -EINVAL;
1719 1719
1720 /* 1720 /*
@@ -1983,7 +1983,7 @@ static int _regmap_multi_reg_write(struct regmap *map,
1983 int reg = regs[i].reg; 1983 int reg = regs[i].reg;
1984 if (!map->writeable_reg(map->dev, reg)) 1984 if (!map->writeable_reg(map->dev, reg))
1985 return -EINVAL; 1985 return -EINVAL;
1986 if (reg % map->reg_stride) 1986 if (!IS_ALIGNED(reg, map->reg_stride))
1987 return -EINVAL; 1987 return -EINVAL;
1988 } 1988 }
1989 1989
@@ -2133,7 +2133,7 @@ int regmap_raw_write_async(struct regmap *map, unsigned int reg,
2133 2133
2134 if (val_len % map->format.val_bytes) 2134 if (val_len % map->format.val_bytes)
2135 return -EINVAL; 2135 return -EINVAL;
2136 if (reg % map->reg_stride) 2136 if (!IS_ALIGNED(reg, map->reg_stride))
2137 return -EINVAL; 2137 return -EINVAL;
2138 2138
2139 map->lock(map->lock_arg); 2139 map->lock(map->lock_arg);
@@ -2260,7 +2260,7 @@ int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val)
2260{ 2260{
2261 int ret; 2261 int ret;
2262 2262
2263 if (reg % map->reg_stride) 2263 if (!IS_ALIGNED(reg, map->reg_stride))
2264 return -EINVAL; 2264 return -EINVAL;
2265 2265
2266 map->lock(map->lock_arg); 2266 map->lock(map->lock_arg);
@@ -2296,7 +2296,7 @@ int regmap_raw_read(struct regmap *map, unsigned int reg, void *val,
2296 return -EINVAL; 2296 return -EINVAL;
2297 if (val_len % map->format.val_bytes) 2297 if (val_len % map->format.val_bytes)
2298 return -EINVAL; 2298 return -EINVAL;
2299 if (reg % map->reg_stride) 2299 if (!IS_ALIGNED(reg, map->reg_stride))
2300 return -EINVAL; 2300 return -EINVAL;
2301 if (val_count == 0) 2301 if (val_count == 0)
2302 return -EINVAL; 2302 return -EINVAL;
@@ -2414,7 +2414,7 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
2414 size_t val_bytes = map->format.val_bytes; 2414 size_t val_bytes = map->format.val_bytes;
2415 bool vol = regmap_volatile_range(map, reg, val_count); 2415 bool vol = regmap_volatile_range(map, reg, val_count);
2416 2416
2417 if (reg % map->reg_stride) 2417 if (!IS_ALIGNED(reg, map->reg_stride))
2418 return -EINVAL; 2418 return -EINVAL;
2419 2419
2420 if (map->bus && map->format.parse_inplace && (vol || map->cache_type == REGCACHE_NONE)) { 2420 if (map->bus && map->format.parse_inplace && (vol || map->cache_type == REGCACHE_NONE)) {