regmap: Fix regmap_can_raw_write check
authorMarkus Pargmann <mpa@pengutronix.de>
Wed, 12 Aug 2015 10:12:33 +0000 (12:12 +0200)
committerMark Brown <broonie@kernel.org>
Fri, 14 Aug 2015 18:07:39 +0000 (19:07 +0100)
This function is missing a check if map->bus->write is implemented. If
it is not implemented arbitrary raw writes are not possible.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/base/regmap/regmap.c

index 7111d04f26218be0529f4702cb1b361ae07a0b00..8e7208d92de12731d1633df9d28fb2c5d4b52aee 100644 (file)
@@ -1382,7 +1382,8 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg,
  */
 bool regmap_can_raw_write(struct regmap *map)
 {
-       return map->bus && map->format.format_val && map->format.format_reg;
+       return map->bus && map->bus->write && map->format.format_val &&
+               map->format.format_reg;
 }
 EXPORT_SYMBOL_GPL(regmap_can_raw_write);