regmap: Correct offset handling in regmap_volatile_range
authorCharles Keepax <ckeepax@opensource.cirrus.com>
Mon, 12 Feb 2018 18:15:45 +0000 (18:15 +0000)
committerMark Brown <broonie@kernel.org>
Tue, 13 Feb 2018 12:26:12 +0000 (12:26 +0000)
The current implementation is broken for regmaps that have a reg_stride,
since it doesn't take the stride into account. Correct this by using the
helper function to calculate the register offset.

Fixes: f01ee60fffa4 ("regmap: implement register striding")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/base/regmap/regmap.c

index ee302ccdfbc8d366fec3f39574a4c28462b20240..f89d01e7b257e4a6aeda8c98152c2237e73abd4d 100644 (file)
@@ -174,7 +174,7 @@ static bool regmap_volatile_range(struct regmap *map, unsigned int reg,
        unsigned int i;
 
        for (i = 0; i < num; i++)
        unsigned int i;
 
        for (i = 0; i < num; i++)
-               if (!regmap_volatile(map, reg + i))
+               if (!regmap_volatile(map, reg + regmap_get_offset(map, i)))
                        return false;
 
        return true;
                        return false;
 
        return true;